You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/11/10 19:42:40 UTC
cvs commit: apache-2.0/src/modules/standard mod_rewrite.c
rbb 00/11/10 10:42:40
Modified: src/modules/standard mod_rewrite.c
Log:
remove a thread un-safe function from mod_rewrite
Revision Changes Path
1.48 +9 -0 apache-2.0/src/modules/standard/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- mod_rewrite.c 2000/10/28 03:06:22 1.47
+++ mod_rewrite.c 2000/11/10 18:42:40 1.48
@@ -2630,6 +2630,11 @@
struct passwd *pw;
char *newuri;
int i, j;
+#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+ struct passwd pwd;
+ size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ char *buf = apr_pcalloc(r->pool, buflen);
+#endif
newuri = uri;
if (uri != NULL && strlen(uri) > 2 && uri[0] == '/' && uri[1] == '~') {
@@ -2642,7 +2647,11 @@
user[j] = '\0';
/* lookup username in systems passwd file */
+#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+ if (!getpwnam_r(user, &pwd, buf, buflen, &pw)) {
+#else
if ((pw = getpwnam(user)) != NULL) {
+#endif
/* ok, user was found, so expand the ~user string */
if (uri[i] != '\0') {
/* ~user/anything... has to be expanded */