/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_strings.h"
#include "apr_dbm.h"
#include "apr_md5.h"
#include "httpd.h"
#include "http_config.h"
#include "ap_provider.h"
#include "http_core.h"
#include "http_log.h"
#include "http_protocol.h"
#include "http_request.h" /* for ap_hook_(check_user_id | auth_checker)*/
#include "mod_auth.h"
#include "mod_authz_owner.h"
typedef struct {
const char *grpfile;
const char *dbmtype;
/* This should go into APR; perhaps with some nice
*/
{
apr_datum_t d, q;
#ifndef NETSCAPE_DBM_COMPAT
#else
#endif
}
return NULL;
}
{
return conf;
}
{
OR_AUTHCFG, "database file containing group names and member user IDs"),
OR_AUTHCFG, "what type of DBM file the group file is"),
{NULL}
};
/* We do something strange with the group file. If the group file
* contains any : we assume the format is
* key=username value=":"groupname [":"anything here is ignored]
* otherwise we now (0.8.14+) assume that the format is
* key=username value=groupname
* The first allows the password and group files to be the same
* physical DBM file; key=username value=password":"groupname[":"anything]
*
* mark@telescope.org, 22Sep95
*/
const char *dbmgrpfile, const char *dbtype,
const char ** out)
{
apr_dbm_t *f;
APR_OS_DEFAULT, r->pool);
if (retval != APR_SUCCESS) {
return retval;
}
/* Try key2 only if key1 failed */
}
apr_dbm_close(f);
if (grp_colon2) {
*grp_colon2 = '\0';
}
}
else {
}
return retval;
}
const char *require_args,
const void *parsed_require_args)
{
const char *require;
const char *t;
char *w;
const char *groups;
char *v;
if (!user) {
return AUTHZ_DENIED_NO_USER;
}
"No group file was specified in the configuration");
return AUTHZ_DENIED;
}
/* fetch group data from dbm file only once. */
if (!orig_groups) {
if (status != APR_SUCCESS) {
"could not open dbm (type %s) group access "
return AUTHZ_GENERAL_ERROR;
}
/* no groups available, so exit immediately */
"Authorization of user %s to access %s failed, reason: "
"user doesn't appear in DBM group file (%s).",
return AUTHZ_DENIED;
}
}
if (err) {
"authz_dbm authorize: require dbm-group: Can't "
"evaluate require expression: %s", err);
return AUTHZ_DENIED;
}
t = require;
while ((w = ap_getword_white(r->pool, &t)) && w[0]) {
while (groups[0]) {
if (!strcmp(v, w)) {
return AUTHZ_GRANTED;
}
}
}
"Authorization of user %s to access %s failed, reason: "
"user is not part of the 'require'ed group(s).",
return AUTHZ_DENIED;
}
const char *require_args,
const void *parsed_require_args)
{
const char *groups;
char *v;
if (!user) {
return AUTHZ_DENIED_NO_USER;
}
"No group file was specified in the configuration");
return AUTHZ_DENIED;
}
/* fetch group data from dbm file. */
if (status != APR_SUCCESS) {
"could not open dbm (type %s) group access "
return AUTHZ_DENIED;
}
/* no groups available, so exit immediately */
"Authorization of user %s to access %s failed, reason: "
"user doesn't appear in DBM group file (%s).",
return AUTHZ_DENIED;
}
if (filegroup) {
while (groups[0]) {
return AUTHZ_GRANTED;
}
}
}
"Authorization of user %s to access %s failed, reason: "
"user is not part of the 'require'ed group(s).",
return AUTHZ_DENIED;
}
const void **parsed_require_line)
{
if (expr_err)
"Cannot parse expression in require line: ",
return NULL;
}
{
};
{
NULL,
};
static void authz_dbm_getfns(void)
{
}
{
}
{
create_authz_dbm_dir_config, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server config */
authz_dbm_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};