DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17191>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17191 Patch for mod_auth_digest to remove use of tmpnam Summary: Patch for mod_auth_digest to remove use of tmpnam Product: Apache httpd-2.0 Version: HEAD Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: mod_auth_digest AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] tmpnam is not good on win32 platforms. I was changing it in mod_authn_mysql, and figured i could help fix mod_auth_digest while i was at it. --- mod_auth_digest.c Tue Feb 18 22:25:50 2003 +++ mod_auth_digest.c.new Tue Feb 18 22:36:31 2003 @@ -119,6 +119,7 @@ #include "apr_shm.h" #include "apr_rmm.h" #include "ap_provider.h" +#include "apr_file_io.h" /* for apr_file_mktemp */ #include "mod_auth.h" @@ -222,8 +223,8 @@ static apr_time_t *otn_counter; /* one-time-nonce counter */ static apr_global_mutex_t *client_lock = NULL; static apr_global_mutex_t *opaque_lock = NULL; -static char client_lock_name[L_tmpnam]; -static char opaque_lock_name[L_tmpnam]; +static char *client_lock_name; +static char *opaque_lock_name; #define DEF_SHMEM_SIZE 1000L /* ~ 12 entries */ #define DEF_NUM_BUCKETS 15L @@ -304,10 +305,17 @@ { unsigned long idx; apr_status_t sts; + apr_file_t *tmpfile; + char *shm_create_name; - /* set up client list */ + sts = apr_file_mktemp(&tmpfile, shm_create_name, 0, ctx); + if (sts != APR_SUCCESS) { + log_error_and_cleanup("failed to allocate temp file for shared memory segments", sts, s); + return; + } - sts = apr_shm_create(&client_shm, shmem_size, tmpnam(NULL), ctx); + /* set up client list */ + sts = apr_shm_create(&client_shm, shmem_size, shm_create_name, ctx); if (sts != APR_SUCCESS) { log_error_and_cleanup("failed to create shared memory segments", sts, s); return; @@ -326,9 +334,12 @@ client_list->tbl_len = num_buckets; client_list->num_entries = 0; - tmpnam(client_lock_name); - /* FIXME: get the client_lock_name from a directive so we're portable - * to non-process-inheriting operating systems, like Win32. */ + sts = apr_file_mktemp(&tmpfile, client_lock_name, 0, ctx); + if (sts != APR_SUCCESS) { + log_error_and_cleanup("failed to allocate temp file for client locking", sts, s); + return; + } + sts = apr_global_mutex_create(&client_lock, client_lock_name, APR_LOCK_DEFAULT, ctx); if (sts != APR_SUCCESS) { @@ -346,9 +357,11 @@ } *opaque_cntr = 1UL; - tmpnam(opaque_lock_name); - /* FIXME: get the opaque_lock_name from a directive so we're portable - * to non-process-inheriting operating systems, like Win32. */ + sts = apr_file_mktemp(&tmpfile, opaque_lock_name, 0, ctx); + if(sts != APR_SUCCESS) { + log_error_and_cleanup("failed to allocate temp file for global locking", sts, s); + return; + } sts = apr_global_mutex_create(&opaque_lock, opaque_lock_name, APR_LOCK_DEFAULT, ctx); if (sts != APR_SUCCESS) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
