On Tue, 21 Aug 2007 21:00:19 -0700
Robert Spier <[EMAIL PROTECTED]> wrote:

> This CL appears to remove the functionality of processing the hook's
> return value.  Am I misreading it?
Yes, it removes it from this part. The return values are
checked in Qpsmtpd::SMTP::unrecognized_command_respond(), which also
sends the answer to the client (unless someone returned DONE, of
course). 
Checking it in Prefork.pm and (possibly) answering will result in a
double answer for the client, as the return values are checked twice
(and yes, I tested this before commit with the tls and chunking
plugins and really unknown commands like "GET / HTTP/1.0").
In case someone returned DONE, the double answers were irritating...
the plugin sent something like "2xx OK" and the Prefork.pm added an
"500 Unrecognized command".

Before the *_respond() were added in Qpsmtpd::SMTP, you had to check
the return codes yourself -- now there's the possibilty for the plugins
to call any hook, which has a corresponding _respond() function in
Qpsmtpd::SMTP, and no need to worry about the answers. See
contrib/vetinari/experimental/chunking for an example of data_post /
queue (the queue is called by the data post hook, any answers are
generated by the core).

        Hanno

> At Sat, 18 Aug 2007 23:49:43 -0700 (PDT),
> [EMAIL PROTECTED] wrote:
> > 
> > Author: vetinari
> > Date: Sat Aug 18 23:49:42 2007
> > New Revision: 772
> > 
> > Modified:
> >    trunk/lib/Qpsmtpd/SMTP/Prefork.pm
> > 
> > Log:
> > unrecognized command fix for 
> > http://code.google.com/p/smtpd/issues/detail?id=16
> > - the reporters poposed fix would have caused two messages for the client on
> >   return(DENY, ...) or a really unknown command.
> > 
> > 
> > Modified: trunk/lib/Qpsmtpd/SMTP/Prefork.pm
> > ==============================================================================
> > --- trunk/lib/Qpsmtpd/SMTP/Prefork.pm       (original)
> > +++ trunk/lib/Qpsmtpd/SMTP/Prefork.pm       Sat Aug 18 23:49:42 2007
> > @@ -10,22 +10,8 @@
> >    $self->{_counter}++; 
> >  
> >    if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1}) {
> > -    my ($rc, @msg) = $self->run_hooks("unrecognized_command", $cmd, @_);
> > -    @msg = map { split /\n/ } @msg;
> > -    if ($rc == DENY_DISCONNECT) {
> > -      $self->respond(521, @msg);
> > -      $self->disconnect;
> > -    }
> > -    elsif ($rc == DENY) {
> > -      $self->respond(500, @msg);
> > -    }
> > -    elsif ($rc == DONE) {
> > -      1;
> > -    }
> > -    else {
> > -      $self->respond(500, "Unrecognized command");
> > -    }
> > -    return 1
> > +    $self->run_hooks("unrecognized_command", $cmd, @_);
> > +    return 1;
> >    }
> >    $cmd = $1;
> >  
> 

Reply via email to