Bug 136176 - mail/qmail: Outgoing IP + QMTPC - segfault
mail/qmail: Outgoing IP + QMTPC - segfault
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Renato Botelho
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-30 03:40 UTC by bryan
Modified: 2009-07-01 18:30 UTC (History)
0 users

See Also:


Attachments
qmail-1.03-qmtpc_outgoingip.patch.patch.txt (555 bytes, text/plain)
2009-06-30 13:22 UTC, bryan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description bryan 2009-06-30 03:40:02 UTC
The combined patch for OUTGOING_IP and QMTPC (qmail-1.03-qmtpc_outgoingip.patch) fails to pass the 'outip' parameter to timeoutconn() which results in a segfault.

Fix: 

The current combined patch has this block:
+
+    if (qmtp_priority(ip.ix[i].pref)) {
+      if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int) qmtp_port,timeoutconnect) == 0) {
+      tcpto_err(&ip.ix[i].ip,0);
+      partner = ip.ix[i].ip;
+      qmtp(); /* does not return */
+      }
+      close(smtpfd);
+      smtpfd = socket(AF_INET,SOCK_STREAM,0);
+      if (smtpfd == -1) temp_oserr();
+    }

-    if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int) port,timeoutconnect) == 0) {
+    if (timeoutconn(smtpfd,&ip.ix[i].ip,&outip,(unsigned int) smtp_port,timeoutconnect) == 0) {
------------------------

The first timeoutconn should be fixed to:
if (timeoutconn(smtpfd,&ip.ix[i].ip,&outip, (unsigned int) qmtp_port,timeoutconnect) == 0)

Note the &outip being passed in, same as the smtp timeoutconn() call.

No patch attached. Let me know if you would like one.
How-To-Repeat: Enable OUTGOING_IP and QMTPC. Send an email to a server with QMTP support enabled. 12801 in its MX. Tracing with gdb shows that the crash is in timeoutconn() as the 'outip' param is 0xd1 (209).
Comment 1 Edwin Groothuis freebsd_committer 2009-06-30 03:40:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->garga

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Renato Botelho freebsd_committer 2009-06-30 11:58:29 UTC
What you are saying is exactly the patch does, it replaces the line:

if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int) port,timeoutconnect) == 0) {

for:

if (timeoutconn(smtpfd,&ip.ix[i].ip,&outip,(unsigned int) smtp_port,timeoutconnect) == 0) {

Maybe I missed something on your explanation, please, send a patch and i'll
take a look.

Thanks
-- 
Renato Botelho <garga @ FreeBSD.org>
               <garga @ freebsdbrasil.com.br>
GnuPG Key: http://www.FreeBSD.org/~garga/pubkey.asc

But these pills can't be habit forming;
I've been taking them for years.
Comment 3 bryan 2009-06-30 13:22:30 UTC
Renato,

I am referring to the combined patch called 
qmail-1.03-qmtpc_outgoingip.patch.

The one that is used when selecting both QMTPC and OUTGOINGIP as opposed 
to 2 different patches.

Yes, the timeoutconn for the smtp port is proper. The line for the qmtp 
port is not.

See attached patch against qmail-1.03-qmtpc_outgoingip.patch.

Thanks,
Bryan
Comment 4 Renato Botelho freebsd_committer 2009-07-01 18:27:56 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 5 dfilter freebsd_committer 2009-07-01 18:27:59 UTC
garga       2009-07-01 17:27:44 UTC

  FreeBSD ports repository

  Modified files:
    mail/qmail           Makefile distinfo 
  Log:
  Fix qmtpc + outgoingip patch to prevent a segfault when both are applied
  
  PR:             ports/136176
  Submitted by:   Bryan Drewery <bryan@shatow.net>
  
  Revision  Changes    Path
  1.143     +1 -1      ports/mail/qmail/Makefile
  1.74      +3 -3      ports/mail/qmail/distinfo
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"