umask 077;
# import from fex.pp
-our ($FEXHOME,$FHS,$hostname,$spooldir,$logdir,$akeydir,$docdir);
+our ($FEXHOME,$FHS,$hostname,$spooldir,@logdir,$akeydir,$docdir);
our ($durl,@durl,$mdomain,$admin,$mailmode);
our ($autodelete,$keep_default,$keep_max,$recipient_quota,$sender_quota);
our (@local_rdomains);
# show logfile
if ($opt_w) {
- $log = "$logdir/fexsrv.log";
+ $log = $logdir[0]."/fexsrv.log";
warn "$0: polling $log\n\n";
exec "$FEXHOME/bin/logwatch",$log;
die "$0: logwatch not found\n";
}
# show config
-if ($opt_v) {
+if ($opt_v and not @ARGV) {
print "config from $FEXLIB/fex.ph :\n";
print " spooldir = $spooldir\n";
- print " logdir = $logdir\n";
+ print " logdir = @logdir\n";
print " docdir = $docdir\n";
print " durl = @durl\n";
print " admin = $admin\n";
# add user or show user config
if ($opt_u) {
+ chdir $spooldir or die "$0: cannot chdir $spooldir = $!\n";
if ($opt_u = shift @ARGV) {
$user = lc $opt_u;
$user .= '@'.$mdomain if $mdomain and $user !~ /@/;
$id = shift @ARGV;
- $idf = "$spooldir/$user/@";
+ $idf = "$user/@";
if (open $idf,$idf) {
chomp($ido = <$idf>||'');
close $idf;
}
unless ($id) {
- die "$0: $user is not a FEX user\n" unless -f "$spooldir/$user/@";
+ die "$0: $user is not a regular FEX user\n" unless -f "$user/@";
showuser($user,$ido);
exit;
}
unless ($user =~ /\w@[\w.-]+\.[a-z]+$/) {
die "$0: $user is not a valid email-address!\n";
}
- unless (-d "$spooldir/$user") {
- mkdir "$spooldir/$user",0755
- or die "$0: cannot mkdir $spooldir/$user - $!\n";
+ unless (-d $user) {
+ mkdir $user,0755
+ or die "$0: cannot mkdir $user - $!\n";
}
open F,">$idf" or die "$0: cannot write $idf - $!\n";
print F $id,"\n";
showuser($user,$id);
} else {
print "Users in $spooldir:\n";
- foreach $user (glob "$spooldir/*/@") {
+ foreach $user (glob "*/@") {
$user =~ s:.*/(.+)/@:$1:;
print "$user\n";
}
$user = lc $opt_q;
$user .= '@'.$mdomain if $mdomain and $user !~ /@/;
unless (-d "$spooldir/$user") {
- die "$0: $user is not a regular FEX user\n";
+ die "$0: $user is not a FEX user\n";
}
quota($user,@ARGV);
exit;
sub showuser {
my $user = shift;
my $id = shift;
- my ($keep,$autodelete,$notification);
+ my ($keep,$autodelete,$notification,$login);
$user .= '@'.$mdomain if $mdomain and $user !~ /@/;
printf "%s/%s\n",$fup,b64("from=$user&id=$id");
# printf "%s/%s\n",$fup,b64("from=$user&to=$user&id=$id&submit=.");
print "spool: $spooldir/$user/\n";
+ if ($login_check and $login = readlink "$user/.login") {
+ my $lc = &$login_check($login);
+ if ($lc) {
+ print "login: $login\n";
+ } else {
+ print "login: DELETED\n";
+ }
+ }
printf "fex yourself web default: %s\n",
-e "$spooldir/$user/\@FEXYOURSELF" ? 'yes' : 'no';
printf "persistent: %s\n",
my ($log,$u,$d,$z);
my $Z = 0;
- if (-t) { $log = "$logdir/fup.log" }
+ if (-t) { $log = $logdir[0].'/fup.log' }
else { $log = '>&=STDIN' }
open $log,$log or die "$0: cannot open $log - $!\n";
my ($log,$u,$d,$z);
my (%user,%domain,%du);
- if (-t) { $log = "$logdir/fop.log" }
+ if (-t) { $log = $logdir[0].'/fop.log' }
else { $log = '>&=STDIN' }
open $log,$log or die "$0: cannot open $log - $!\n";
}
-sub mtime {
- my @s = lstat shift;
- return @s ? $s[9] : undef;
-}
-
sub check_admin {
my $admin_id = slurp("$spooldir/$admin/@") or