Hi, I am using qmail-1.03, vpopmail-5.2.1 w/mysql, and maildrop-1.6.2 w/mysql
I was having very hard time getting maildrop and vpopmail to read the virtual users from the same table (vpopmail mysql layout). I also realized maildrop was very picky about all the fields that they all have to be set or else things wouldn't work. And since vadduser doesn't add the uid/gid of the mail owner (virtual or unique uid), I made a patch that'll do that. It also replaces vdelivermail in .qmail-default with maildrop, and should automatically create the right table layout if you are installing cleanly. If you are upgrading an existing vpopmail installation that uses mysql, you can simply add the following additional fields to your vpopmail table (if you are using the default many-domains option): `pw_email` varchar(128) NOT NULL default '', `pw_maildir` varchar(180) NOT NULL default 'Maildir', `real_uid` int(16) NOT NULL default '500', `real_gid` int(16) NOT NULL default '500', `pw_status` int(8) NOT NULL default '1', substitute uid/gid default of 500 for your vpopmail/vchkpw uid/gid. and for existing domains, change their .qmail-default to: | /usr/local/bin/maildrop -d [EMAIL PROTECTED] Change your path if it's not /usr/local (and also in a couple places in the patch) Apply the patch: patch -p0 < ../vpopmail-5.2.1-maildropmysql.patch maildrop configure options: ./configure --with-etcdir=/usr/local/etc \ --enable-maildrop-uid=root \ --enable-maildrop-gid=wheel \ --without-db \ --enable-maildropmysql \ --with-mysqlconfig=/usr/local/etc/maildropmysql.conf \ --enable-maildirquota You also need to: chown root:wheel /usr/local/bin/maildrop chmod +s /usr/local/bin/maildrop if you want to be able to have a combination of a virtual uid system, and a unique uid system. This is very useful if you would like to run certain domains under a unique uid for OS enforced quotas. maildropmysql.conf hostname mysql.host.tld port 3306 database vpopmail dbuser vpopmail dbpw secretpass dbtable vpopmail default_uidnumber 500 default_gidnumber 500 uid_field pw_email uidnumber_field real_uid gidnumber_field real_gid maildir_field pw_maildir homedirectory_field pw_dir quota_field pw_shell mailstatus_field pw_status where_clause "" The only cavaet I couldn't get around for now is that the uid that maps to /etc/passwd must have a valid shell, or else maildrop complains.. Can you have a global maildroprc with SHELL="/bin/sh so that I could disable shell access for those uids? Ideas/Suggestions? Respectfully, Tim Hasson diff -u vpopmail-5.2.1.orig/vadddomain.c vpopmail-5.2.1/vadddomain.c --- vpopmail-5.2.1.orig/vadddomain.c Sat Jan 19 23:07:57 2002 +++ vpopmail-5.2.1/vadddomain.c Sun Oct 5 01:59:35 2003 @@ -86,8 +86,7 @@ vget_assign(Domain, a_dir, 156, &a_uid, &a_gid ); snprintf(TmpBuf1, MAX_BUFF, "%s/.qmail-default", a_dir); if ( (fs = fopen(TmpBuf1, "w+"))!=NULL) { - fprintf(fs, "| %s/bin/vdelivermail '' %s\n", VPOPMAILDIR, - BounceEmail); + fprintf(fs, "| /usr/local/bin/maildrop -d [EMAIL PROTECTED]"); fclose(fs); chown(TmpBuf1, a_uid, a_gid); } else { diff -u vpopmail-5.2.1.orig/vmysql.c vpopmail-5.2.1/vmysql.c --- vpopmail-5.2.1.orig/vmysql.c Fri Feb 1 17:43:24 2002 +++ vpopmail-5.2.1/vmysql.c Sun Oct 5 01:41:09 2003 @@ -80,6 +80,9 @@ char EGecos[SMALL_BUFF]; char EClearPass[SMALL_BUFF]; +uid_t real_uid; +gid_t real_gid; + void vcreate_dir_control(char *domain); void vcreate_vlog_table(); void vmysql_escape( char *instr, char *outstr ); @@ -288,6 +291,9 @@ } } + /* get the real_uid and real_gid to add them in mysql for maildrop deliveries */ + vget_assign(domain, dom_dir, 156, &real_uid, &real_gid ); + if ( pass[0] != 0 ) { mkpasswd3(pass,Crypted, 100); } else { @@ -308,6 +314,7 @@ #ifdef CLEAR_PASS ,EClearPass #endif +, (long unsigned)real_uid, (long unsigned)real_gid ); if (mysql_query(&mysql_update,SqlBufUpdate)) { diff -u vpopmail-5.2.1.orig/vmysql.h vpopmail-5.2.1/vmysql.h --- vpopmail-5.2.1.orig/vmysql.h Fri Feb 1 18:06:13 2002 +++ vpopmail-5.2.1/vmysql.h Sun Oct 5 02:13:00 2003 @@ -48,6 +48,11 @@ pw_dir char(160), \ pw_shell char(20), \ pw_clear_passwd char(16), \ +pw_email varchar(128) NOT NULL, \ +pw_maildir varchar(180) NOT NULL default \"Maildir\", \ +real_uid int(16) NOT NULL default \"500\", \ +real_gid int(16) NOT NULL default \"500\", \ +pw_status int(8) NOT NULL default \"1\", \ primary key (pw_name, pw_domain ) " #else #define TABLE_LAYOUT "pw_name char(32) not null, \ @@ -57,6 +62,11 @@ pw_gecos char(48), \ pw_dir char(160), pw_shell char(20), \ +pw_email varchar(128) NOT NULL, \ +pw_maildir varchar(180) NOT NULL default \"Maildir\", \ +real_uid int(16) NOT NULL default \"500\", \ +real_gid int(16) NOT NULL default \"500\", \ +pw_status int(8) NOT NULL default \"1\", \ primary key (pw_name, pw_domain ) " #endif #else @@ -107,13 +117,15 @@ #ifdef CLEAR_PASS #define INSERT "insert into %s \ ( pw_name, pw_domain, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell \ -, pw_clear_passwd ) values ( \"%s\", \"%s\", \ -\"%s\", %d, 0, \"%s\", \"%s\", \"%s\" ,\"%s\" )" +, pw_clear_passwd, pw_email, pw_maildir, real_uid, real_gid, pw_status ) values ( \"%s\", \"%s\", \ +\"%s\", %d, 0, \"%s\", \"%s\", \"%s\" ,\"%s\", CONCAT( pw_name, \"@\", pw_domain ), \ +\"Maildir\", \"%lu\", \"%lu\", 1 )" #else #define INSERT "insert into %s \ ( pw_name, pw_domain, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell \ -) values ( \"%s\", \"%s\", \ -\"%s\", %d, 0, \"%s\", \"%s\", \"%s\" )" +, pw_email, pw_maildir, real_uid, real_gid, pw_status ) values ( \"%s\", \"% s\", \ +\"%s\", %d, 0, \"%s\", \"%s\", \"%s\", CONCAT( pw_name, \"@\", pw_domain ), \ +\"Maildir\", \"%lu\", \"%lu\", 1 )" #endif #else #ifdef CLEAR_PASS diff -u vpopmail-5.2.1.orig/vpopmail.c vpopmail-5.2.1/vpopmail.c --- vpopmail-5.2.1.orig/vpopmail.c Fri May 17 23:25:49 2002 +++ vpopmail-5.2.1/vpopmail.c Sun Oct 5 02:00:17 2003 @@ -184,8 +184,7 @@ chdir(TmpBuf1); return(VA_COULD_NOT_OPEN_QMAIL_DEFAULT); } else { - fprintf(fs, "| %s/bin/vdelivermail '' bounce-no-mailbox\n", - VPOPMAILDIR); + fprintf(fs, "| /usr/local/bin/maildrop -d [EMAIL PROTECTED]"); fclose(fs); } snprintf(TmpBuf, MAX_BUFF, "%s/%s/%s", dir, DOMAINS_DIR, DomainSubDir);
vpopmail-5.2.1-maildropmysql.patch
Description: Binary data