Hi,

There's still a bug lurking in the code, but now for a fault situation 
only fortunately, far as I can tell.

How to reproduce:

- use Outlook Express
- create account
- FORGET to check the checkmark 'Outgoing (SMTP) server requires 
authentication'
- start XMAIL server and have SMTP-after-POP# ENabled (by default)
- send email from OE to XMAIL

==> OE will receive a non-compliant error line from XMAIL reading 
"(null)" (  oops! :-(  ) instead of "nnn yada yada" where "nnn" is a 
3-digit number conform SMTP RFC.

Why? Because OE _first_ does the SMTP access, THEN does a POP3, so 
SMTP-after-POP3 MUST fail as this is really a client setup failure which 
LOOKS LIKE a possible SMTP-after-POP3 attempt.


As the "(null)" already suggests, this failure is due to the fact that 
an error string has not been initialized where expected. And indeed it 
hasn't: see the new

pszSMTPError = SysStrDup(...)

code lines.


Fix diff shown below. Basically the fix mimics the behaviour of other 
similar sections of the code, while a '504 internal server error' 
(number should be checked, I pulled that one out of my hat at 01:00 AM ! 
) is reported when the 'uninitialized error string' recurs ever again.

Best regards,

Ger


PS: ignore the ASSERT() lines in the diff: I am a fervent user of custom 
ASSERT() macros when the shit hits the fan (and preferably BEFORE that 
time), so I created a tiny SysAssert.h which defines this macro and 
accompanying code so I can check all sorts of assumptions in the code at 
run time with the least bit of fuss. If anyone is interested, I can post 
that bit of code too.


--- ../../1original/xmail/SMTPSvr.cpp   2007-11-02 01:34:32.000000000 +0100
+++ ./SMTPSvr.cpp       2007-11-20 02:03:53.000000000 +0100
@@ -22,6 +22,9 @@
 
 #include "SysInclude.h"
 #include "SysDep.h"
+/* [i_a] */
+#include "SysAssert.h"
+
 #include "SvrDefines.h"
 #include "SList.h"
 #include "ShBlocks.h"
@@ -939,7 +944,7 @@
                        break;
 
                /* Handle command */
-               SMTPHandleCommand(szCommand, hBSock, SMTPS);
+               (void)SMTPHandleCommand(szCommand, hBSock, SMTPS); /* [i_a] we 
EXPLICITLY do NOT check the return code / error code here */
        }
 
        SysLogMessage(LOG_LEV_MESSAGE, "SMTP client exit [%s]\n",
@@ -1131,7 +1136,16 @@
        }
        /* Check SMTP after POP3 authentication */
        if (SvrTestConfigFlag("EnableAuthSMTP-POP3", true, SMTPS.hSvrConfig))
-               SMTPTryPopAuthIpCheck(SMTPS, szMailerUser, szMailerDomain);
+       {
+               if (SMTPTryPopAuthIpCheck(SMTPS, szMailerUser, szMailerDomain))
+               {
+                       pszSMTPError = SysStrDup("504 You did not authenticate 
properly using SMTP-after-POP3");
+
+                       SysLogMessage(LOG_LEV_DEBUG, "mail user '[EMAIL 
PROTECTED]' did not authenticate properly using SMTP-after-POP3: %d: %s\n",
+                               szMailerUser, szMailerDomain, 
ErrGetErrorCode(), ErrGetErrorString());
+                       return ErrGetErrorCode();
+               }
+       }
 
        /* Check extended mail from parameters */
        if (SMTPCheckMailParams(pszCommand, ppszRetDomains, SMTPS, 
pszSMTPError) < 0)
@@ -1228,8 +1242,14 @@
                StrFreeStrings(ppszRetDomains);
                SMTPResetSession(SMTPS);
 
+               ASSERT(pszSMTPError != NULL);
+               if (pszSMTPError != NULL) {
                SMTPSendError(hBSock, SMTPS, "%s", pszSMTPError);
                SysFree(pszSMTPError);
+               }
+               else {
+                       SMTPSendError(hBSock, SMTPS, "501 Internal server error 
while echecking return path");
+               }
                return ErrorPop();
        }
        StrFreeStrings(ppszRetDomains);
@@ -1614,8 +1634,15 @@
                ErrorPush();
                StrFreeStrings(ppszFwdDomains);
 
+               ASSERT(pszSMTPError);
+               if (pszSMTPError != NULL) {
                SMTPSendError(hBSock, SMTPS, "%s", pszSMTPError);
                SysFree(pszSMTPError);
+               }
+               else {
+                       SMTPSendError(hBSock, SMTPS, "501 Internal server error 
while checking forward path");
+               }
+
                return ErrorPop();
        }
        StrFreeStrings(ppszFwdDomains);









-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to