Mercurial > hg > mlmmj
changeset 315:564caf17f59c
README exim comments and sanity check in mlmmj-maintd
author | mmj |
---|---|
date | Sat, 04 Sep 2004 22:53:16 +1000 |
parents | 2ec35c398074 |
children | 6c832431db78 |
files | ChangeLog README src/mlmmj-maintd.c |
diffstat | 3 files changed, 30 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Sep 04 09:24:45 2004 +1000 +++ b/ChangeLog Sat Sep 04 22:53:16 2004 +1000 @@ -1,3 +1,5 @@ + o Also make sanity check in mlmmj-maintd to ensure it's invoke either + as root or as listdir owner 1.0.0-RC4 o Fix brown paper bag bug not allowing enough space for the new better random strings introduced in RC3 so subscribe and unsubscribe works again.
--- a/README Sat Sep 04 09:24:45 2004 +1000 +++ b/README Sat Sep 04 22:53:16 2004 +1000 @@ -29,7 +29,8 @@ local_part_suffix = +* local_part_suffix_optional - to the "userforward:" and the "localuser:" router in /etc/exim/exim.conf. + to the "userforward:" and the "localuser:" router in /etc/exim/exim.conf, + and also add "local_part_suffix = +*" to the system_aliases function. There is a nice FAQ explaining here: http://faqs.org/faqs/mail/addressing/
--- a/src/mlmmj-maintd.c Sat Sep 04 09:24:45 2004 +1000 +++ b/src/mlmmj-maintd.c Sat Sep 04 22:53:16 2004 +1000 @@ -732,8 +732,8 @@ int opt, daemonize = 1; char *bindir, *listdir = NULL, *mlmmjsend, *mlmmjbounce, *mlmmjunsub; char *logstr, *logname, *random; - char uidstr[16]; struct stat st; + uid_t uid; CHECKFULLPATH(argv[0]); @@ -768,18 +768,35 @@ exit(EXIT_FAILURE); } - if(stat(listdir, &st) < 0) { - log_error(LOG_ARGS, "Could not stat listdir '%s'", listdir); + /* sanity check since maintd should be invoked as root so it can + * setuid or as the owner of listdir */ + + if(listdir) { + if(stat(listdir, &st) == 0) { + uid = getuid(); + if(uid && uid != st.st_uid) { + log_error(LOG_ARGS, + "Have to invoke either as root " + "or as the user owning listdir"); + writen(STDERR_FILENO, + "Have to invoke either as root " + "or as the user owning listdir\n", 60); exit(EXIT_FAILURE); } + } else { + log_error(LOG_ARGS, "Could not stat %s", listdir); + exit(EXIT_FAILURE); + } + } + if(uid == 0) { /* We're root. chown the logfile and setuid */ chown(logname, st.st_uid, st.st_gid); - snprintf(uidstr, sizeof(uidstr), "%d", (int)st.st_uid); if(setuid(st.st_uid) < 0) { log_error(LOG_ARGS, "Could not setuid listdir owner"); exit(EXIT_FAILURE); } + } bindir = mydirname(argv[0]); mlmmjsend = concatstr(2, bindir, "/mlmmj-send");