jim 96/10/01 17:31:55
Modified: src http_conf_globals.h http_main.c util.c
Log:
Make multiple groups a compile-time option
Revision Changes Path
1.6 +3 -1 apache/src/http_conf_globals.h
Index: http_conf_globals.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_conf_globals.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C3 -r1.5 -r1.6
*** http_conf_globals.h 1996/09/23 20:38:51 1.5
--- http_conf_globals.h 1996/10/02 00:31:51 1.6
***************
*** 50,56 ****
*
*/
! /* $Id: http_conf_globals.h,v 1.5 1996/09/23 20:38:51 jim Exp $ */
/*
* Process config --- what the process ITSELF is doing
--- 50,56 ----
*
*/
! /* $Id: http_conf_globals.h,v 1.6 1996/10/02 00:31:51 jim Exp $ */
/*
* Process config --- what the process ITSELF is doing
***************
*** 60,66 ****
--- 60,68 ----
extern uid_t user_id;
extern char *user_name;
extern gid_t group_id;
+ #ifdef MULTIPLE_GROUPS
extern gid_t group_id_list[NGROUPS_MAX];
+ #endif
extern int max_requests_per_child;
extern struct in_addr bind_address;
extern listen_rec *listeners;
1.75 +5 -3 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -C3 -r1.74 -r1.75
*** http_main.c 1996/10/01 00:12:26 1.74
--- http_main.c 1996/10/02 00:31:52 1.75
***************
*** 50,56 ****
*
*/
! /* $Id: http_main.c,v 1.74 1996/10/01 00:12:26 fielding Exp $ */
/*
* httpd.c: simple http daemon for answering WWW file requests
--- 50,56 ----
*
*/
! /* $Id: http_main.c,v 1.75 1996/10/02 00:31:52 jim Exp $ */
/*
* httpd.c: simple http daemon for answering WWW file requests
***************
*** 122,128 ****
--- 122,130 ----
uid_t user_id;
char *user_name;
gid_t group_id;
+ #ifdef MULTIPLE_GROUPS
gid_t group_id_list[NGROUPS_MAX];
+ #endif
int max_requests_per_child;
char *pid_fname;
char *scoreboard_fname;
***************
*** 1137,1148 ****
log_unixerr("initgroups", NULL, "unable to set groups", server_conf);
exit (1);
}
!
if (getgroups(NGROUPS_MAX, group_id_list) == -1) {
log_unixerr("getgroups", NULL, "unable to get group list", server_conf);
exit (1);
}
!
if (setgid(group_id) == -1) {
log_unixerr("setgid", NULL, "unable to set group id", server_conf);
exit (1);
--- 1139,1150 ----
log_unixerr("initgroups", NULL, "unable to set groups", server_conf);
exit (1);
}
! #ifdef MULTIPLE_GROUPS
if (getgroups(NGROUPS_MAX, group_id_list) == -1) {
log_unixerr("getgroups", NULL, "unable to get group list", server_conf);
exit (1);
}
! #endif
if (setgid(group_id) == -1) {
log_unixerr("setgid", NULL, "unable to set group id", server_conf);
exit (1);
1.22 +8 -3 apache/src/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C3 -r1.21 -r1.22
*** util.c 1996/09/30 05:56:27 1.21
--- util.c 1996/10/02 00:31:52 1.22
***************
*** 50,56 ****
*
*/
! /* $Id: util.c,v 1.21 1996/09/30 05:56:27 brian Exp $ */
/*
* str.c: string utility things
--- 50,56 ----
*
*/
! /* $Id: util.c,v 1.22 1996/10/02 00:31:52 jim Exp $ */
/*
* str.c: string utility things
***************
*** 919,925 ****
--- 919,927 ----
}
int can_exec(struct stat *finfo) {
+ #ifdef MULTIPLE_GROUPS
int cnt;
+ #endif
#ifdef __EMX__
/* OS/2 dosen't have Users and Groups */
return (finfo->st_mode & S_IEXEC);
***************
*** 927,939 ****
if(user_id == finfo->st_uid)
if(finfo->st_mode & S_IXUSR)
return 1;
for(cnt=0; cnt < NGROUPS_MAX; cnt++) {
if(group_id_list[cnt] == finfo->st_gid)
if(finfo->st_mode & S_IXGRP)
return 1;
- else
- break;
}
return (finfo->st_mode & S_IXOTH);
#endif
}
--- 929,944 ----
if(user_id == finfo->st_uid)
if(finfo->st_mode & S_IXUSR)
return 1;
+ if(group_id == finfo->st_gid)
+ if(finfo->st_mode & S_IXGRP)
+ return 1;
+ #ifdef MULTIPLE_GROUPS
for(cnt=0; cnt < NGROUPS_MAX; cnt++) {
if(group_id_list[cnt] == finfo->st_gid)
if(finfo->st_mode & S_IXGRP)
return 1;
}
+ #endif
return (finfo->st_mode & S_IXOTH);
#endif
}