If you use -SI (-PI / -XI / -FI / -CI / -WI ) <ip[:port]> with the 
optional [:port] section included to specify a non-standard port for the 
<ip> interface address(es), you're SOL as the code calls the appropriate 
routine but does not extract the decoded port for further use, nor does 
it mix well with any attempt at using the -Sp <port> (-Pp / -Xp / 
etc.etc.) commands as an alternative attempt to set the custom port in 
there.

Added to the fix: extra check to make sure you CANNOT specify more 
interfaces than XMAIL has compiled support for (MAX_ACCEPT_ADDRESSES): 
if you specify more, an error will be reported.

Best regards,

Ger


PS: the additional error code

ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS

has been introduced to help report the latter out-of-bounds failure.

Code diff included below.


--- ../../1original/xmail/Errors.cpp    2007-11-02 01:34:32.000000000 +0100
+++ ./Errors.cpp        2007-11-20 01:09:52.000000000 +0100
@@ -305,6 +305,7 @@
        { ERR_INVALID_INET_ADDR, "Invalid INET address" },
        { ERR_SOCKET_SHUTDOWN, "Connection shutdown error" },
        { ERR_SSL_SHUTDOWN, "SSL connection shutdown error" },
+       { ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, "Too many ip[:port] combos 
specified for this server" },
 
 };
 
diff -u -EbwB -r --strip-trailing-cr -x resource.h -x '*.rc' -x '*.aps' -x 
VERSION.txt -x '*.ds*' -x '*.vcproj' -x '*.s*' -x '*.user' -x '*.ncb' -x '*.o' 
-x '*I_A*' -x '*.sh' -x '*.bak' ../../1original/xmail/Errors.h ./Errors.h
--- ../../1original/xmail/Errors.h      2007-11-02 01:34:32.000000000 +0100
+++ ./Errors.h  2007-11-20 01:09:52.000000000 +0100
@@ -817,6 +817,9 @@
                __ERR_SSL_SHUTDOWN,
 #define ERR_SSL_SHUTDOWN (-__ERR_SSL_SHUTDOWN)
 
+               __ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS,
+#define ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS 
(-__ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS)
+
                ERROR_COUNT
 };
 
--- ../../1original/xmail/MailSvr.cpp   2007-11-02 01:34:32.000000000 +0100
+++ ./MailSvr.cpp       2007-11-20 01:13:54.000000000 +0100
@@ -277,10 +275,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, CTRL_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if (++i < iArgCount &&
                            MscGetServerAddress(pszArgs[i],
-                                               
ThCfgCTRL.SvrAddr[ThCfgCTRL.iNumAddr]) == 0)
+                               ThCfgCTRL.SvrAddr[ThCfgCTRL.iNumAddr], iPort) 
== 0) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgCTRL.SvrAddr[ThCfgCTRL.iNumAddr]);
                                ++ThCfgCTRL.iNumAddr;
+                       }
                        break;
 
                case 'X':
@@ -399,10 +407,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, CTRLS_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if ((++i < iArgCount) &&
                            (MscGetServerAddress(pszArgs[i],
-                                                
ThCfgCTRLS.SvrAddr[ThCfgCTRLS.iNumAddr]) == 0))
+                               ThCfgCTRLS.SvrAddr[ThCfgCTRLS.iNumAddr], iPort) 
== 0)) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgCTRLS.SvrAddr[ThCfgCTRLS.iNumAddr]);
                                ++ThCfgCTRLS.iNumAddr;
+                       }
                        break;
 
                case '-':
@@ -476,10 +494,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, FING_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if (++i < iArgCount &&
                            MscGetServerAddress(pszArgs[i],
-                                               
ThCfgFING.SvrAddr[ThCfgFING.iNumAddr]) == 0)
+                               ThCfgFING.SvrAddr[ThCfgFING.iNumAddr], iPort) 
== 0) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgFING.SvrAddr[ThCfgFING.iNumAddr]);
                                ++ThCfgFING.iNumAddr;
+                       }
                        break;
 
                case '-':
@@ -610,10 +638,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, POP3_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if (++i < iArgCount &&
                            MscGetServerAddress(pszArgs[i],
-                                               
ThCfgPOP3.SvrAddr[ThCfgPOP3.iNumAddr]) == 0)
+                               ThCfgPOP3.SvrAddr[ThCfgPOP3.iNumAddr], iPort) 
== 0) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgPOP3.SvrAddr[ThCfgPOP3.iNumAddr]);
                                ++ThCfgPOP3.iNumAddr;
+                       }
                        break;
 
                case 'X':
@@ -735,10 +773,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, POP3S_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if (++i < iArgCount &&
                            MscGetServerAddress(pszArgs[i],
-                                               
ThCfgPOP3S.SvrAddr[ThCfgPOP3S.iNumAddr]) == 0)
+                               ThCfgPOP3S.SvrAddr[ThCfgPOP3S.iNumAddr], iPort) 
== 0) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgPOP3S.SvrAddr[ThCfgPOP3S.iNumAddr]);
                                ++ThCfgPOP3S.iNumAddr;
+                       }
                        break;
 
                case '-':
@@ -821,10 +869,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, SMTP_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if ((++i < iArgCount) &&
                            (MscGetServerAddress(pszArgs[i],
-                                                
ThCfgSMTP.SvrAddr[ThCfgSMTP.iNumAddr]) == 0))
+                               ThCfgSMTP.SvrAddr[ThCfgSMTP.iNumAddr], iPort) 
== 0)) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgSMTP.SvrAddr[ThCfgSMTP.iNumAddr]);
                                ++ThCfgSMTP.iNumAddr;
+                       }
                        break;
 
                case 'X':
@@ -954,10 +1012,20 @@
                        break;
 
                case 'I':
+                       /* [i_a] add sanity check: do not accept more '-X 
ip:port' options than we have space in the SvrAddr[] array */
+                       if (MAX_ACCEPT_ADDRESSES <= ThCfgCTRL.iNumAddr)
+                       {
+                               
ErrSetErrorCode(ERR_I_ARG_TOO_MANY_IP_PORT_COMBOS, SMTPS_SERVER_NAME);
+                               return ErrGetErrorCode();
+                       }
+
                        if ((++i < iArgCount) &&
                            (MscGetServerAddress(pszArgs[i],
-                                                
ThCfgSMTPS.SvrAddr[ThCfgSMTPS.iNumAddr]) == 0))
+                               ThCfgSMTPS.SvrAddr[ThCfgSMTPS.iNumAddr], iPort) 
== 0)) {
+                               /* [i_a] make sure we update the port number 
too if the optional ip[:port] part was specified/decoded in there. */
+                               iPort = 
SysGetAddrPort(ThCfgSMTPS.SvrAddr[ThCfgSMTPS.iNumAddr]);
                                ++ThCfgSMTPS.iNumAddr;
+                       }
                        break;
 
                case '-':


-
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