chuck 96/06/07 19:47:22
Modified: src http_main.c Log: Submitted by: Robert S. Thau Switch uid to the uid in the User config file directive, if run as root from an inetd. Revision Changes Path 1.35 +5 -2 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C3 -r1.34 -r1.35 *** http_main.c 1996/06/07 20:02:03 1.34 --- http_main.c 1996/06/08 02:47:20 1.35 *************** *** 1522,1529 **** set_group_privs(); default_server_hostnames (server_conf); ! user_id = getuid(); ! group_id = getgid(); c = sizeof(sa_client); if ((getpeername(fileno(stdin), &sa_client, &c)) < 0) --- 1522,1532 ---- set_group_privs(); default_server_hostnames (server_conf); ! /* Only try to switch if we're running as root */ ! if(!geteuid() && setuid(user_id) == -1) { ! log_unixerr("setuid", NULL, "unable to change uid", server_conf); ! exit (1); ! } c = sizeof(sa_client); if ((getpeername(fileno(stdin), &sa_client, &c)) < 0)