mod_authn_dbm.c revision 78cd48acd325773619d78ac0d7263a99a8922fae
/* Copyright 2002-2004 The Apache Software Foundation
*
* Licensed 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.
*/
/*
* http_auth: authentication
*
* Rob McCool & Brian Behlendorf.
*
* Adapted to Apache by rst.
*
*/
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_strings.h"
#include "apr_dbm.h"
#include "apr_md5.h" /* for apr_password_validate */
#include "ap_provider.h"
#include "httpd.h"
#include "http_config.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"
typedef struct {
char *pwfile;
char *dbmtype;
static void *create_authn_dbm_dir_config(apr_pool_t *p, char *d)
{
return conf;
}
void *dir_config,
const char *arg)
{
return NULL;
}
static const command_rec authn_dbm_cmds[] =
{
OR_AUTHCFG, "dbm database file containing user IDs and passwords"),
NULL,
OR_AUTHCFG, "what type of DBM file the user file is"),
{NULL}
};
{
apr_dbm_t *f;
if (rv != APR_SUCCESS) {
return rv;
}
#ifndef NETSCAPE_DBM_COMPAT
#else
#endif
}
apr_dbm_close(f);
return rv;
}
const char *password)
{
char *dbm_password;
char *colon_pw;
r->pool);
if (rv != APR_SUCCESS) {
"could not open dbm (type %s) auth file: %s",
return AUTH_GENERAL_ERROR;
}
if (!dbm_password) {
return AUTH_USER_NOT_FOUND;
}
if (colon_pw) {
*colon_pw = '\0';
}
if (rv != APR_SUCCESS) {
return AUTH_DENIED;
}
return AUTH_GRANTED;
}
{
char *dbm_hash;
char *colon_hash;
if (rv != APR_SUCCESS) {
"Could not open dbm (type %s) hash file: %s",
return AUTH_GENERAL_ERROR;
}
if (!dbm_hash) {
return AUTH_USER_NOT_FOUND;
}
if (colon_hash) {
*colon_hash = '\0';
}
return AUTH_USER_FOUND;
}
static const authn_provider authn_dbm_provider =
{
};
static void register_hooks(apr_pool_t *p)
{
}
{
create_authn_dbm_dir_config, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server config */
authn_dbm_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};