jim 96/09/23 13:38:57
Modified: src http_conf_globals.h http_main.c util.c
Log:
Handle multiple groups
Revision Changes Path
1.5 +2 -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.4
retrieving revision 1.5
diff -C3 -r1.4 -r1.5
*** http_conf_globals.h 1996/08/20 11:50:42 1.4
--- http_conf_globals.h 1996/09/23 20:38:51 1.5
***************
*** 50,56 ****
*
*/
! /* $Id: http_conf_globals.h,v 1.4 1996/08/20 11:50:42 paul Exp $ */
/*
* Process config --- what the process ITSELF is doing
--- 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
***************
*** 60,65 ****
--- 60,66 ----
extern uid_t user_id;
extern char *user_name;
extern gid_t group_id;
+ extern gid_t group_id_list[NGROUPS_MAX];
extern int max_requests_per_child;
extern struct in_addr bind_address;
extern listen_rec *listeners;
1.70 +7 -1 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -C3 -r1.69 -r1.70
*** http_main.c 1996/09/23 09:53:32 1.69
--- http_main.c 1996/09/23 20:38:52 1.70
***************
*** 50,56 ****
*
*/
! /* $Id: http_main.c,v 1.69 1996/09/23 09:53:32 ben Exp $ */
/*
* httpd.c: simple http daemon for answering WWW file requests
--- 50,56 ----
*
*/
! /* $Id: http_main.c,v 1.70 1996/09/23 20:38:52 jim Exp $ */
/*
* httpd.c: simple http daemon for answering WWW file requests
***************
*** 122,127 ****
--- 122,128 ----
uid_t user_id;
char *user_name;
gid_t group_id;
+ gid_t group_id_list[NGROUPS_MAX];
int max_requests_per_child;
char *pid_fname;
char *scoreboard_fname;
***************
*** 1134,1139 ****
--- 1135,1145 ----
if (initgroups(name, group_id) == -1) {
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);
}
1.19 +9 -4 apache/src/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C3 -r1.18 -r1.19
*** util.c 1996/08/20 11:51:23 1.18
--- util.c 1996/09/23 20:38:53 1.19
***************
*** 50,56 ****
*
*/
! /* $Id: util.c,v 1.18 1996/08/20 11:51:23 paul Exp $ */
/*
* str.c: string utility things
--- 50,56 ----
*
*/
! /* $Id: util.c,v 1.19 1996/09/23 20:38:53 jim Exp $ */
/*
* str.c: string utility things
***************
*** 890,895 ****
--- 890,896 ----
}
int can_exec(struct stat *finfo) {
+ int cnt;
#ifdef __EMX__
/* OS/2 dosen't have Users and Groups */
return (finfo->st_mode & S_IEXEC);
***************
*** 897,905 ****
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;
return (finfo->st_mode & S_IXOTH);
#endif
}
--- 898,910 ----
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
}