mod_authn_file.c revision 08cb74ca432a8c24e39f17dedce527e6a47b8001
/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* 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.
*/
#include "apr_strings.h"
#include "apr_md5.h" /* for apr_password_validate */
#include "ap_config.h"
#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"
#include "mod_auth.h"
typedef struct {
char *pwfile;
static void *create_authn_file_dir_config(apr_pool_t *p, char *d)
{
return conf;
}
const char *f, const char *t)
{
if (t && strcmp(t, "standard")) {
}
}
static const command_rec authn_file_cmds[] =
{
OR_AUTHCFG, "text file containing user IDs and passwords"),
{NULL}
};
const char *password)
{
ap_configfile_t *f;
char l[MAX_STRING_LEN];
char *file_password = NULL;
if (status != APR_SUCCESS) {
return AUTH_GENERAL_ERROR;
}
while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) {
const char *rpw, *w;
/* Skip # or blank lines. */
if ((l[0] == '#') || (!l[0])) {
continue;
}
rpw = l;
break;
}
}
ap_cfg_closefile(f);
if (!file_password) {
return AUTH_USER_NOT_FOUND;
}
if (status != APR_SUCCESS) {
return AUTH_DENIED;
}
return AUTH_GRANTED;
}
{
ap_configfile_t *f;
char l[MAX_STRING_LEN];
if (status != APR_SUCCESS) {
return AUTH_GENERAL_ERROR;
}
while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) {
const char *rpw, *w, *x;
/* Skip # or blank lines. */
if ((l[0] == '#') || (!l[0])) {
continue;
}
rpw = l;
/* Remember that this is a md5 hash of user:realm:password. */
break;
}
}
ap_cfg_closefile(f);
if (!file_hash) {
return AUTH_USER_NOT_FOUND;
}
return AUTH_USER_FOUND;
}
static const authn_provider authn_file_provider =
{
};
static void register_hooks(apr_pool_t *p)
{
}
{
create_authn_file_dir_config, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server config */
authn_file_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};