severe error when using exim

Matthias Klose doko at CS.TU-BERLIN.DE
Fri Sep 6 20:06:44 IST 2002


when using exim as MTA, 3.22.12 first sets the uid, then the gid
... and fails. patch attached. there seems to be a copy & paste error
in the group check as well.

as an add on, it would be nice, if mailscanner would log the fact,
that it exits, to syslog as well. The only thing you see now is that
setting the gid fails. no hint on the exit.

--- mailscanner/bin/mailscanner~        2002-08-25 16:38:33.000000000 +0200
+++ mailscanner/bin/mailscanner 2002-09-06 21:00:40.000000000 +0200
@@ -123,6 +123,14 @@
 # Tried to set [u,g]id after writing pid, but then it fails when it re-execs itself.
 # Using the posix calls because I don't want to have to bother to find out what
 # happens when "$< = $uid" fails (i.e. not running as root). Yet.
+if ($Config::RunAsGroup ne "") {
+  my $gid = getgrnam($Config::RunAsGroup);
+  if ($gid) { # Only do this if setting to non-root
+    Log::InfoLog("ECS MailScanner setting GID to $Config::RunAsGroup ($gid)");
+    POSIX::setgid($gid) or Log::DieLog("Can't set GID $gid");
+  }
+}
+
 if ($Config::RunAsUser ne "") {
   my $uid = getpwnam($Config::RunAsUser);
   if ($uid) { # Only do this if setting to non-root
@@ -131,14 +139,6 @@
   }
 }

-if ($Config::RunAsUser ne "") {
-  my $gid = getgrnam($Config::RunAsGroup);
-  if ($gid) { # Only do this if setting to non-root
-    Log::InfoLog("ECS MailScanner setting GID to $Config::RunAsGroup ($gid)");
-    POSIX::setgid($gid) or Log::DieLog("Can't set GID $gid");
-  }
-}
-

 $> = $<;
 $) = $(;



More information about the MailScanner mailing list