- $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);
+ }