# HG changeset patch # User markus schnalke # Date 1338366430 -7200 # Node ID bdbedce60247e1cc0b2e30843c15835fec40bb32 # Parent f373844708553ebc3c0143575cd5aa487b04678d Remove `input' dir in spool dir. Spooled files are in spool dir directly now. There's no more need to have any sub directories in the spool dir at all. diff -r f37384470855 -r bdbedce60247 INSTALL --- a/INSTALL Wed May 30 09:38:38 2012 +0200 +++ b/INSTALL Wed May 30 10:27:10 2012 +0200 @@ -97,7 +97,7 @@ Check that 'make install' worked correctly. The following command: ls -ld /usr/local/sbin/masqmail /etc/masqmail /var/log/masqmail/ \ - /var/spool/masqmail/ /var/spool/masqmail/* + /var/spool/masqmail/ should give output similar to @@ -105,7 +105,6 @@ drwxr-xr-x 2 root root 4096 May 10 12:34 /etc/masqmail drwxr-xr-x 2 mail mail 4096 May 10 12:34 /var/log/masqmail drwxr-xr-x 5 mail mail 4096 May 10 12:34 /var/spool/masqmail - drwxr-xr-x 2 mail mail 4096 May 10 12:34 /var/spool/masqmail/input Important are the set-user-id bit for /usr/local/sbin/masqmail and the ownership of the directories. diff -r f37384470855 -r bdbedce60247 Makefile.am --- a/Makefile.am Wed May 30 09:38:38 2012 +0200 +++ b/Makefile.am Wed May 30 10:27:10 2012 +0200 @@ -46,12 +46,10 @@ spool_dir: install -d -o @with_user@ -g @with_group@ $(DESTDIR)@with_spooldir@ - install -d -o @with_user@ -g @with_group@ $(DESTDIR)@with_spooldir@/input rm-spool_dir: : # removal fails if the dirs are non-empty : # this prevents losing spooled files - rmdir $(DESTDIR)@with_spooldir@/input rmdir $(DESTDIR)@with_spooldir@ rmail: diff -r f37384470855 -r bdbedce60247 Makefile.in --- a/Makefile.in Wed May 30 09:38:38 2012 +0200 +++ b/Makefile.in Wed May 30 10:27:10 2012 +0200 @@ -730,12 +730,10 @@ spool_dir: install -d -o @with_user@ -g @with_group@ $(DESTDIR)@with_spooldir@ - install -d -o @with_user@ -g @with_group@ $(DESTDIR)@with_spooldir@/input rm-spool_dir: : # removal fails if the dirs are non-empty : # this prevents losing spooled files - rmdir $(DESTDIR)@with_spooldir@/input rmdir $(DESTDIR)@with_spooldir@ rmail: diff -r f37384470855 -r bdbedce60247 configure --- a/configure Wed May 30 09:38:38 2012 +0200 +++ b/configure Wed May 30 10:27:10 2012 +0200 @@ -5254,7 +5254,7 @@ if test "${with_logdir+set}" = set; then : withval=$with_logdir; else - with_logdir='/var/log/masqmail/' + with_logdir='/var/log/masqmail' fi @@ -5270,7 +5270,7 @@ if test "${with_spooldir+set}" = set; then : withval=$with_spooldir; else - with_spooldir='/var/spool/masqmail/' + with_spooldir='/var/spool/masqmail' fi diff -r f37384470855 -r bdbedce60247 configure.ac --- a/configure.ac Wed May 30 09:38:38 2012 +0200 +++ b/configure.ac Wed May 30 10:27:10 2012 +0200 @@ -166,7 +166,7 @@ AC_ARG_WITH(logdir, [ --with-logdir=DIR set log directory [/var/log/masqmail]], , - with_logdir='/var/log/masqmail/' + with_logdir='/var/log/masqmail' ) AC_DEFINE_UNQUOTED(LOG_DIR, "${with_logdir}", [The log directory]) AC_SUBST(with_logdir) @@ -174,7 +174,7 @@ AC_ARG_WITH(spooldir, [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]], , - with_spooldir='/var/spool/masqmail/' + with_spooldir='/var/spool/masqmail' ) AC_DEFINE_UNQUOTED(SPOOL_DIR, "${with_spooldir}", [The spool directory]) AC_SUBST(with_spooldir) diff -r f37384470855 -r bdbedce60247 man/masqmail.conf.5 --- a/man/masqmail.conf.5 Wed May 30 09:38:38 2012 +0200 +++ b/man/masqmail.conf.5 Wed May 30 10:27:10 2012 +0200 @@ -93,7 +93,6 @@ The directory where masqmail stores its spool files (and lock files if \fIrun_as_user\fP). -It must have a subdirectory \fIinput\fR. Masqmail needs read and write permissions for this directory. \fIfile\fR must be an absolute path. diff -r f37384470855 -r bdbedce60247 src/queue.c --- a/src/queue.c Wed May 30 09:38:38 2012 +0200 +++ b/src/queue.c Wed May 30 10:27:10 2012 +0200 @@ -54,7 +54,7 @@ ** Escaping the question marks prevents them from being ** interpreted as trigraphs */ - pattern = g_strdup_printf("%s/input/?????\?-??\?-?\?-H", conf.spool_dir); + pattern = g_strdup_printf("%s/?????\?-??\?-?\?-H", conf.spool_dir); gl.gl_offs = 0; glob(pattern, 0, NULL, &gl); @@ -73,9 +73,9 @@ for (i = 0; i < gl.gl_pathc; i++) { gchar *uid; - /* copy 13 chars, offset spooldir path + 7 chars for /input/ */ + /* copy 13 chars, offset spooldir path + 1 char for / */ /* uid length = 6 chars + '-' + 3 chars + '-' + 2 = 13 chars */ - uid = g_strndup(&(gl.gl_pathv[idx_arr[i]][strlen(conf.spool_dir) + 7]), 13); + uid = g_strndup(&(gl.gl_pathv[idx_arr[i]][strlen(conf.spool_dir) + 1]), 13); DEBUG(5) debugf("uid: %s\n", uid); @@ -196,8 +196,8 @@ { gboolean hdr_ok = TRUE; gboolean dat_ok = TRUE; - gchar *hdr_name = g_strdup_printf("%s/input/%s-H", conf.spool_dir, uid); - gchar *dat_name = g_strdup_printf("%s/input/%s-D", conf.spool_dir, uid); + gchar *hdr_name = g_strdup_printf("%s/%s-H", conf.spool_dir, uid); + gchar *dat_name = g_strdup_printf("%s/%s-D", conf.spool_dir, uid); struct stat stat_buf; if (!spool_lock(uid)) { diff -r f37384470855 -r bdbedce60247 src/spool.c --- a/src/spool.c Wed May 30 09:38:38 2012 +0200 +++ b/src/spool.c Wed May 30 10:27:10 2012 +0200 @@ -96,7 +96,7 @@ gchar *spool_file; DEBUG(5) debugf("spool_read_data entered\n"); - spool_file = g_strdup_printf("%s/input/%s-D", conf.spool_dir, msg->uid); + spool_file = g_strdup_printf("%s/%s-D", conf.spool_dir, msg->uid); DEBUG(5) debugf("reading data spool file '%s'\n", spool_file); in = fopen(spool_file, "r"); if (!in) { @@ -127,7 +127,7 @@ gchar *spool_file; /* header spool: */ - spool_file = g_strdup_printf("%s/input/%s-H", conf.spool_dir, msg->uid); + spool_file = g_strdup_printf("%s/%s-H", conf.spool_dir, msg->uid); in = fopen(spool_file, "r"); if (!in) { logwrite(LOG_ALERT, "could not open spool header file %s: %s\n", @@ -232,7 +232,7 @@ gboolean ok = TRUE; /* header spool: */ - tmp_file = g_strdup_printf("%s/input/%d-H.tmp", conf.spool_dir, getpid()); + tmp_file = g_strdup_printf("%s/%d-H.tmp", conf.spool_dir, getpid()); DEBUG(4) debugf("tmp_file = %s\n", tmp_file); if ((out = fopen(tmp_file, "w"))) { @@ -282,7 +282,7 @@ } fclose(out); if (ok) { - spool_file = g_strdup_printf("%s/input/%s-H", conf.spool_dir, msg->uid); + spool_file = g_strdup_printf("%s/%s-H", conf.spool_dir, msg->uid); DEBUG(4) debugf("spool_file = %s\n", spool_file); ok = (rename(tmp_file, spool_file) != -1); g_free(spool_file); @@ -319,7 +319,7 @@ if (ok && do_write_data) { /* data spool: */ - tmp_file = g_strdup_printf("%s/input/%d-D.tmp", conf.spool_dir, getpid()); + tmp_file = g_strdup_printf("%s/%d-D.tmp", conf.spool_dir, getpid()); DEBUG(4) debugf("tmp_file = %s\n", tmp_file); if ((out = fopen(tmp_file, "w"))) { @@ -338,7 +338,7 @@ } fclose(out); if (ok) { - spool_file = g_strdup_printf("%s/input/%s-D", conf.spool_dir, msg->uid); + spool_file = g_strdup_printf("%s/%s-D", conf.spool_dir, msg->uid); DEBUG(4) debugf("spool_file = %s\n", spool_file); ok = (rename(tmp_file, spool_file) != -1); g_free(spool_file); @@ -428,14 +428,14 @@ } /* header spool: */ - spool_file = g_strdup_printf("%s/input/%s-H", conf.spool_dir, msg->uid); + spool_file = g_strdup_printf("%s/%s-H", conf.spool_dir, msg->uid); if (unlink(spool_file) != 0) { logwrite(LOG_ALERT, "could not delete spool file %s: %s\n", spool_file, strerror(errno)); } g_free(spool_file); /* data spool: */ - spool_file = g_strdup_printf("%s/input/%s-D", conf.spool_dir, msg->uid); + spool_file = g_strdup_printf("%s/%s-D", conf.spool_dir, msg->uid); if (unlink(spool_file) != 0) { logwrite(LOG_ALERT, "could not delete spool file %s: %s\n", spool_file, strerror(errno)); }