mod_auth.c revision 0f081398cf0eef8cc7c66a535d450110a92dc8ae
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann/* ====================================================================
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * Copyright (c) 1995-1999 The Apache Group. All rights reserved.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * Redistribution and use in source and binary forms, with or without
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * modification, are permitted provided that the following conditions
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * 1. Redistributions of source code must retain the above copyright
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * notice, this list of conditions and the following disclaimer.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * 2. Redistributions in binary form must reproduce the above copyright
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * notice, this list of conditions and the following disclaimer in
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * the documentation and/or other materials provided with the
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * distribution.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * 3. All advertising materials mentioning features or use of this
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * software must display the following acknowledgment:
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * "This product includes software developed by the Apache Group
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * for use in the Apache HTTP server project (http://www.apache.org/)."
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * 4. The names "Apache Server" and "Apache Group" must not be used to
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * endorse or promote products derived from this software without
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * prior written permission. For written permission, please contact
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * apache@apache.org.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * 5. Products derived from this software may not be called "Apache"
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * nor may "Apache" appear in their names without prior written
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * permission of the Apache Group.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * 6. Redistributions of any form whatsoever must retain the following
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * acknowledgment:
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * "This product includes software developed by the Apache Group
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * for use in the Apache HTTP server project (http://www.apache.org/)."
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * OF THE POSSIBILITY OF SUCH DAMAGE.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * ====================================================================
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * This software consists of voluntary contributions made by many
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * individuals on behalf of the Apache Group and was originally based
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * on public domain software written at the National Center for
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * Supercomputing Applications, University of Illinois, Urbana-Champaign.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * For more information on the Apache Group and the Apache HTTP server
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * project, please see <http://www.apache.org/>.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * http_auth: authentication
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * Adapted to Apache by rst.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * dirkx - Added Authoritative control to allow passing on to lower
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * modules if and only if the user-id is not known to this
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * module. A known user with a faulty or absent password still
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * causes an AuthRequired. The default is 'Authoritative', i.e.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann * no control is passed along.
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmannstatic void *create_auth_dir_config(pool *p, char *d)
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann (auth_config_rec *) ap_pcalloc(p, sizeof(auth_config_rec));
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann sec->auth_pwfile = NULL; /* just to illustrate the default really */
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann sec->auth_grpfile = NULL; /* unless you have a broken HP cc */
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann sec->auth_authoritative = 1; /* keep the fortress secure by default */
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmannstatic const char *set_auth_slot(cmd_parms *cmd, void *offset, char *f, char *t)
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann return ap_pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL);
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann (void *) XtOffsetOf(auth_config_rec, auth_pwfile), OR_AUTHCFG, TAKE12,
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann "text file containing user IDs and passwords"},
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann (void *) XtOffsetOf(auth_config_rec, auth_grpfile), OR_AUTHCFG, TAKE12,
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann "text file containing group names and member user IDs"},
06255d6f76f3f630a9634d745a48910b1ea3e4d3David Herrmann (void *) XtOffsetOf(auth_config_rec, auth_authoritative),
"Set to 'no' to allow access control to be passed along to lower modules if the UserID is not known to this module"},
{NULL}
configfile_t *f;
char l[MAX_STRING_LEN];
const char *rpw, *w;
return NULL;
rpw = l;
ap_cfg_closefile(f);
ap_cfg_closefile(f);
return NULL;
configfile_t *f;
char l[MAX_STRING_LEN];
return NULL;
ll = l;
while (ll[0]) {
ap_cfg_closefile(f);
return grps;
const char *sent_pw;
char *real_pw;
char *invalid_pw;
int res;
return res;
return DECLINED;
return DECLINED;
return AUTH_REQUIRED;
return AUTH_REQUIRED;
return OK;
int m = r->method_number;
int method_restricted = 0;
if (!reqs_arr)
return (OK);
return OK;
return OK;
if (!grpstatus)
return OK;
if (!method_restricted)
return OK;
return DECLINED;
return AUTH_REQUIRED;