httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] fix Options merging
Date Fri, 30 Jan 1998 10:24:15 GMT
I'm posting this because I'm out of time to test it completely before
committing... this should fix the problem Ben found:

Options none
<VirtualHost abc>
</VirtualHost>

would result in "Options all" for the vhost. 

But it shouldn't affect anything else -- <Directory>s should still merge
properly, the main server should still have "Options all" as default, etc. 

A similar bug exists for AlloOverride. 

The key to remember is that fixup_virtual_hosts() is going to perform one
merge on the lookup_defaults, and that merge will cause the vhost to get
the main_server's defaults unless it has something else specified.  And
things like: 

Options none
<VirtualHost abc>
Options +indexes
</VirtualHost>

still work. 

Dean

Index: main/http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.151
diff -u -r1.151 http_core.c
--- http_core.c	1998/01/29 20:36:08	1.151
+++ http_core.c	1998/01/30 10:09:16
@@ -112,9 +112,9 @@
     conf->d_is_fnmatch = conf->d ? (is_fnmatch (conf->d) != 0) : 0;
     conf->d_components = conf->d ? count_dirs (conf->d) : 0;
 
-    conf->opts = dir ? OPT_UNSET : OPT_ALL;
+    conf->opts = dir ? OPT_UNSET : OPT_UNSET|OPT_ALL;
     conf->opts_add = conf->opts_remove = OPT_NONE;
-    conf->override = dir ? OR_UNSET : OR_ALL;
+    conf->override = dir ? OR_UNSET : OR_UNSET|OR_ALL;
 
     conf->content_md5 = 2;
 
@@ -158,11 +158,16 @@
     conf->d_components = new->d_components;
     conf->r = new->r;
     
-    if (new->opts != OPT_UNSET) conf->opts = new->opts;
-    if (new->opts_add) conf->opts |= new->opts_add;
-    if (new->opts_remove) conf->opts &= ~(new->opts_remove);
+    if (!(new->opts & OPT_UNSET)) conf->opts = new->opts;
+    if (new->opts_add) {
+	conf->opts |= new->opts_add;
+	conf->opts &= ~OPT_UNSET;
+    }
+    if (new->opts_remove) {
+	conf->opts &= ~(new->opts_remove | OPT_UNSET);
+    }
 
-    if (new->override != OR_UNSET) conf->override = new->override;
+    if (!(new->override & OR_UNSET)) conf->override = new->override;
     if (new->default_type) conf->default_type = new->default_type;
     
     if (new->auth_type) conf->auth_type = new->auth_type;
@@ -692,6 +697,7 @@
 	    d->override = OR_ALL;
 	else 
 	    return pstrcat (cmd->pool, "Illegal override option ", w, NULL);
+	d->override &= ~OR_UNSET;
     }
 
     return NULL;



Mime
View raw message