Received: (from majordom@localhost) by hyperreal.org (8.8.5/8.8.5) id PAA17804; Fri, 12 Sep 1997 15:55:51 -0700 (PDT) Received: (from akosut@localhost) by hyperreal.org (8.8.5/8.8.5) id PAA17728 for apache-cvs; Fri, 12 Sep 1997 15:55:29 -0700 (PDT) Date: Fri, 12 Sep 1997 15:55:29 -0700 (PDT) From: Alexei Kosut Message-Id: <199709122255.PAA17728@hyperreal.org> To: apache-cvs@hyperreal.org Subject: cvs commit: apachen/src/main http_config.c Sender: apache-cvs-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org akosut 97/09/12 15:55:17 Modified: src/main http_config.c Log: Have create_empty_config() create DYNAMIC_MODULE_LIMIT more vector space than it needs, in case you put LoadModule after a or in a config file. Also have add_module() complain and exit if you try and load more than DYNAMIC_MODULE_LIMIT module. Revision Changes Path 1.79 +20 -3 apachen/src/main/http_config.c Index: http_config.c =================================================================== RCS file: /export/home/cvs/apachen/src/main/http_config.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -u -r1.78 -r1.79 --- http_config.c 1997/08/31 21:28:49 1.78 +++ http_config.c 1997/09/12 22:55:15 1.79 @@ -83,8 +83,15 @@ * of modules which control just about all of the server operation. */ -/* total_modules is the number of modules linked in. */ +/* total_modules is the number of modules that have been linked + * into the server. + */ static int total_modules = 0; +/* dynamic_modules is the number of modules that have been added + * after the pre-linked ones have been set up. It shouldn't be larger + * than DYNAMIC_MODULE_LIMIT. + */ +static int dynamic_modules = 0; module *top_module = NULL; typedef int (*handler_func)(request_rec *); @@ -117,7 +124,8 @@ void * create_empty_config (pool *p) { - void **conf_vector = (void **)pcalloc(p, sizeof(void*) * total_modules); + void **conf_vector = (void **)pcalloc(p, sizeof(void*) * + (total_modules+DYNAMIC_MODULE_LIMIT)); return (void *)conf_vector; } @@ -472,8 +480,17 @@ } if (m->module_index == -1) { m->module_index = total_modules++; + dynamic_modules++; + + if (dynamic_modules > DYNAMIC_MODULE_LIMIT) { + fprintf(stderr, "httpd: module \"%s\" could not be loaded, because" + " the dynamic\n", m->name); + fprintf(stderr, "module limit was reached. Please increase " + "DYNAMIC_MODULE_LIMIT and recompile.\n"); + exit(1); + } } - + /* Some C compilers put a complete path into __FILE__, but we want * only the filename (e.g. mod_includes.c). So check for path * components (Unix and DOS), and remove them.