Re: [qmailtoaster] autorespond-2.0.4 bugs

2008-02-14 Thread Mike Hamrick


On Jan 18, 2008, at 12:09 AM, Timon Reinhard wrote:

Mike Hamrick wrote:
I've cleaned up some of the syslog logging in my version, and have  
also packaged up a source RPM for it if anyone is interested.
http://www.muppetlabs.com/~mikeh/autorespond- 
toaster-2.0.4-1.3.5.src.rpm


Hmm, it segfaults for me on OpenSuSE 10.3. Here's the trace from  
the logs, just in case:


@4000478f8d601afd0ccc delivery 10528: success:  
***_glibc_detected_***_/usr/bin/autorespond:_malloc 
():_memory_corruption:_0x0804f1f8_***/


Sorry for the late response on this.  I really should read this list  
more often.  I found this same error in my logs and when I did a  
google search for _malloc():_memory_corruption I found your post,  
which I thought was pretty funny.


I used valgrind on the autoresponder, which alerted me to:

==14721== Conditional jump or move depends on uninitialised value(s)
==14721==at 0x4005DA0: strncat (mac_replace_strmem.c:215)
==14721==by 0x8049BEB: main (autorespond.c:514)

The code looks like:

rpath = safe_malloc( strlen(TheUser) + strlen(TheDomain) + 2);
strncpy( rpath, TheUser, strlen(TheUser) );
strncat( rpath, @, 1 );
strncat( rpath, TheDomain, strlen(TheDomain) );

The first strncpy doesn't copy the null byte to rpath, so the  
following strncat will be scanning through uninitialized soup looking  
for the end of the string.  If you're unlucky, there won't be any  
null bytes in the soup you allocated, and you'll end up writing to  
memory you don't own.


I changed that code block to:

int size = strlen(TheUser) + strlen(TheDomain) + 2;
rpath = safe_malloc( size );
snprintf (rpath, size, [EMAIL PROTECTED], TheUser, TheDomain);

That fixed the segfaults for me.  No offense to Eric Huss, but the  
autoresponder code isn't... um.. good.  I'm surprised it's used as  
widely as it is.  Valgrind found a number of other memory leakage  
issues, but considering it's not a long running program, that's not a  
big deal.


Mike


-
QmailToaster hosted by: VR Hosted http://www.vr.org
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [qmailtoaster] autorespond-2.0.4 bugs

2008-01-18 Thread Timon Reinhard

Hi!

Mike Hamrick wrote:
I've cleaned up some of the syslog logging in my version, and have also 
packaged up a source RPM for it if anyone is interested.


http://www.muppetlabs.com/~mikeh/autorespond-toaster-2.0.4-1.3.5.src.rpm


Hmm, it segfaults for me on OpenSuSE 10.3. Here's the trace from the 
logs, just in case:


@4000478f8d601afd0ccc delivery 10528: success: 
***_glibc_detected_***_/usr/bin/autorespond:_malloc():_memory_corruption:_0x0804f1f8_***/===_Backtrace:_=//lib/libc.so.6[0xb7e674b6]//lib/libc.so.6[0xb7e69701]//lib/libc.so.6(__libc_malloc+0x97)[0xb7e6ad07]//usr/bin/autorespond[0x80492c1]//usr/bin/autorespond[0x804944f]//usr/bin/autorespond[0x8049a92]//lib/libc.so.6(__libc_start_main+0xe0)[0xb7e16fe0]//usr/bin/autorespond[0x8048ee1]/===_Memory_map:_/08048000-0804b000_r-xp__09:01_2429624/usr/bin/autorespond/0804b000-0804c000_r--p_2000_09:01_2429624/usr/bin/autorespond/0804c000-0804d000_rw-p_3000_09:01_2429624/usr/bin/autorespond/0804d000-0806e000_rw-p_0804d000_00:00_0__[heap]/b7c0-b7c21000_rw-p_b7c0_00:00_0_/b7c21000-b7d0_---p_b7c21000_00:00_0_/b7dee000-b7df8000_r-xp__09:01_475280_/lib/libgcc_s.so.1/b7df8000-b7dfa000_rw-p_9000_09:01_475280_/lib/libgcc_s.so.1/b7e0-b7e01000_rw-p_b7e0_00:00_0_/b7e01000-b7f2e000_r-xp__09:01_

