projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of https://github.com/adefaria/clearscm
[clearscm.git]
/
maps
/
bin
/
MAPSDeliver
diff --git
a/maps/bin/MAPSDeliver
b/maps/bin/MAPSDeliver
index
e58126c
..
38596c0
100755
(executable)
--- a/
maps/bin/MAPSDeliver
+++ b/
maps/bin/MAPSDeliver
@@
-2,11
+2,11
@@
################################################################################
#
# File: $RCSfile: MAPSDeliver,v $
################################################################################
#
# File: $RCSfile: MAPSDeliver,v $
-# Revision: $Revision: 1.1 $
+# Revision:
$Revision: 1.1 $
# Description: This script simply delivers the mail. It is separated out so
# Description: This script simply delivers the mail. It is separated out so
-# it can be the only portion that is setgid to the group mail
-# for the purposes of being able to deliver the mail to the users
-# maildrop
+#
it can be the only portion that is setgid to the group mail
+#
for the purposes of being able to deliver the mail to the users
+#
maildrop
# Author: Andrew@DeFaria.com
# Created: Fri Nov 29 14:17:21 2002
# Modified: $Date: 2013/06/12 14:05:47 $
# Author: Andrew@DeFaria.com
# Created: Fri Nov 29 14:17:21 2002
# Modified: $Date: 2013/06/12 14:05:47 $
@@
-18,35
+18,18
@@
use strict;
use warnings;
use strict;
use warnings;
-use English;
use FindBin;
use FindBin;
-# Untaint $FindBin::Bin
-my $lib;
-
-BEGIN {
- if ($FindBin::Bin =~ /^(.*)$/) {
- $lib = $1;
- } # if
-} # BEGIN
-
-use lib $lib;
+use lib "$FindBin::Bin/../lib";
+use lib "$FindBin::Bin/../../lib";
use MAPSFile;
use MAPSFile;
-use MAPS
DB
;
+use MAPS;
use MAPSLog;
use MAPSLog;
-sub DeliverMail
($$) {
+sub DeliverMail($$) {
my ($userid, $msgfileName) = @_;
my ($userid, $msgfileName) = @_;
- # Switch to group mail
- $EGID = getgrnam "mail";
-
- # Untaint $userid
- if ($userid =~ /^([-\@\w.]+)$/) {
- $userid = $1;
- } # if
-
# Open maildrop file
open my $maildrop, '>>', "/var/mail/$userid"
or return "Unable to open maildrop file (/var/mail/$userid): $!";
# Open maildrop file
open my $maildrop, '>>', "/var/mail/$userid"
or return "Unable to open maildrop file (/var/mail/$userid): $!";
@@
-59,9
+42,8
@@
sub DeliverMail ($$) {
Lock $maildrop;
# Write msgfile -> $maildrop
Lock $maildrop;
# Write msgfile -> $maildrop
- print $maildrop "\n";
- print $maildrop $_
- while (<$msgfile>);
+ print $maildrop "\n\n";
+ print $maildrop $_ while (<$msgfile>);
# Unlock the file
Unlock $maildrop;
# Unlock the file
Unlock $maildrop;
@@
-74,21
+56,24
@@
sub DeliverMail ($$) {
} # DeliverMail
# Main
} # DeliverMail
# Main
-die 'User id not specified' unless $ARGV [0];
-die 'Msgfile not specified' unless $ARGV [1];
+my ($userid, $msgfile) = @ARGV;
+
+die 'User id not specified' unless $userid;
+die 'Msgfile not specified' unless $msgfile;
-my $userid = shift @ARGV;
-my $msgfile = shift @ARGV;
+my $errmsg = DeliverMail($userid, $msgfile);
-my $err = DeliverMail $userid, $msgfile;
+if ($errmsg) {
+ #OpenDB('maps', 'spam');
-if ($err) {
- OpenDB 'mapsadmin', 'mapsadmin';
+ SetContext($userid);
- MAPSDB::SetContext $userid;
+ Error(
+ userid => $userid,
+ message => $errmsg,
+ );
-
Error $err
;
+
exit 1
;
} # if
} # if
-exit 1 if $err;
exit 0;
exit 0;