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:16:52 UTC
cvs commit: apache-2.0/src/modules/standard mod_userdir.c
rbb 00/11/10 10:16:52
Modified: . STATUS
src/modules/standard mod_userdir.c
Log:
Remove a thread un-safe function when APR_HAS_THREADS
Revision Changes Path
1.156 +1 -5 apache-2.0/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/apache-2.0/STATUS,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -r1.155 -r1.156
--- STATUS 2000/11/10 01:35:38 1.155
+++ STATUS 2000/11/10 18:16:51 1.156
@@ -1,5 +1,5 @@
Apache 2.0 STATUS:
-Last modified at [$Date: 2000/11/10 01:35:38 $]
+Last modified at [$Date: 2000/11/10 18:16:51 $]
Release:
@@ -58,10 +58,6 @@
Status: The best known candidate would be something from
BIND v9.
Status: Greg asks, "why? doesn't gethostbyname_r() handle this?"
-
- * There are still thread-unsafe functions used in the server.
- - getpwnam in mod_userdir
- - more?
* Modify mod_cgi and mod_cgid to deal with directories. This allows
a lot of directives to be removed from the core.
1.24 +12 -0 apache-2.0/src/modules/standard/mod_userdir.c
Index: mod_userdir.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_userdir.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- mod_userdir.c 2000/10/31 00:47:21 1.23
+++ mod_userdir.c 2000/11/10 18:16:52 1.24
@@ -106,6 +106,9 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
@@ -322,7 +325,16 @@
return DECLINED;
#else /* WIN32 */
struct passwd *pw;
+
+/*#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);
+
+ if (!getpwnam_r(w, &pwd, buf, buflen, &pw)) {
+/*#else
if ((pw = getpwnam(w))) {
+#endif*/
#ifdef OS2
/* Need to manually add user name for OS/2 */
filename = apr_pstrcat(r->pool, pw->pw_dir, w, "/", userdir, NULL);