I have decided to redesign delivery routines of vpopmail a bit. Here is my first attempt. Steps to test it: 1. Copy vlocal.c and vlocal.h (attached) into vpopmail src dir. 2. add vlocal into Makefile. 3. Set #define QMAILLOCALVPOPMAIL in vlocal.c 3. compile vlocal 4. Rename qmail-local to qmail-local-vpopmail. 5. Rename vlocal to qmail-local. What it does: This code change homedir for delivery for vpopmail users, so it is possible to put .qmail files directly into user directories. It should not touch real (system) users (I think). What is does not: Quota support, but it shouldn't be difficult to add it there if descriptor 0 is file with something like fseek(0, 0, SEEK_END); filesize = ftell(0); fseek(0, 0, SEEK_SET); Could you take a lot at my code and send me a comments? Thanx. P.S.: This code is quite simple and I think it is possible to integrate it directly into qmail-local to reduce system overhead (execl could be wiped). -- Ondřej Surý <[EMAIL PROTECTED]> Globe Internet s.r.o.http://globe.cz/ Tel: +420235365000 Fax: +420235365009 Pláničkova 1, 162 00 Praha 6 Mob: +420602667702 ICQ: 24944126 Mapa: http://globe.namape.cz/ NAJDI.TO http://najdi.to/ Chief Administrator and Developer. GPG fingerprint: CC91 8F02 8CDE 911A 933F AE52 F4E6 6A7C C20D F273
/***************************************************************************** ** ** Ondrej Sury <ondrej at sury.cz>, Copyright (C) Oct 2000 ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** *****************************************************************************/ #include <errno.h> #include <fcntl.h> #include <pwd.h> #include <signal.h> #include <stdarg.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <dirent.h> #include <unistd.h> #include <ctype.h> #include <sys/stat.h> #include <sys/types.h> #include "config.h" #include "vlocal.h" #include "safestring.h" #include "vpopmail.h" #include "vauth.h" void usage() { fprintf(stderr, "vmail-local: usage: qmail-local [ -nN ] user homedir local dash ext domain sender aliasempty"); exit(100); } char *flagdoit; char *user; char *homedir; char *local; char *dash; char *ext; char *host; char *sender; char *aliasempty; #define QMAILLOCALVPOPMAIL "/usr/sbin/qmail-local-vpopmail" #define MAX_BUFF 512 char vuser[MAX_BUFF]; char vhost[MAX_BUFF]; int main(int argc, char *argv[]) { static struct passwd *pw; char *tmpstr; argv++; if (!(flagdoit = *argv++)) usage(); if (!(user = *argv++)) usage(); if (!(homedir = *argv++)) usage(); if (!(local = *argv++)) usage(); if (!(dash = *argv++)) usage(); if (!(ext = *argv++)) usage(); if (!(host = *argv++)) usage(); if (!(sender = *argv++)) usage(); if (!(aliasempty = *argv++)) usage(); if (*argv) usage(); scopy(vuser, ext, MAX_BUFF); scopy(vhost, host, MAX_BUFF); vget_real_domain(vhost,MAX_BUFF); pw = vauth_getpw(vuser, vhost); while (!pw && (tmpstr = strrchr(vuser, '-'))) { *tmpstr = 0; pw = vauth_getpw(vuser, vhost); } if (pw && (pw->pw_gid & BOUNCE_MAIL)) { fprintf(stderr, "Account locked and mail bounced %s (#5.1.2)\n", vuser); exit(100); } if (pw) { user = pw->pw_name; local = ext; ext += strlen(pw->pw_name); if (*ext == '-') ++ext; if (!strlen(ext)) dash++; homedir = pw->pw_dir; } // fprintf(stderr, "execl qmail-local-vpopmail \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", flagdoit, user, homedir, local, dash, ext, host, sender, aliasempty); if (execl(QMAILLOCALVPOPMAIL, flagdoit, user, homedir, local, dash, ext, host, sender, aliasempty, NULL) == -1) { perror("running /usr/sbin/qmail-local-vpopmail failed"); exit(111); } exit(0); }
/* * vdelivermail.h * part of the vchkpw package * * Copyright (C) 1999 Inter7 Internet Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ int failperm(char *,...); void usage();