--- main/fopen_wrappers.c.orig Fri Aug 23 01:00:49 2002 +++ main/fopen_wrappers.c Tue Jan 14 22:32:27 2003 @@ -388,6 +388,20 @@ SG(request_info).path_translated = NULL; return FAILURE; } + + if (0 == stat (filename, &st)) { + if (st.st_uid != getuid()) { + fprintf(stderr, + "%s: Owner of %s doesn't match " + "(expected %d, found %d)\n", + getenv("SCRIPT_NAME") ? getenv("SCRIPT_NAME") : "php.cgi", + filename, + (int) getuid(), + (int) st.st_uid); + return FAILURE; + } + } + fp = VCWD_FOPEN(filename, "rb"); /* refuse to open anything that is not a regular file */