autorespond

March 12, 2025 by Roberto Puzzanghera 28 comments

autorespond is used for vacation messages. It's required by qmailadmin.

Changelog

  • Mar 12, 2025
    - bug fix in memory allocation which caused a segfault when To: address has be used (tx Stephan for the hint)

Installation

The 2.0.9 version that we are going to install will solve a compilation break on Gentoo and several warnings. It also fixes the Message-ID to comply with RFC. autorespond will be installed in /usr/local

AR_VERSION=2.0.9
wget https://github.com/sagredo-dev/autorespond/archive/refs/tags/v${AR_VERSION}.tar.gz
tar xzf v${AR_VERSION}.tar.gz
cd autorespond-${AR_VERSION}
chown -R root:root .
make
make install

Our users will be able to easily set up out of office messages through their webmail with the "Out of office" Roundcube plugin that we'll configure later.

Comments

autorespond segfault

I'm using latest autorespond version 2.0.8 although this problem was also in 2.0.5.  autorespond segfults  randomly while replying. My suspection is that this has something to do with attachments. I would like to set  0 value for attachments but I don't know where to add these parameters for autorespond. I would just need that autorespond sends just my "Thank you for the order" message and ignores quotes & attachments from customer's email. 

[Tue Mar 11 13:00:26 2025] autorespond[1028]: segfault at 561741091691 ip 00007f062eced9c2 sp 00007ffce169e708 error 4 in libc.so.6[7f062eb70000+188000]
[Tue Mar 11 13:00:26 2025] Code: 48 83 e1 3f 48 83 e0 3f 66 0f 6f 25 18 00 03 00 66 0f 6f 2d 20 00 03 00 66 0f 6f 35 28 00 03 00 83 f9 30 77 63 83 f8 30 77 5e 0f 6f 0f f3 0f 6f 16 66 0f 6f fc 66 44 0f 6f c4 66 0f fc f9 66
[Tue Mar 11 13:01:50 2025] autorespond[1092]: segfault at 5636a73154f0 ip 00007fcc12985a47 sp 00007fffb3581e08 error 4 in libc.so.6[7fcc12808000+188000]
[Tue Mar 11 13:01:50 2025] Code: c7 10 90 48 83 e6 f0 48 83 e7 f0 ba ff ff 00 00 45 31 c0 83 e1 0f 83 e0 0f 66 0f ef c0 39 c1 74 32 77 07 41 89 d0 91 48 87 f7 <66> 0f 6f 17 66 0f 6f 0e 4c 8d 48 0f 49 29 c9 4c 8d 15 23 0b 03 00
[Tue Mar 11 13:03:31 2025] autorespond[1126]: segfault at 56550b46e020 ip 00007fc14ac859c2 sp 00007fff56df9548 error 4 in libc.so.6[7fc14ab08000+188000]
[Tue Mar 11 13:03:31 2025] Code: 48 83 e1 3f 48 83 e0 3f 66 0f 6f 25 18 00 03 00 66 0f 6f 2d 20 00 03 00 66 0f 6f 35 28 00 03 00 83 f9 30 77 63 83 f8 30 77 5e 0f 6f 0f f3 0f 6f 16 66 0f 6f fc 66 44 0f 6f c4 66 0f fc f9 66
[Tue Mar 11 13:06:32 2025] autorespond[1345]: segfault at 55a8db9da070 ip 00007f519a9bda4b sp 00007ffeeae7b608 error 4 in libc.so.6[7f519a840000+188000]
[Tue Mar 11 13:06:32 2025] Code: 83 e6 f0 48 83 e7 f0 ba ff ff 00 00 45 31 c0 83 e1 0f 83 e0 0f 66 0f ef c0 39 c1 74 32 77 07 41 89 d0 91 48 87 f7 66 0f 6f 17 <66> 0f 6f 0e 4c 8d 48 0f 49 29 c9 4c 8d 15 23 0b 03 00 4f 63 0c 8a
[Tue Mar 11 13:06:51 2025] autorespond[1403]: segfault at 555fbf494a5e ip 00007fb9ecd659c2 sp 00007fff32fbe148 error 4 in libc.so.6[7fb9ecbe8000+188000]
[Tue Mar 11 13:06:51 2025] Code: 48 83 e1 3f 48 83 e0 3f 66 0f 6f 25 18 00 03 00 66 0f 6f 2d 20 00 03 00 66 0f 6f 35 28 00 03 00 83 f9 30 77 63 83 f8 30 77 5e 0f 6f 0f f3 0f 6f 16 66 0f 6f fc 66 44 0f 6f c4 66 0f fc f9 66
[Tue Mar 11 13:06:56 2025] autorespond[1414]: segfault at 55e0b93ef228 ip 00007f96cab3d9c2 sp 00007ffd4e9ef9c8 error 4 in libc.so.6[7f96ca9c0000+188000]
[Tue Mar 11 13:06:56 2025] Code: 48 83 e1 3f 48 83 e0 3f 66 0f 6f 25 18 00 03 00 66 0f 6f 2d 20 00 03 00 66 0f 6f 35 28 00 03 00 83 f9 30 77 63 83 f8 30 77 5e 0f 6f 0f f3 0f 6f 16 66 0f 6f fc 66 44 0f 6f c4 66 0f fc f9 66

