# HG changeset patch # User meillo@marmaro.de # Date 1279291130 -7200 # Node ID 4fd2375505259576d466d05f6d11509222bfe29a # Parent 5745edd5b7696fdfe1f7ce4384ac92d587c29829 REMOVED MAILDIR SUPPORT if you want to deliver to maildir, use an MDA like procmail masqmail can pass mail to an MDA by setting `mda' in masqmail.conf diff -r 5745edd5b769 -r 4fd237550525 INSTALL --- a/INSTALL Fri Jul 16 15:38:53 2010 +0200 +++ b/INSTALL Fri Jul 16 16:38:50 2010 +0200 @@ -70,9 +70,6 @@ --enable-auth enables ESMTP AUTH support (disabled by default) ---enable-maildir -enables qmail style Maildir support (disabled by default) - --enable-ident enables RFC 1413 support. If you have the libident dynamic library installed, this will be linked, otherwise it will be statically linked diff -r 5745edd5b769 -r 4fd237550525 acconfig.h --- a/acconfig.h Fri Jul 16 15:38:53 2010 +0200 +++ b/acconfig.h Fri Jul 16 16:38:50 2010 +0200 @@ -10,8 +10,6 @@ #undef ENABLE_AUTH -#undef ENABLE_MAILDIR - #undef USE_LIB_CRYPTO #undef ENABLE_IDENT diff -r 5745edd5b769 -r 4fd237550525 config.h.in --- a/config.h.in Fri Jul 16 15:38:53 2010 +0200 +++ b/config.h.in Fri Jul 16 16:38:50 2010 +0200 @@ -11,8 +11,6 @@ #undef ENABLE_AUTH -#undef ENABLE_MAILDIR - #undef USE_LIB_CRYPTO #undef ENABLE_IDENT @@ -44,9 +42,6 @@ /* If ident is enabled */ #undef ENABLE_IDENT -/* If Maildirs are enabled */ -#undef ENABLE_MAILDIR - /* If the resolver is to be used */ #undef ENABLE_RESOLVER diff -r 5745edd5b769 -r 4fd237550525 configure --- a/configure Fri Jul 16 15:38:53 2010 +0200 +++ b/configure Fri Jul 16 16:38:50 2010 +0200 @@ -705,7 +705,6 @@ with_group enable_debug enable_auth -enable_maildir with_libcrypto enable_ident with_liblockfile @@ -1347,7 +1346,6 @@ --disable-resolver disable resolver support --disable-debug disable debugging --enable-auth enable AUTH (RFC 2554) client support - --enable-maildir enable qmail style maildir support --enable-ident enable ident (RFC 1413) support Optional Packages: @@ -5166,19 +5164,6 @@ fi -# Check whether --enable-maildir was given. -if test "${enable_maildir+set}" = set; then : - enableval=$enable_maildir; if test "x$enable_maildir" != 'xno'; then - maildir_enabled='yes' - fi -fi - -if test "x$maildir_enabled" = xyes; then - -$as_echo "#define ENABLE_MAILDIR 1" >>confdefs.h - -fi - # Check whether --with-libcrypto was given. if test "${with_libcrypto+set}" = set; then : diff -r 5745edd5b769 -r 4fd237550525 configure.ac --- a/configure.ac Fri Jul 16 15:38:53 2010 +0200 +++ b/configure.ac Fri Jul 16 16:38:50 2010 +0200 @@ -137,17 +137,6 @@ fi AC_SUBST(BASE64_LIBS) -dnl maildir support (default is to not use it) -AC_ARG_ENABLE(maildir, - [ --enable-maildir enable qmail style maildir support], - if test "x$enable_maildir" != 'xno'; then - maildir_enabled='yes' - fi, - ) -if test "x$maildir_enabled" = xyes; then - AC_DEFINE(ENABLE_MAILDIR, 1, [If Maildirs are enabled]) -fi - dnl libcrypto AC_ARG_WITH(libcrypto, [ --with-libcrypto use libcrypto], diff -r 5745edd5b769 -r 4fd237550525 man/masqmail.conf.5 --- a/man/masqmail.conf.5 Fri Jul 16 15:38:53 2010 +0200 +++ b/man/masqmail.conf.5 Fri Jul 16 16:38:50 2010 +0200 @@ -268,10 +268,9 @@ \fBmbox_default = \fIstring\fR The default local delivery method. -Can be one of mbox, mda or maildir (the latter only if maildir support is enabled at compile time). +Can be mbox or mda. Default is mbox. -You can override this for each user by using the \fBmbox_users\fR, \fBmda_users\fR, -or \fBmaildir_users\fR options (see below). +You can override this for each user by using the \fBmbox_users\fR or \fBmda_users\fR (see below). .TP \fBmbox_users = \fIlist\fR @@ -285,13 +284,6 @@ You have to set \fBmda\fR (see below) as well. .TP -\fBmaildir_users = \fIlist\fR - -A list of users which wish delivery to a qmail style maildir. -The path to maildir is ~/Maildir/. -The maildir will be created if it does not exist. - -.TP \fBmda = \fIexpand string\fR If you want local delivery to be transferred to an mda (Mail Delivery Agent), diff -r 5745edd5b769 -r 4fd237550525 src/conf.c --- a/src/conf.c Fri Jul 16 15:38:53 2010 +0200 +++ b/src/conf.c Fri Jul 16 16:38:50 2010 +0200 @@ -497,8 +497,6 @@ conf.mbox_users = parse_list(rval, TRUE); } else if (strcmp(lval, "mda_users") == 0) { conf.mda_users = parse_list(rval, TRUE); - } else if (strcmp(lval, "maildir_users") == 0) { - conf.maildir_users = parse_list(rval, TRUE); } else if (strcmp(lval, "mda") == 0) { conf.mda = g_strdup(rval); } else if (strcmp(lval, "mda_fromline") == 0) { diff -r 5745edd5b769 -r 4fd237550525 src/deliver.c --- a/src/deliver.c Fri Jul 16 15:38:53 2010 +0200 +++ b/src/deliver.c Fri Jul 16 16:38:50 2010 +0200 @@ -127,8 +127,6 @@ mbox_type = "mbox"; else if (g_list_find_custom (conf.mda_users, user, _g_list_strcasecmp) != NULL) mbox_type = "mda"; - else if (g_list_find_custom (conf.maildir_users, user, _g_list_strcasecmp) != NULL) - mbox_type = "maildir"; if (strcmp(mbox_type, "mbox") == 0) { DEBUG(1) debugf("attempting to deliver %s with mbox\n", msg->uid); @@ -179,23 +177,6 @@ destroy_table(var_table); } else logwrite(LOG_ALERT, "mbox type is mda, but no mda command given in configuration\n"); - -#ifdef ENABLE_MAILDIR - } else if (strcmp(mbox_type, "maildir") == 0) { - DEBUG(1) debugf("attempting to deliver %s with maildir\n", msg->uid); - if (maildir_out(msg, hdr_list, rcpt->local_part, 0)) { - if (env_addr != rcpt) { - logwrite(LOG_NOTICE, "%s => %s@%s <%s@%s> with local\n", msg->uid, - rcpt->local_part, rcpt->domain, env_addr->local_part, env_addr->domain); - } else { - logwrite(LOG_NOTICE, "%s => <%s@%s> with maildir\n", msg->uid, - rcpt->local_part, rcpt->domain); - } - addr_mark_delivered(rcpt); - ok = TRUE; - } else - addr_mark_failed(rcpt); -#endif } else logwrite(LOG_ALERT, "unknown mbox type '%s'\n", mbox_type); } diff -r 5745edd5b769 -r 4fd237550525 src/local.c --- a/src/local.c Fri Jul 16 15:38:53 2010 +0200 +++ b/src/local.c Fri Jul 16 16:38:50 2010 +0200 @@ -144,132 +144,6 @@ return ok; } -#ifdef ENABLE_MAILDIR -gboolean -maildir_out(message * msg, GList * hdr_list, gchar * user, guint flags) -{ - struct passwd *pw; - gboolean ok = FALSE; - - /* headers may be special for a local delivery */ - if (hdr_list == NULL) - hdr_list = msg->hdr_list; - - if ((pw = getpwnam(user))) { - uid_t saved_uid = geteuid(); - gid_t saved_gid = getegid(); - gboolean uid_ok = TRUE, gid_ok = TRUE; - - if (!conf.run_as_user) { - uid_ok = (seteuid(0) == 0); - if (uid_ok) { - gid_ok = (setegid(conf.mail_gid) == 0); - uid_ok = (seteuid(pw->pw_uid) == 0); - } - } - - DEBUG(5) debugf("running as euid %d, egid %d\n", geteuid(), getegid()); - - if (uid_ok && gid_ok) { - char *path = g_strdup_printf("%s/Maildir", pw->pw_dir); - struct stat statbuf; - int ret; - - DEBUG(5) debugf(" path = %s\n", path); - - ok = TRUE; - ret = stat(path, &statbuf); - if (ret != 0) { - ok = FALSE; - if (errno == ENOENT) { - logwrite(LOG_NOTICE, "directory %s does not exist, creating\n", path); - if (mkdir(path, 0700) == 0) - ok = TRUE; - } else - logwrite(LOG_ALERT, "stat of %s failed: %s\n", path, strerror(errno)); - } - if (ok) { - ok = FALSE; - ret = stat(path, &statbuf); - if (S_ISDIR(statbuf.st_mode)) { - gchar *subdirs[] = { "tmp", "new", "cur" }; - int i; - for (i = 0; i < 3; i++) { - char *path1 = g_strdup_printf("%s/%s", path, subdirs[i]); - ret = stat(path1, &statbuf); - if (ret != 0) { - if (errno == ENOENT) { - logwrite(LOG_NOTICE, "directory %s does not exist, creating\n", path1); - if (mkdir(path1, 0700) != 0) - break; - } - } - g_free(path1); - } - if (i == 3) { - FILE *out; - mode_t saved_mode = umask(066); - /* the qmail style unique works only if delivering with different process. - We do not fork for each delivery, so our uid is more unique. - Hope it is compatible with all MUAs. - */ - gchar *filename = g_strdup_printf("%s/tmp/%s.%s", path, msg->uid, conf.host_name); - - DEBUG(5) debugf("filename = %s\n", filename); - - if ((out = fopen(filename, "w"))) { - gchar *newname = g_strdup_printf("%s/new/%s.%s", path, msg->uid, conf.host_name); - message_stream(out, msg, hdr_list, flags); - ok = TRUE; - if (fflush(out) == EOF) - ok = FALSE; - else if (fdatasync(fileno(out)) != 0) { - if (errno != EINVAL) - /* some fs do not support this.. I hope this also means that it is not necessary */ - ok = FALSE; - } - fclose(out); - if (rename(filename, newname) != 0) { - ok = FALSE; - logwrite(LOG_ALERT, "moving %s to %s failed: %s", filename, newname, strerror(errno)); - } - g_free(newname); - } - umask(saved_mode); - g_free(filename); - } - } else { - logwrite(LOG_ALERT, "%s is not a directory\n", path); - errno = ENOTDIR; - } - } - if (!conf.run_as_user) { - uid_ok = (seteuid(0) == 0); - if (uid_ok) { - gid_ok = (setegid(saved_gid) == 0); - uid_ok = (seteuid(saved_uid) == 0); - } - } - if (!uid_ok || !gid_ok) { - /* FIXME: if this fails we HAVE to exit, because we shall not run - with some users id. But we do not return, and so this message - will not be finished, so the user will get the message again - next time a delivery is attempted... */ - logwrite(LOG_ALERT, "could not set back uid or gid after local delivery: %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } - g_free(path); - } else { - logwrite(LOG_ALERT, "could not set uid or gid for local delivery, uid = %d: %s\n", pw->pw_uid, strerror(errno)); - } - } else { - logwrite(LOG_ALERT, "could not find password entry for user %s\n", user); - errno = ENOENT; /* getpwnam does not set errno correctly */ - } - return ok; -} -#endif - gboolean pipe_out(message * msg, GList * hdr_list, address * rcpt, gchar * cmd, guint flags) { diff -r 5745edd5b769 -r 4fd237550525 src/masqmail.c --- a/src/masqmail.c Fri Jul 16 15:38:53 2010 +0200 +++ b/src/masqmail.c Fri Jul 16 16:38:50 2010 +0200 @@ -499,7 +499,6 @@ if (mta_mode == MODE_VERSION) { gchar *with_resolver = ""; gchar *with_auth = ""; - gchar *with_maildir = ""; gchar *with_ident = ""; #ifdef ENABLE_RESOLVER @@ -508,15 +507,11 @@ #ifdef ENABLE_AUTH with_auth = " +auth"; #endif -#ifdef ENABLE_MAILDIR - with_maildir = " +maildir"; -#endif #ifdef ENABLE_IDENT with_ident = " +ident"; #endif - printf("%s %s%s%s%s%s\n", PACKAGE, VERSION, with_resolver, - with_auth, with_maildir, with_ident); + printf("%s %s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_auth, with_ident); exit(EXIT_SUCCESS); } diff -r 5745edd5b769 -r 4fd237550525 src/masqmail.h --- a/src/masqmail.h Fri Jul 16 15:38:53 2010 +0200 +++ b/src/masqmail.h Fri Jul 16 16:38:50 2010 +0200 @@ -168,7 +168,6 @@ gchar *mbox_default; GList *mbox_users; GList *mda_users; - GList *maildir_users; gchar *mda; gboolean mda_fromline; @@ -452,7 +451,6 @@ /* local.c */ gboolean append_file(message * msg, GList * hdr_list, gchar * user); -gboolean maildir_out(message * msg, GList * hdr_list, gchar * user, guint flags); gboolean pipe_out(message * msg, GList * hdr_list, address * rcpt, gchar * cmd, guint flags); /* log.c */