httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_config.c http_main.c
Date Thu, 23 Mar 2000 14:48:45 GMT
ake         00/03/23 06:48:45

  Modified:    src      CHANGES
               src/ap   ap_hooks.c
               src/include http_config.h
               src/main http_config.c http_main.c
  Log:
  Clear hook registrations between reads of the config file.
  When DSOs are unloaded and re-loaded the old hook pointers may
  no longer be valid. This fix eliminates potential segfaults.
  
  Revision  Changes    Path
  1.42      +4 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- CHANGES	2000/03/23 14:41:29	1.41
  +++ CHANGES	2000/03/23 14:48:44	1.42
  @@ -1,4 +1,8 @@
   Changes with Apache 2.0a2-dev
  +  *) Clear hook registrations between reads of the config file.
  +     When DSOs are unloaded and re-loaded the old hook pointers may
  +     no longer be valid. This fix eliminates potential segfaults.
  +     [Allan Edwards <ake@raleigh.ibm.com>]
   
     *) Fix a problem with Sigfunc not being defined or bypassed
        if sigaction() wasn't found. [Jim Jagielski]
  
  
  
  1.11      +12 -1     apache-2.0/src/ap/ap_hooks.c
  
  Index: ap_hooks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_hooks.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ap_hooks.c	2000/01/28 18:00:33	1.10
  +++ ap_hooks.c	2000/03/23 14:48:44	1.11
  @@ -42,7 +42,7 @@
       qsort(pItems,nItems,sizeof *pItems,crude_order);
       for(n=0 ; n < nItems ; ++n) {
   	pData[n].nPredecessors=0;
  -	pData[n].ppPredecessors=ap_palloc(p,nItems*sizeof *pData[n].ppPredecessors);
  +	pData[n].ppPredecessors=ap_pcalloc(p,nItems*sizeof *pData[n].ppPredecessors);
   	pData[n].pNext=NULL;
   	pData[n].pData=&pItems[n];
       }
  @@ -165,6 +165,17 @@
   	HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
   	*pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
       }
  +}
  +    
  +void ap_hook_deregister_all(void)
  +{
  +    int n;    
  +
  +    for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
  +        HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
  +        *pEntry->paHooks=NULL;
  +    }
  +    s_aHooksToSort=NULL;
   }
   
   void ap_show_hook(const char *szName,const char * const *aszPre,
  
  
  
  1.8       +2 -0      apache-2.0/src/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/http_config.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- http_config.h	2000/03/10 00:05:50	1.7
  +++ http_config.h	2000/03/23 14:48:45	1.8
  @@ -329,6 +329,8 @@
   server_rec *ap_read_config(process_rec *process, ap_context_t *temp_pool, const char *config_name);
   void ap_post_config_hook(ap_context_t *pconf, ap_context_t *plog, ap_context_t *ptemp,
server_rec *s);
   void ap_child_init_hook(ap_context_t *pchild, server_rec *s);
  +void ap_register_hooks(module *m);
  +void ap_hook_deregister_all(void);
   
   /* For http_request.c... */
   
  
  
  
  1.29      +2 -2      apache-2.0/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- http_config.c	2000/03/15 23:18:31	1.28
  +++ http_config.c	2000/03/23 14:48:45	1.29
  @@ -360,7 +360,7 @@
   int g_bDebugHooks;
   const char *g_szCurrentHookName;
   
  -static void register_hooks(module *m)
  +void ap_register_hooks(module *m)
       {
       if(m->register_hooks)
   	{
  @@ -430,7 +430,7 @@
   #endif /*_OSD_POSIX*/
   
       /* FIXME: is this the right place to call this? */
  -    register_hooks(m);
  +    ap_register_hooks(m);
   }
   
   /* 
  
  
  
  1.36      +6 -1      apache-2.0/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_main.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- http_main.c	2000/03/22 10:26:44	1.35
  +++ http_main.c	2000/03/23 14:48:45	1.36
  @@ -296,6 +296,7 @@
       ap_context_t *plog; /* Pool of log streams, reset _after_ each read of conf */
       ap_context_t *ptemp; /* Pool for temporary config stuff, reset often */
       ap_context_t *pcommands; /* Pool for -C and -c switches */
  +    module **mod;
   
       ap_initialize();
       process = create_process(argc, (const char **)argv);
  @@ -305,7 +306,7 @@
       
       ap_util_uri_init();
   
  -    g_pHookPool=pglobal;
  +    g_pHookPool=pconf;
   
       ap_setup_prelinked_modules(process);
   
  @@ -375,7 +376,11 @@
       ap_destroy_pool(ptemp);
   
       for (;;) {
  +	ap_hook_deregister_all();
   	ap_clear_pool(pconf);
  +	for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
  +		ap_register_hooks(*mod);
  +	}
   	ap_create_context(&ptemp, pconf);
   	ap_server_root = def_server_root;
   	ap_run_pre_config(pconf, plog, ptemp);
  
  
  

Mime
View raw message