Reply |

autorespond segfault

As Stephan has pointed out below, the segfault is caused by the memory allocation at line 604 and has nothing to do with attachments. I'm using a simple sprintf to do the concatenation and the segfault seems to be solved here. Can you guys test from my dev branch please?

git clone -b dev https://github.com/sagredo-dev/autorespond.git

In addition, one thing that I dislike is that the autoresponder attaches the headers in the body:

From: sender@domain.tld
Subject: Autoresponder test
Content-type: text/plain
Content-transfer-encoding: 7bit
MIME-Version: 1.0

message body

In my opinion it would be better to strip the headers from the body, at least the last three lines leaving only the From: and the Subject: fields. What do you think?

Reply |

autorespond segfault

The official README file here https://github.com/sagredo-dev/autorespond/blob/main/README.md says to add the 0 at the end of the command

|autorespond 10000 10 help_message help_autorespond 0 +

Anyway, do you know how to reproduce the segfault?

Reply |

autorespond segfault

Hello! 

My apologies, didn't find that from readme file.  As I suspected this is related to attachment. If mail has attachment, autorespond segfaults, if sending just plain mail without attachment then autorespond works

without problems.  I was thinking if this could be any kind of OOM problem but error would be different, I tried

/bin/echo Y >/sys/module/kernel/parameters/ignore_rlimit_data

to lift all limits for testing but this didn't help. 

I added into database to valias table following line  |/usr/local/bin/autorespond 10000 10 mymessage myhelper 0 

and now it works perfectly.

I think this is anyways something  memory related. I sent test mail with 1.2M attachment and just 22k attachment and both made autorespond to SV. But having 0 (append nothing) everything works. 

Reply |

autorespond SEGV when DEFAULT_FROM = "$" in autorespond.c!

I tried autorespond 2.0.2 and 2.0.7 on 64bit Debian 12.

Line 603: rpath = safe_malloc( strlen(TheUser) + strlen(TheDomain) + 2);

leads to a SEGFAULT.

Only fix was changing DEFAULT_FROM to a valid eMail.

Is there a better solution?

Reply |

autorespond SEGV when DEFAULT_FROM =

I don't get the segfault here leaving #define DEFAULT_FROM "$"

How are you using autorespond from command line? Can you show how to reproduce the segfault?

Reply |

autorespond SEGV when DEFAULT_FROM =

sorry for the late reply. I compiled & installed everything on a fresh debian as per your instructions.

Later i noticed the Segfaults in the syslog. No further steps to reproduce, just use it as intended.

autoresponders where set by qmailadmin.

Reply |

autorespond SEGV when DEFAULT_FROM =

Fixed in version 2.0.9

Reply |

Autorespond fails to compile

Hi everyone, I get the following compile error on a recent gentoo installation. Anyone has a patch for this?

I found a bug report but no solution yet.

Thanks

Florian

make -j6 'CFLAGS=-march=ivybridge -O2 -pipe'  
gcc -O2 -march=ivybridge -O2 -pipe  autorespond.c -o autorespond
autorespond.c:379:7: error: conflicting types for ‘strcasestr’; have ‘char *(char *, char *)’
 379 | char *strcasestr( char *_s1, char *_s2 )
     |       ^~~~~~~~~~
In file included from autorespond.c:72:
/usr/include/string.h:380:14: note: previous declaration of ‘strcasestr’ with type ‘char *(const char *, const char *)’
 380 | extern char *strcasestr (const char *__haystack, const char *__needle)
     |              ^~~~~~~~~~
make: *** [Makefile:11: autorespond] Error 1

Reply |

