I've been running the SelectServer for a few weeks now, and have run across
two bugs:

  1. A plugin's disconnect handler is not run when the client disconnects
     without QUITing.  It seems to me that it should, as there is often
     some cleanup work to be done.

  2. IO::Socket will die() when attempting to send to a disconnected
     socket, and, at least on my system, the select will return
     disconnected sockets as ready to write. So, this either needs to be
     evaled or a check for connectedness need to be added.

I've attached a patch for the latter, and I'll look into number one if I
get some free time.

Also, I have added a patch to drop uid to qmaild, so that the server
can be run by init at system start.

On Mon, Feb 23, 2004 at 07:10:58AM -0800, Ask Bj?rn Hansen wrote:
> 
> I finally got around to updating the qpsmtpd page.  It now lives at:
> 
>       http://smtpd.develooper.com/
> 
> (the old location of course redirects)
> 
> Attentive readers will note that I am promising a 0.27 by the end of 
> this month.  I have a couple of patches already that I want to put in, 
> but if you have a *bugfix* that ought to be added, now would be a good 
> time to remind me!

-- 
 Au

 PGP Key ID: 0x385B44CB
 Fingerprint: 9E9E B116 DB2C D734 C090  E72F 43A0 95C4 385B 44CB
    "Maximus vero fugiens a quodam Urso, milite Romano, interemptus est"
                                               - Getica 235
--- lib/QpsmtpdSelectServer.pm  2004-02-23 08:33:48.000000000 -0800
+++ lib/Qpsmtpd/SelectServer.pm 2004-02-21 00:35:20.000000000 -0800
@@ -131,6 +138,9 @@
             next unless $outbuffer{$client};
             #print "Writing to $client\n";
             
+            $client->connected or
+                freeclient($client), next;
+
             my $rv = $client->send($outbuffer{$client}, 0);
             unless (defined($rv)) {
                 warn("I was told to write, but I can't: $!\n");
--- /tmp/SelectServer.pm        2004-02-23 08:33:48.000000000 -0800
+++ lib/Qpsmtpd/SelectServer.pm 2004-02-23 08:45:14.000000000 -0800
@@ -38,6 +38,14 @@
     my %opts = (LocalPort => 25, Reuse => 1, Listen => SOMAXCONN, @_);
     $server = IO::Socket::INET->new(%opts) or die "Server: $@";
     print "Listening on $opts{LocalPort}\n";
+
+    my (undef, undef, $quid, $qgid) = getpwnam("qmaild") or
+      die "unable to determine qmaild uid/gid\n";
+    $) = "";
+    POSIX::setgid($qgid) or
+      die "unable to change gid: $!\n";
+    POSIX::setuid($quid) or
+      die "unable to change uid: $!\n";
     
     nonblock($server);
     

Reply via email to