X-Git-Url: http://git.treefish.org/fex.git/blobdiff_plain/e5c93609849bda051fff54b5d5265af5608c6c69..HEAD:/bin/fac?ds=inline diff --git a/bin/fac b/bin/fac index 1458ef8..c2d59f4 100755 --- a/bin/fac +++ b/bin/fac @@ -57,10 +57,10 @@ die "$0: \$admin not configured in $FEXLIB/fex.ph\n" unless $admin; $EDITOR = $ENV{EDITOR} || $ENV{VISUAL} || (-x '/usr/bin/editor' ? '/usr/bin/editor' : 'vi'); -$opt_c = $opt_v = $opt_l = $opt_L = $opt_h = $opt_w = $opt_u = $opt_R = 0; +$opt_c = $opt_v = $opt_l = $opt_L = $opt_h = $opt_w = $opt_u = 0; $opt_M = $opt_E = 0; $opt_r = $opt_d = $opt_q = $opt_a = $opt_n = $opt_k = $opt_m = ''; -$opt_y = $opt_S = $opt_C = $opt_D = $opt_A = $opt_V = $opt_P = ''; +$opt_y = $opt_S = $opt_C = $opt_D = $opt_A = $opt_V = $opt_P = $opt_R = ''; ${'opt_/'} = ''; @__ = @ARGV; @@ -80,7 +80,7 @@ if (abs_path($spooldir) ne abs_path("$FEXHOME/spool")) { warn "WARNING: \$spooldir differs from $FEXHOME/spool !\n"; } -getopts('hcvlLwuMRE/q:r:d:a:n:k:m:y:S:C:A:V:D:P:') or usage(2); +getopts('hcvlLwuME/q:r:d:a:n:k:m:y:S:C:A:V:D:P:R:') or usage(2); usage(0) if $opt_h; examples() if $opt_E; @@ -260,17 +260,32 @@ if ($opt_d) { # set user restriction file if ($opt_R) { - $user = shift or die "usage: $0 -R user\n"; - $user .= '@'.$mdomain if $mdomain and $user !~ /@/; - die "$0: no user $user\n" unless -d "$spooldir/$user"; - unless (@local_rdomains) { - die "$0: no \@local_rdomains in server config\n"; - } - my $rf = "$spooldir/$user/\@ALLOWED_RECIPIENTS"; - open $rf,'>',$rf or die "$0: cannot open $rf - $!"; - print {$rf} "\@LOCAL_RDOMAINS\n"; - close $rf; - print "$user restricted\n"; + if ($opt_R eq 'i') { + $user = shift or die "usage: $0 -Ri user\n"; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + die "$0: no user $user\n" unless -d "$spooldir/$user"; + unless (@local_rdomains) { + die "$0: no \@local_rdomains in server config\n"; + } + my $rf = "$spooldir/$user/\@ALLOWED_RECIPIENTS"; + open $rf,'>',$rf or die "$0: cannot open $rf - $!"; + print {$rf} "\@LOCAL_RDOMAINS\n"; + close $rf; + print "$user restricted to internal recipients\n"; + exit; + } elsif ($opt_R eq 'l') { + $user = shift or die "usage: $0 -Rl user\n"; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + die "$0: no user $user\n" unless -d "$spooldir/$user"; + my $rf = "$spooldir/$user/\@ALLOWED_RECIPIENTS"; + open $rf,'>',$rf or die "$0: cannot open $rf - $!"; + print {$rf} "\@LOCAL_USERS\n"; + close $rf; + print "$user restricted to local recipients\n"; + exit; + } else { + usage(2); + } exit; } @@ -862,7 +877,8 @@ $0 -u user auth-ID # create new user or set new auth-ID $0 -/ admin auth-ID # set new admin and auth-ID $0 -q user s:quota # set new disk quota (MB) for sender user $0 -q user r:quota # set new disk quota (MB) for recipient user -$0 -R user # restrict user: only internal recipients allowed +$0 -Ri user # restrict user: only internal domain recipients allowed +$0 -Rl user # restrict user: only local users as recipients allowed $0 -rr user # edit user recipients restriction $0 -ru user # edit user upload restriction $0 -rd user # edit user download restriction