changeset 342:6b3e1584a0fd

Only setuid in mlmmj-sub when we're root
author mmj
date Tue, 14 Sep 2004 21:06:44 +1000
parents 2a0150a1c9de
children 6d1f589dee87
files ChangeLog src/mlmmj-sub.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 14 21:04:21 2004 +1000
+++ b/ChangeLog	Tue Sep 14 21:06:44 2004 +1000
@@ -1,3 +1,5 @@
+ o Avoid message about changing uid in mlmmj-sub by only saying so when doing
+   so
  o Add sanity checks to disallow denial mails going to the list
  o Implement -d option for mlmmj-maintd to be able to supply it with a directory
    containing several listdirs, where mlmmj-maintd then will run maintenance
--- a/src/mlmmj-sub.c	Tue Sep 14 21:04:21 2004 +1000
+++ b/src/mlmmj-sub.c	Tue Sep 14 21:06:44 2004 +1000
@@ -350,6 +350,7 @@
 	off_t suboff;
 	struct stat st;
 	pid_t pid, childpid;
+	uid_t uid;
 
 	CHECKFULLPATH(argv[0]);
 
@@ -407,13 +408,14 @@
 	}
 
 	if(changeuid) {
-		if(stat(listdir, &st) == 0) {
+		uid = getuid();
+		if(!uid && stat(listdir, &st) == 0) {
 			printf("Changing to uid %d, owner of %s.\n",
 					(int)st.st_uid, listdir);
 			if(setuid(st.st_uid) < 0) {
 				perror("setuid");
 				fprintf(stderr, "Continuing as uid %d\n",
-						(int)getuid());
+						(int)uid);
 			}
 		}
 	}