httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject [?PATCH?] using getpwnam_r in mod_userdir
Date Fri, 10 Nov 2000 20:15:57 GMT
(Sorry about tossing the commit message prematurely.)

In practice, _POSIX_THREAD_SAFE_FUNCTIONS doesn't imply the existence
of getpwnam_r().  Example: FreeBSD 3.4

We need to check if we actually have the function...

This change works on FreeBSD 3.4 and Mandrake 7.0, but I'm concerned
that it may not work everywhere...  If getpwnam_r() is in a special
library (e.g., libpthread), we won't know to link against the library
while we're doing module configuration.  APR figures out that stuff
for us, and we aren't that far yet.

some possibilities:

. punt this section of code to APR by creating an apr_get_home_dir()
  function somewhere (but maybe not appropriate on Win32?)

. use the code below until it breaks, then figure out what to do

. have APR export APR_HAVE_GETPWNAM_R to the app via apr.h

cvs server: Diffing modules/standard
Index: modules/standard/config.m4
RCS file: /cvs/apache/apache-2.0/src/modules/standard/config.m4,v
retrieving revision 1.30
diff -u -r1.30 config.m4
--- config.m4   2000/10/24 11:45:41     1.30
+++ config.m4   2000/11/10 20:02:33
@@ -25,7 +25,9 @@
 APACHE_CHECK_STANDARD_MODULE(imap, internal imagemaps, , yes)
 APACHE_CHECK_STANDARD_MODULE(actions, Action triggering on requests, action, yes)
 APACHE_CHECK_STANDARD_MODULE(speling, correct common URL misspellings, , no)
-APACHE_CHECK_STANDARD_MODULE(userdir, mapping of user requests, , yes)
+APACHE_CHECK_STANDARD_MODULE(userdir, mapping of user requests, , yes, [
+  AC_CHECK_FUNCS(getpwnam_r)
 APACHE_CHECK_STANDARD_MODULE(suexec, set uid and gid for spawned processes, , no)
 APACHE_CHECK_STANDARD_MODULE(alias, translation of requests, , yes)
Index: modules/standard/mod_userdir.c
RCS file: /cvs/apache/apache-2.0/src/modules/standard/mod_userdir.c,v
retrieving revision 1.25
diff -u -r1.25 mod_userdir.c
--- mod_userdir.c       2000/11/10 18:18:57     1.25
+++ mod_userdir.c       2000/11/10 20:02:33
@@ -326,7 +326,7 @@
 #else                           /* WIN32 */
             struct passwd *pw;
             struct passwd pwd;
             size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
             char *buf = apr_pcalloc(r->pool, buflen);

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message