coar 99/05/05 13:43:02
Modified: src CHANGES src/main http_main.c Log: Fix the grouplist problem caused by setgid() on some systems. PR: 2579 Submitted by: Rob Saccoccio <[EMAIL PROTECTED]> Reviewed by: Ken Coar Revision Changes Path 1.1349 +5 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1348 retrieving revision 1.1349 diff -u -r1.1348 -r1.1349 --- CHANGES 1999/05/05 20:18:04 1.1348 +++ CHANGES 1999/05/05 20:42:55 1.1349 @@ -1,5 +1,10 @@ Changes with Apache 1.3.7 + *) Do setgid() before initgroups() in http_main; some platforms + zap the grouplist when setgid() is called. This was fixed in + suexec earlier, but the main httpd code missed the change. + [Rob Saccoccio <[EMAIL PROTECTED]>] PR#2579 + *) Add recognition of .tgz as a gzipped tarchive. [Bertrand de Singly <[EMAIL PROTECTED]>] PR#2364 1.435 +13 -8 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.434 retrieving revision 1.435 diff -u -r1.434 -r1.435 --- http_main.c 1999/05/04 11:21:10 1.434 +++ http_main.c 1999/05/05 20:42:58 1.435 @@ -2993,6 +2993,17 @@ #if !defined(OS2) && !defined(TPF) /* OS/2 and TPF don't support groups. */ + /* + * Set the GID before initgroups(), since on some platforms + * setgid() is known to zap the group list. + */ + if (setgid(ap_group_id) == -1) { + ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, + "setgid: unable to set group id to Group %u", + (unsigned)ap_group_id); + clean_child_exit(APEXIT_CHILDFATAL); + } + /* Reset `groups' attributes. */ if (initgroups(name, ap_group_id) == -1) { @@ -3006,15 +3017,9 @@ ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "getgroups: unable to get group list"); clean_child_exit(APEXIT_CHILDFATAL); - } -#endif - if (setgid(ap_group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setgid: unable to set group id to Group %u", - (unsigned)ap_group_id); - clean_child_exit(APEXIT_CHILDFATAL); } -#endif +#endif /* MULTIPLE_GROUPS */ +#endif /* !defined(OS2) && !defined(TPF) */ } #endif /* ndef WIN32 */ }