Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 51253 invoked by uid 500); 10 Nov 2000 20:22:15 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 51227 invoked from network); 10 Nov 2000 20:22:14 -0000 Date: Fri, 10 Nov 2000 12:23:26 -0800 (PST) From: rbb@covalent.net X-Sender: rbb@koj.rkbloom.net To: new-httpd@apache.org, trawickj@bellsouth.net Subject: Re: [?PATCH?] using getpwnam_r in mod_userdir In-Reply-To: <200011102015.PAA08707@adsl-77-241-65.rdu.bellsouth.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Argh. :-( The general rule that we used in APR was that if _POSIX_THREAD_SAFE_FUNCTIONS is defined, then we can use the _r functions. The problem is that with the patch below, the code is broken when using threaded httpd on FreeBSD. How does 3.4 provide a thread-safe version of getpwnam? Ryan On Fri, 10 Nov 2000, Jeff Trawick wrote: > (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; > > -#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) > +#if APR_HAS_THREADS && defined(HAVE_GETPWNAM_R) > struct passwd pwd; > size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); > char *buf = apr_pcalloc(r->pool, buflen); > > -- > Jeff Trawick | trawick@ibm.net | PGP public key at web site: > http://www.geocities.com/SiliconValley/Park/9289/ > Born in Roswell... married an alien... > > _______________________________________________________________________________ Ryan Bloom rbb@apache.org 406 29th St. San Francisco, CA 94131 -------------------------------------------------------------------------------