You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Paul Richards <pa...@hyperreal.com> on 1996/11/17 22:40:14 UTC

cvs commit: apache/src http_core.c mod_access.c

paul        96/11/17 13:40:13

  Modified:    src       http_core.c mod_access.c
  Log:
  Implement a saitsfy directive
  Submitted by:	leighg@uwsg.indiana.edu (Leigh Grundhoefer)
  
  Revision  Changes    Path
  1.47      +11 -0     apache/src/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_core.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -C3 -r1.46 -r1.47
  *** http_core.c	1996/11/17 20:31:52	1.46
  --- http_core.c	1996/11/17 21:40:10	1.47
  ***************
  *** 243,248 ****
  --- 243,259 ----
        core_dir_config *conf = 
          (core_dir_config *)get_module_config(r->per_dir_config, &core_module); 
    
  +     if (satisfy_any(r, 0))
  + 	return NULL;
  +     else
  +         return conf->auth_type;
  + }
  + 
  + char *real_auth_type (request_rec *r)
  + {
  +     core_dir_config *conf =
  + 	(core_dir_config *)get_module_config(r->per_dir_config, &core_module);
  + 
        return conf->auth_type;
    }
    
  
  
  
  1.8       +27 -2     apache/src/mod_access.c
  
  Index: mod_access.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_access.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -C3 -r1.7 -r1.8
  *** mod_access.c	1996/10/20 18:03:33	1.7
  --- mod_access.c	1996/11/17 21:40:11	1.8
  ***************
  *** 76,81 ****
  --- 76,82 ----
        int order[METHODS];
        array_header *allows;
        array_header *denys;
  +     char *satisfy;
    } access_dir_conf;
    
    module access_module;
  ***************
  *** 89,98 ****
  --- 90,120 ----
        for (i = 0; i < METHODS; ++i) conf->order[i] = DENY_THEN_ALLOW;
        conf->allows = make_array (p, 1, sizeof (allowdeny));
        conf->denys = make_array (p, 1, sizeof (allowdeny));
  +     conf->satisfy = NULL;
        
        return (void *)conf;
    }
    
  + int satisfy_any (request_rec *r, int reset)
  + {
  +     char *satisfy;
  +     access_dir_conf *conf =
  +       (access_dir_conf *)get_module_config(r->per_dir_config, &access_module);
  + 
  +     if (!(satisfy = conf->satisfy)) 
  + 	return 0;
  +     
  +     if (!strcasecmp(satisfy, "any")) {
  + 	if (reset) strcpy(satisfy, "all");
  + 	return 1;
  +     } else if (!strcasecmp(satisfy, "all"))
  + 	return 0;
  + 
  +     log_error("Invalid satisfy value.", r->server);
  +     return 0;
  + } 
  + 
  + 
    const char *order (cmd_parms *cmd, void *dv, char *arg)
    {
        access_dir_conf *d = (access_dir_conf *)dv;
  ***************
  *** 133,138 ****
  --- 155,161 ----
        "'from' followed by hostnames or IP-address wildcards" },
    { "deny", allow_cmd, NULL, OR_LIMIT, ITERATE2,
        "'from' followed by hostnames or IP-address wildcards" },
  + { "Satisfy", set_string_slot, (void*)XtOffsetOf(access_dir_conf, satisfy), OR_AUTHCFG, TAKE1, NULL },
    {NULL}
    };
    
  ***************
  *** 235,242 ****
        }
    
        if (ret == FORBIDDEN)
  ! 	log_reason ("Client denied by server configuration", r->filename, r);
  ! 
        return ret;
    }
    
  --- 258,267 ----
        }
    
        if (ret == FORBIDDEN)
  ! 	if (satisfy_any(r, 1) && real_auth_type(r))
  ! 	    ret = OK;
  ! 	else 
  ! 	    log_reason ("Client denied by server configuration", r->filename, r);
        return ret;
    }