Mailing List Archive

proposal patch for spfd
Hi,
I'm new to the list
I have made a patch to add some test for spfd perl script
*) server is running ($server not empty)
*) DEBUG printing
*) correction of a "Use of uninitialized value in concatenation (.) or
string at /usr/bin/spfd line 223, <GEN5> line 4." with a test of the
existence of the hash key :
for (qw(result smtp_comment header_comment
guess smtp_guess header_guess
guess_tf smtp_tf header_tf
spf_record
)) { if($a{$_}) {print "moo! $_=$a{$_}\n"; } }


here the patch :
---

--- orig/spfd 2004-05-12 13:16:29.000000000 +0200
+++ new/spfd 2004-05-12 13:16:36.000000000 +0200
@@ -1,5 +1,8 @@
#!/usr/bin/perl -sw

+eval 'exec /usr/bin/perl -sw -S $0 ${1+"$@"}'
+ if 0; # not running under some shell
+
eval 'exec /usr/local/bin/perl -sw -S $0 ${1+"$@"}'
if 0; # not running under some shell

@@ -133,6 +136,8 @@
}
}

+unless($server) { die "Cannot create the server! exit\n"; }
+
DEBUG and print "$$: server is $server\n";

if ($setgroup) {
@@ -143,6 +148,8 @@
$) = $setgroup;
unless ($( == $setgroup and $) == $setgroup) {
die( "setgid($setgroup) call failed: $!\n" );
+ } else {
+ print "$$: Using group : $setgroup\n";
}
}

@@ -154,10 +161,15 @@
$> = $setuser;
unless ($< == $setuser and $> == $setuser) {
die( "setuid($setuser) call failed: $!\n" );
+ } else {
+ print "$$: Using user : $setuser\n";
}
}

while (my $sock = $server->accept()) {
+
+ DEBUG and print "$$: Sock : $sock\n";
+
if (fork) { close $sock; wait; next; } # this is the grandfather
trick.
elsif (fork) { exit; } # the child exits
immediately, so no zombies.

@@ -199,9 +211,8 @@
guess smtp_guess header_guess
guess_tf smtp_tf header_tf
spf_record
- )) {
- print "moo! $_=$a{$_}\n";
- }
+ )) { if($a{$_}) {print "moo! $_=$a{$_}\n"; } }
+
}

for (qw(result smtp_comment header_comment


---
and how to apply it : $ patch -p1 < patch.spfd.2004.05.12

Hope that it will help

--
WIAME Jean-Robert <jrw-abc-nospam@ngi.be>
National Geographic Institute (remove nospam)

-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname=spf-devel@v2.listbox.com