httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject [PATCH] IncludeConfig
Date Sat, 02 Aug 1997 15:38:27 GMT

Would be nice to see a directive such as this make it into 1.3. I 
don't remember us every actually voting on some of the options. 
Below again is the one that I have been using for some time. This 
probably won't apply well to current 1.3, but I'll deal with that 
if we decide to commit.

Should the directive change to just "Include"?


------- Forwarded Message

Date: Thu, 17 Jul 1997 11:17:10 -0500
From: Randy Terbush <randy@zyzzyva.com>
Sender: new-httpd-owner@apache.org
Precedence: bulk
Reply-To: new-httpd@apache.org

As long as we are considering an IncludeConfig directive, I would 
like to offer mine. This version can be given a file or directory. 
If given a directory, it recurses the directory tree looking for 
.htaccess. My use for it has been similar to Martijn's. I created 
it when tossing around the idea of having a parallel "registry" 
that could be given a perl script to edit access control for 
certain parts of the existing web space. Making Apache read the 
registry to get it's config and access control info.

I've been running this since the days of 1.1. Never had a problem 
with the recursion of directories, and it offers a very nifty 
possibilty for access control to configuration files.


Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.96
diff -c -r1.96 http_core.c
*** http_core.c	1997/07/16 00:41:21	1.96
--- http_core.c	1997/07/17 16:15:40
***************
*** 836,841 ****
--- 836,873 ----
      return errmsg;
  }
  
+ const char *include_config (cmd_parms *cmd, void *dummy, char *name)
+ {
+     char *nname;
+     DIR *vdir;
+     struct DIR_TYPE *vdir_entry;
+     core_server_config *conf;
+ 
+     
+     conf = get_module_config(cmd->server->module_config, &core_module);
+ 
+     name = server_root_relative(cmd->pool, name);
+     
+     if ((vdir = opendir(name)) != NULL) {
+ 	while ((vdir_entry = readdir(vdir)) != NULL) {
+ 	    if ((strcmp(vdir_entry->d_name, "..")) <= 0)
+ 		continue;
+ 
+ 	    nname = pstrcat(cmd->pool, name, vdir_entry->d_name, NULL);
+ 
+ 	    if (is_directory(nname))
+ 		nname = pstrcat(cmd->pool, nname, "/", NULL);
+ 
+ 	    include_config(cmd, dummy, nname);
+ 	}
+ 	closedir(vdir);
+     }
+     else if ((strstr(name, conf->access_name)) != NULL)
+ 	process_resource_config(cmd->server, name, cmd->pool, cmd->temp_pool);
+ 
+     return NULL;
+ }
+ 
  const char *add_module_command (cmd_parms *cmd, void *dummy, char *arg)
  {
      if (add_named_module (arg))
***************
*** 1314,1319 ****
--- 1346,1352 ----
  { "Listen", set_listener, NULL, RSRC_CONF, TAKE1,
        "a port number or a numeric IP address and a port number"},
  { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "send buffer size in bytes"},
+ { "IncludeConf", include_config, NULL, RSRC_CONF, RAW_ARGS, "configuration resource" },
  { "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE,
    "the name of a module" },
  { "ClearModuleList", clear_module_list_command, NULL, RSRC_CONF, NO_ARGS, NULL },


------- End of Forwarded Message



Mime
View raw message