summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1999-02-19 22:42:47 +0000
committerbwarsaw1999-02-19 22:42:47 +0000
commitc0833f550d3f1576515005aa25aae3e225098bc0 (patch)
tree2202d2dd7ddd5a7b531ebd76f63fcdde8ab218cd
parent736cd43fc95e5e630c877d1b0513b9bc45ec02ea (diff)
downloadmailman-c0833f550d3f1576515005aa25aae3e225098bc0.tar.gz
mailman-c0833f550d3f1576515005aa25aae3e225098bc0.tar.zst
mailman-c0833f550d3f1576515005aa25aae3e225098bc0.zip
-rw-r--r--src/common.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c
index 0163e521e..9de44907a 100644
--- a/src/common.c
+++ b/src/common.c
@@ -105,11 +105,12 @@ fatal(const char* ident, const char* format, ...)
void
check_caller(const char* ident, gid_t parentgid)
{
- if (parentgid != getgid()) {
+ gid_t mygid = getgid();
+ if (parentgid != mygid) {
fatal(ident,
"Failure to exec script. WANTED gid %d, GOT gid %d. "
"(Reconfigure to take %d?)",
- parentgid, getgid(), getgid());
+ parentgid, mygid, mygid);
}
}
@@ -132,6 +133,18 @@ run_script(const char* script, int argc, char** argv, char** env)
char** newenv;
char** newargv;
+ /* We need to set the real gid to the effective gid because there are
+ * some Linux systems which do not preserve the effective gid across
+ * popen() calls. This breaks mail delivery unless the ~mailman/data
+ * directory is chown'd to the uid that runs mail programs, and that
+ * isn't a viable alternative.
+ */
+#ifdef HAVE_SETREGID
+ status = setregid(getegid(), -1);
+ if (status)
+ fatal(logident, "%s", strerror(errno));
+#endif /* HAVE_SETREGID */
+
/* We want to tightly control how the CGI scripts get executed.
* For portability and security, the path to the Python executable
* is hard-coded into this C wrapper, rather than encoded in the #!