rendered paste body--- fopen_wrappers.c.old 2007-01-11 14:19:32.317404224 +0000
+++ fopen_wrappers.c 2007-01-11 15:43:41.241851040 +0000
@@ -274,13 +274,23 @@
filename = NULL; /* discard the original filename, it must not be used */
if (s) { /* if there is no path name after the file, do not bother */
/* to try open the directory */
+#ifdef HAVE_GETPWNAM_R
+ struct passwd pwstruc;
+ int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ char *pwbuf = emalloc(pwbuflen);
+#endif
+ struct passwd *pw;
+
length = s - (path_info + 2);
if (length > (int)sizeof(user) - 1)
length = sizeof(user) - 1;
memcpy(user, path_info + 2, length);
user[length] = '\0';
-
+#ifdef HAVE_GETPWNAM_R
+ getpwnam_r(user, &pwstruc, pwbuf, pwbuflen, &pw);
+#else
pw = getpwnam(user);
+#endif
if (pw && pw->pw_dir) {
filename = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
if (filename) {
@@ -290,6 +300,9 @@
SG(request_info).path_translated = filename;
}
}
+#ifdef HAVE_GETPWNAM_R
+ efree(pwbuf);
+#endif
}
} else
#endif