475262_/lib/libc-2.6.1.so/b7f2e000-b7f2f000_r--p_0012c000_09:01_475262_/lib/libc-2.6.1.so/b7f2f000-b7f31000_rw-p_0012d000_09:01_475262_/lib/libc-2.6.1.so/b7f31000-b7f35000_rw-p_b7f31000_00:00_0_/b7f3a000-b7f3b000_rw-p_b7f3a000_00:00_0_/b7f3b000-b7f55000_r-xp__09:01_477890_/lib/ld-2.6.1.so/b7f55000-b7f57000_rw-p_0001a000_09:01_477890_/lib/ld-2.6.1.so/bfbb-bfbc6000_rw-p_bfbb_00:00_0__[stack]/e000-f000_r-xp__00:00_0__[vdso]/did_0+0+1/


Cheers,
Timon

-
QmailToaster hosted by: VR Hosted http://www.vr.org
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [qmailtoaster] autorespond-2.0.4 bugs

2007-12-31 Thread Timon Reinhard

Hi Mike,

Tis the season for out-of-office autorespond messages.  I've recently 
learned about a number of problems with the qmail-toaster autorespond 
system.  I thought I'd share.


Thanks for sharing! I hope one will put that into the toaster packages, 
the broken autoresponder really sucks. ;)


Cheers.
Timon

-
QmailToaster hosted by: VR Hosted http://www.vr.org
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [qmailtoaster] autorespond-2.0.4 bugs

2007-12-31 Thread Mike Hamrick


On Dec 31, 2007, at 2:51 AM, Timon Reinhard wrote:
 Thanks for sharing! I hope one will put that into the toaster  
packages, the broken autoresponder really sucks. ;)


Glad to be of some assistance!  The qmail-toaster folks can fix  
things on their end by upgrading to the Inter7 2.0.5 version (which  
fixes most of the non-zero exit code problems), and changing the  
qmailadmin user.c not to write the Subject and From lines to the  
message file.


I've cleaned up some of the syslog logging in my version, and have  
also packaged up a source RPM for it if anyone is interested.


http://www.muppetlabs.com/~mikeh/autorespond-toaster-2.0.4-1.3.5.src.rpm

Mike


-
QmailToaster hosted by: VR Hosted http://www.vr.org
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[qmailtoaster] autorespond-2.0.4 bugs

2007-12-29 Thread Mike Hamrick


Hello,

Tis the season for out-of-office autorespond messages.  I've recently  
learned about a number of problems with the qmail-toaster autorespond  
system.  I thought I'd share.


1.  When qmailadmin (user.c) writes the message file, it writes the  
'From:' and 'Subject:' header lines to the top of the file.  The  
autorespond program doesn't honor these, it writes its own headers,  
which causes the headers to appear in the message body.


2.  There are a number of conditions in autorespond.c where the  
program returns a non-zero exit code.  This causes qmail-send to  
generate a bounce.  You see this on email with mailing-list headers  
or precedence bulk.  These have mostly been fixed in autorespond-2.0.5.


I spent a few hours hacking on the autorespond.c program to address  
these problems and add a few more features that my users wanted.   
Here's some of the changes.


The autorespond program now logs everything to syslog.
It almost always exits with a return code of zero.
It skips past the 'From' and 'Subject' lines in the message file so  
they don't end up in the body.
It rewrites the Subject.  So in qmailadmin you set he Subject to:  
I'm away and the email it's responding to has a subject of Hi  
there the end Subject line looks like: [I'm away] Re: Hi There.

It doesn't respond to mail that's been marked as Spam by Spam Assassin.
It only responds to an email if your address is explicitly listed on  
the 'To' or 'Cc' line.

Random stylistic changes so I could stand to look at it.

http://www.muppetlabs.com/~mikeh/autorespond.c

Use at your own risk of course.  It might not work unless you're  
using qmailadmin-toaster-1.2.11.


Mike


-
QmailToaster hosted by: VR Hosted http://www.vr.org
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]