Hello!

I was facing a strange behavior of qpsmtpd when testing an authentication plugin (auth-plain). The error was: "Command Error: No such pseudo-hash field "_auth_user" at lib/Qpsmtpd/Auth.pm line 331." I don't understand why this hash key was not created in the structure. However, after analysing the structure of $session object (around line 326 Auth.pm) and the fact that authentication informations are related to the _connection_ (not transaction or low level socket information) I _suggest_ that authentication information (user, method, sucess/failure) to be positioned in the _connection_ structure. Patchs attached.

Revision tested: 540

Thanks.

--
Atenciosamente,

  Marco Aurelio Monteiro
   Analista de suporte
mmonteiro # viaconnect.com.br
--------------------------------
Viaconnect - Conectividade Total
  Fone: +55 (54) 2101-5500

--- Auth.pm.orig        Tue Aug  2 17:00:19 2005
+++ Auth.pm     Tue Aug  2 17:45:10 2005
@@ -231,12 +231,12 @@
 
     #they AUTH'd once already
     return $self->respond( 503, "but you already said AUTH ..." )
-      if ( defined $self->{_auth}
-        and $self->{_auth} == OK );
+      if ( defined $self->connection->{_auth}
+        and $self->connection->{_auth} == OK );
     return $self->respond( 503, "AUTH not defined for HELO" )
       if ( $self->connection->hello eq "helo" );
 
-    return $self->{_auth} = Qpsmtpd::Auth::SASL( $self, $arg, @stuff );
+    return $self->connection->{_auth} = Qpsmtpd::Auth::SASL( $self, $arg, 
@stuff );
 }
 
 sub SASL {
@@ -326,9 +326,9 @@
         $session->connection->relay_client(1);
         $session->log( LOGINFO, $msg );
 
-        $session->{_auth_user} = $user;
-        $session->{_auth_mechanism} = $mechanism;
-        s/[\r\n].*//s for ($session->{_auth_user}, 
$session->{_auth_mechanism}); 
+        $session->connection->{_auth_user} = $user;
+        $session->connection->{_auth_mechanism} = $mechanism;
+        s/[\r\n].*//s for ($session->connection->{_auth_user}, 
$session->connection->{_auth_mechanism}); 
 
         return OK;
     }
--- PollServer.pm.orig  Tue Aug  2 17:36:08 2005
+++ PollServer.pm       Tue Aug  2 17:36:58 2005
@@ -14,7 +14,6 @@
     max_size
     hooks
     start_time
-    _auth
     _commands
     _config_cache
     _connection
@@ -318,7 +317,7 @@
     }
     
     # only true if client authenticated
-    if ( defined $self->{_auth} and $self->{_auth} == OK ) { 
+    if ( defined $self->connection->{_auth} and $self->connection->{_auth} == 
OK ) { 
         $header->add("X-Qpsmtpd-Auth","True");
     }
     
--- SMTP.pm.orig        Tue Aug  2 17:09:22 2005
+++ SMTP.pm     Tue Aug  2 17:38:16 2005
@@ -550,8 +550,8 @@
   $self->transaction->header($header);
 
   my $smtp = $self->connection->hello eq "ehlo" ? "ESMTP" : "SMTP";
-  my $authheader = (defined $self->{_auth} and $self->{_auth} == OK) ?
-    "(smtp-auth username $self->{_auth_user}, mechanism 
$self->{_auth_mechanism})\n" : "";
+  my $authheader = (defined $self->connection->{_auth} and 
$self->connection->{_auth} == OK) ?
+    "(smtp-auth username $self->connection->{_auth_user}, mechanism 
$self->connection->{_auth_mechanism})\n" : "";
 
   $header->add("Received", "from ".$self->connection->remote_info
                ." (HELO ".$self->connection->hello_host . ") 
(".$self->connection->remote_ip

Reply via email to