- gc configure patch since it hasn't been required since introducing --without-permcheck in configure, despite the comment in Makefile. - Some of Defaults.py are now upstream defaults. Remove FLAVORs: - Rewrite src/common.c:check_caller() for the cgi/mail wrapper to now look at the defined group membership instead, _mailmanq (a new group). This allows the administrator to switch mail servers and web servers without requiring a FLAVOR for each combination; but rather, by simply adding the cgi/mail user to the _mailmanq group. This is a diversion from upstream, but will be proposed. At least sthen@ and dlg@ agree to go in this general direction.
79 lines
2.8 KiB
Plaintext
79 lines
2.8 KiB
Plaintext
$OpenBSD: patch-src_common_c,v 1.1 2016/04/22 16:42:14 okan Exp $
|
|
--- src/common.c.orig Sun Feb 28 15:47:44 2016
|
|
+++ src/common.c Sun Mar 20 16:22:35 2016
|
|
@@ -119,45 +119,39 @@ fatal(const char* ident, int exitcode, char* format, .
|
|
void
|
|
check_caller(const char* ident, const char* parentgroup)
|
|
{
|
|
- GID_T mygid = getgid();
|
|
- struct group *mygroup = getgrgid(mygid);
|
|
- char* option;
|
|
- char* server;
|
|
+ struct passwd *pw;
|
|
+ struct group *gr;
|
|
+ char **g;
|
|
+ int ok = 0;
|
|
char* wrapper;
|
|
|
|
- if (running_as_cgi) {
|
|
- option = "--with-cgi-gid";
|
|
- server = "web";
|
|
- wrapper = "CGI";
|
|
- }
|
|
- else {
|
|
- option = "--with-mail-gid";
|
|
- server = "mail";
|
|
- wrapper = "mail";
|
|
- }
|
|
+ pw = getpwuid(getuid());
|
|
+ if (pw == NULL)
|
|
+ fatal(ident, USER_NAME_NOT_FOUND,
|
|
+ "Failure to find username");
|
|
|
|
- if (!mygroup)
|
|
- fatal(ident, GROUP_NAME_NOT_FOUND,
|
|
- "Failure to find group name for GID %d. Mailman\n"
|
|
- "expected the %s wrapper to be executed as group\n"
|
|
- "\"%s\", but the system's %s server executed the\n"
|
|
- "wrapper as GID %d for which the name could not be\n"
|
|
- "found. Try adding GID %d to your system as \"%s\",\n"
|
|
- "or tweak your %s server to run the wrapper as group\n"
|
|
- "\"%s\".",
|
|
- mygid, wrapper, parentgroup, server, mygid, mygid,
|
|
- parentgroup, server, parentgroup);
|
|
+ gr = getgrnam(parentgroup);
|
|
+ if (gr == NULL)
|
|
+ fatal(ident, GROUP_NAME_NOT_FOUND,
|
|
+ "Failure to find \"%s\" group", parentgroup);
|
|
|
|
- if (strcmp(parentgroup, mygroup->gr_name))
|
|
- fatal(ident, GROUP_MISMATCH,
|
|
- "Group mismatch error. Mailman expected the %s\n"
|
|
- "wrapper script to be executed as group \"%s\", but\n"
|
|
- "the system's %s server executed the %s script as\n"
|
|
- "group \"%s\". Try tweaking the %s server to run the\n"
|
|
- "script as group \"%s\", or re-run configure, \n"
|
|
- "providing the command line option `%s=%s'.",
|
|
- wrapper, parentgroup, server, wrapper, mygroup->gr_name,
|
|
- server, parentgroup, option, mygroup->gr_name);
|
|
+ for (g = gr->gr_mem; *g; g++) {
|
|
+ if (strcmp(pw->pw_name, *g) == 0) {
|
|
+ ok = 1;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (running_as_cgi)
|
|
+ wrapper = "CGI";
|
|
+ else
|
|
+ wrapper = "mail";
|
|
+
|
|
+ if (ok == 0)
|
|
+ fatal(ident, GROUP_MISMATCH,
|
|
+ "Group mismatch error. Mailman expected the %s\n"
|
|
+ "wrapper script to be executed by a member of\n"
|
|
+ "\"%s\" group.", wrapper, parentgroup);
|
|
}
|
|
|
|
|