httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: httpd-2.0/modules/aaa mod_auth_digest.c
Date Thu, 27 Dec 2001 21:36:10 GMT
aaron       01/12/27 13:36:10

  Modified:    .        CHANGES
               modules/aaa mod_auth_digest.c
  Log:
  Two fixes in one:
  
  - No longer calls exit() when the secret fails to initialize, instead
    post_config just returns !OK and lets the server bail out.
  
  - No longer fails on DSOs -- since we load-unload-reload DSOs we lose
    any static memory that was initialized during the first load.
    This patch allows us to simply pass on the first call to post_config,
    and then do the initialization in the second call.
  
  Tested to work on Linux from an IE5.0 client.
  
  Revision  Changes    Path
  1.490     +7 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.489
  retrieving revision 1.490
  diff -u -r1.489 -r1.490
  --- CHANGES	2001/12/27 20:14:49	1.489
  +++ CHANGES	2001/12/27 21:36:09	1.490
  @@ -1,5 +1,12 @@
   Changes with Apache 2.0.30-dev
   
  +  *) Remove the call to exit() from within mod_auth_digest's post_config
  +     phase.  [Aaron Bannert]
  +
  +  *) Fix a problem in mod_auth_digest that could potentially cause
  +     problems with initialized static data on a system that uses DSOs.
  +     [Aaron Bannert]
  +
     *) Fix a segfault in the worker MPM that could happen during
        child process exits.  [Brian Pane, Aaron Bannert]
   
  
  
  
  1.54      +18 -15    httpd-2.0/modules/aaa/mod_auth_digest.c
  
  Index: mod_auth_digest.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_digest.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- mod_auth_digest.c	2001/12/27 19:40:15	1.53
  +++ mod_auth_digest.c	2001/12/27 21:36:10	1.54
  @@ -249,10 +249,7 @@
       unsigned char arr[sizeof(apr_time_t)];
   } time_rec;
   
  -
   static unsigned char secret[SECRET_LEN];
  -static int call_cnt = 0;
  -
   
   /* client-list, opaque, and one-time-nonce stuff */
   
  @@ -302,7 +299,7 @@
       return APR_SUCCESS;
   }
   
  -static void initialize_secret(server_rec *s)
  +static apr_status_t initialize_secret(server_rec *s)
   {
       apr_status_t status;
   
  @@ -315,15 +312,17 @@
   #error APR random number support is missing; you probably need to install the truerand
library.
   #endif
   
  -    if (!(status == APR_SUCCESS)) {
  +    if (status != APR_SUCCESS) {
           char buf[120];
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, 0, s,
                        "Digest: error generating secret: %s", 
                        apr_strerror(status, buf, sizeof(buf)));
  -        exit(1);
  +        return status;
       }
   
       ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, s, "Digest: done");
  +
  +    return APR_SUCCESS;
   }
   
   static void log_error_and_cleanup(char *msg, apr_status_t sts, server_rec *s)
  @@ -409,18 +408,22 @@
   
   
   static int initialize_module(apr_pool_t *p, apr_pool_t *plog,
  -                              apr_pool_t *ptemp, server_rec *s)
  +                             apr_pool_t *ptemp, server_rec *s)
   {
  -    /* keep from doing the init more than once at startup, and delay
  -     * the init until the second round
  -     */
  -    if (++call_cnt < 2) {
  +    void *data;
  +    const char *userdata_key = "auth_digest_init";
  +
  +    /* initialize_module() will be called twice, and if it's a DSO
  +     * then all static data from the first call will be lost. Only
  +     * set up our static data on the second call. */
  +    apr_pool_userdata_get(&data, userdata_key, s->process->pool);
  +    if (!data) {
  +        apr_pool_userdata_setn((const void *)1, userdata_key,
  +                               apr_pool_cleanup_null, s->process->pool);
           return OK;
       }
  -
  -    /* only initialize the secret on startup, not on restarts */
  -    if (call_cnt == 2) {
  -        initialize_secret(s);
  +    if (initialize_secret(s) != APR_SUCCESS) {
  +        return !OK;
       }
   
   #if APR_HAS_SHARED_MEMORY
  
  
  

Mime
View raw message