Autorespond fails to compile

Thanks Roberto, program compiles now. (with some warnings, which I will ignore for now)

autorespond.c: In function ‘strcasestr’: 
autorespond.c:399:28: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 399 |                 return _s1 + (ptr - s1);
     |                        ~~~~^~~~~~~~~~~~
autorespond.c: In function ‘main’:
autorespond.c:600:17: warning: ‘__builtin_strncat’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
 600 |                 strncat( rpath, TheDomain, strlen(TheDomain) );
     |                 ^
autorespond.c:600:17: note: length computed here
 600 |                 strncat( rpath, TheDomain, strlen(TheDomain) );
    |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply |

Any Vacation module to replace Autorepsond

Hi Mr Roberto,

so far the autorespond no longer working in vpopmail, any solution for replacement which users can create themselves in Roundcube webmail?

thank you

Reply |

Any Vacation module to replace Autorepsond

Actually you can do it by means of a sieve rule (RC managesieve plugin). Remember to configure dovecot-lda as your delivery agent, otherwise it won't work.

Reply |

I set up an autoresponse for an email account. .qmail is created, so are the folder vacation and message. But it just would not autoreply. I am not seeing any logs related. Is it because of sieve

Reply |

you have to set vdelivermail as your delivery agent

Reply |

I amended

cat /var/qmail/control/defaultdelivery
| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox

and

cat /home/vpopmail/domains/mydomain.com/.qmail-default
|/var/qmail/bin/preline -f /usr/local/dovecot/libexec/dovecot/deliver -d $EXT@$USER

It is working now. So whenever i create a new domain, i have to include |/var/qmail/bin/preline -f /usr/local/dovecot/libexec/dovecot/deliver -d $EXT@$USER in the .qmail-default file?

Reply |

Yes

Yes

Reply |

So if i adjust .qmail-default with vdelivermail, will sieve still work?

Reply |

No

No

Reply |

No

So there is no way to have sieve and autoresponder to work together?

Reply |

No

https://plugins.roundcube.net/packages/gabtoth/vacation take a look to this RC plugin which can work as an autoresponder writing a sieve rule for you

Reply |

No

This plugin does not work. But the roundcube managesieve plugin works perfectly. With the latest version of roundcube 1.4.1, auto reply and email forwarding works side by side.

Thanks Roberto for the heads up with roundcube plugin

Reply |

No

No. And I think that this shouldn't be  considered a problem. Why let users use qmailadmin if they already have what they need with sieve via webmail?

Reply |

No

Hello Roberto,

I set up qmailadmin with the latest patch, everything working but:

- in the adminitration panel I can see "Messaggi inviati ad indirizzi non esistenti : raccolti dalla casella pred. user@$USER"

- if I set-up the catch-all account, qmail rewrites the .qmail-default file of the domain as | /home/vpopmail/bin/vdelivermail '' catchall@domain.com

So I have to manually re-edit the .qmail-default file.

Is there a way to tell qmail to use the vdeliver standard .qmail-file (/var/qmail/bin/preline -f /usr/local/dovecot/libexec/dovecot/deliver -d $EXT@$USER) ?

Thank you as always for your great support !

Reply |

No

Unfortunately there is no way to customize the line written by qmailadmin in the .qmail-default file (/var/qmail/bin/preline -f /usr/local/dovecot/libexec/dovecot/deliver -d $EXT@$USER), but patching would be needed. Anyway you can't have both .qmail files logic and dovecot-lda + sieve.

One have to choose between dovecot-lda/sieve and vdelivermail/.qmail files. In the first case users' .qmail files are ignored and setting the catchall and autoresponder is useless, in the second case you can't have sieve rules working

Reply |

No

Thank you very much Roberto, good to know !

(GRAZIE come sempre per il tuo prezioso supporto !)

Reply |

inter7 change site, i dont find autorespond

Hi Roberto.

Inter7 change all site, and i dont find autorespond.. see:

 wget -c  http://www.inter7.com/devel/autorespond-2.0.5.tar.gz
--2015-04-12 12:40:54--  http://www.inter7.com/devel/autorespond-2.0.5.tar.gz
Resolving www.inter7.com (www.inter7.com)... 184.154.94.18
Connecting to www.inter7.com (www.inter7.com)|184.154.94.18|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2015-04-12 12:40:55 ERROR 404: Not Found.

Reply |

Thanks for the advise. I have

Thanks for the advise. I have linked my local copy

Reply |

Add a comment