Bug 75846 - maildrop-1.7.0.20040907 segfaults when use=mysql and maildropmysql.cf is unreadable
Bug#: 75846 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: net-mail@gentoo.org Reported By: gentoo@joeniks.nl
Component: Applications
URL: 
Summary: maildrop-1.7.0.20040907 segfaults when use=mysql and maildropmysql.cf is unreadable
Keywords:  
Status Whiteboard: 
Opened: 2004-12-27 14:29 0000
Description:   Opened: 2004-12-27 14:29 0000
when using maildrop in delivery (-d) mode, it fails with a signal 11 if it
can't read the maildropmysql.cf file.

In a setup with both virtual and local users, only the virtual mailbox user(s)
should be able to read the configfile, the local users should not be able to
read it, as it contains mysql username/password information.

Reproducible: Always
Steps to Reproduce:
1. USE=mysql emerge maildrop
2. chgrp virtual_group /etc/maildrop/maildropmysql.cf
3. chmod 640 /etc/maildrop/maildropmysql.cf
4. (as a local user) maildrop -d $USER

Actual Results:  
maildrop: signal 0x0B

Expected Results:  
it should wait for input on stdin, and deliver the message on EOF.

this patch seems to fix it:

diff -ru maildrop-1.7.0.20040907/maildrop/main.C
maildrop-1.7.0.20040907-ivo/maildrop/main.C
--- maildrop-1.7.0.20040907/maildrop/main.C     2004-06-26 17:20:14.000000000
+0200
+++ maildrop-1.7.0.20040907-ivo/maildrop/main.C 2004-12-27 23:12:57.187589776
+0100
@@ -326,7 +326,9 @@

        // Read the config
        mysqlcfg = (mdmysqlconfig*)get_mysql_config(MAILDROPMYSQLCONFIG);
-       if ( mysqlcfg )
+       if ( !mysqlcfg )
+         return 0;
+       else
          if ( !(mysqlcfg->hostname && mysqlcfg->database && mysqlcfg->dbtable)
)
              return 0;

------- Comment #1 From Andrej Kacian (RETIRED) 2004-12-27 16:07:58 0000 -------
Thanks Ivo, your patch gets applied in -r1 ebuild, which should hit portage
mirrors in few hours, along with the patch itself.

I've also reported this upstream on courier-maildrop mailinglist, since I
couldn't find any bug tracker. Let's see how will upstream developers react.

------- Comment #2 From Ivo Bitter 2004-12-28 04:49:04 0000 -------
Thanks. I decided not to send it to the maildrop people myself, since it seems
that mysql/ldap support was removed from the 1.8 dev branch in favor of the
courier authentication library.