#include "http_request.h"
#include "apr_strings.h"
-typedef struct auth_anon {
+typedef struct anon_auth {
char *password;
- struct auth_anon *next;
-} auth_anon;
+ struct anon_auth *next;
+} anon_auth;
typedef struct {
- auth_anon *auth_anon_passwords;
- int auth_anon_nouserid;
- int auth_anon_logemail;
- int auth_anon_verifyemail;
- int auth_anon_mustemail;
- int auth_anon_authoritative;
+ anon_auth *anon_auth_passwords;
+ int anon_auth_nouserid;
+ int anon_auth_logemail;
+ int anon_auth_verifyemail;
+ int anon_auth_mustemail;
+ int anon_auth_authoritative;
} anon_auth_config_rec;
return NULL; /* no memory... */
/* just to illustrate the defaults really. */
- sec->auth_anon_passwords = NULL;
+ sec->anon_auth_passwords = NULL;
- sec->auth_anon_nouserid = 0;
- sec->auth_anon_logemail = 1;
- sec->auth_anon_verifyemail = 0;
- sec->auth_anon_mustemail = 1;
- sec->auth_anon_authoritative = 0;
+ sec->anon_auth_nouserid = 0;
+ sec->anon_auth_logemail = 1;
+ sec->anon_auth_verifyemail = 0;
+ sec->anon_auth_mustemail = 1;
+ sec->anon_auth_authoritative = 0;
return sec;
}
void *dummy, int arg)
{
anon_auth_config_rec *sec = dummy;
- sec->auth_anon_mustemail = arg;
+ sec->anon_auth_mustemail = arg;
return NULL;
}
void *dummy, int arg)
{
anon_auth_config_rec *sec = dummy;
- sec->auth_anon_nouserid = arg;
+ sec->anon_auth_nouserid = arg;
return NULL;
}
void *dummy, int arg)
{
anon_auth_config_rec *sec = dummy;
- sec->auth_anon_logemail = arg;
+ sec->anon_auth_logemail = arg;
return NULL;
}
void *dummy, int arg)
{
anon_auth_config_rec *sec = dummy;
- sec->auth_anon_verifyemail = arg;
+ sec->anon_auth_verifyemail = arg;
return NULL;
}
static const char *anon_set_authoritative_flag(cmd_parms *cmd,
void *dummy, int arg)
{
anon_auth_config_rec *sec = dummy;
- sec->auth_anon_authoritative = arg;
+ sec->anon_auth_authoritative = arg;
return NULL;
}
void *dummy, const char *arg)
{
anon_auth_config_rec *sec = dummy;
- auth_anon *first;
+ anon_auth *first;
if (!(*arg))
return "Anonymous string cannot be empty, use Anonymous_NoUserId instead";
/* squeeze in a record */
- first = sec->auth_anon_passwords;
+ first = sec->anon_auth_passwords;
- if (!(sec->auth_anon_passwords = apr_palloc(cmd->pool, sizeof(auth_anon))) ||
- !(sec->auth_anon_passwords->password = apr_pstrdup(cmd->pool, arg)))
+ if (!(sec->anon_auth_passwords = apr_palloc(cmd->pool, sizeof(anon_auth))) ||
+ !(sec->anon_auth_passwords->password = apr_pstrdup(cmd->pool, arg)))
return "Failed to claim memory for an anonymous password...";
/* and repair the next */
- sec->auth_anon_passwords->next = first;
+ sec->anon_auth_passwords->next = first;
return NULL;
}
{NULL}
};
-module AP_MODULE_DECLARE_DATA auth_anon_module;
+module AP_MODULE_DECLARE_DATA anon_auth_module;
static int anon_authenticate_basic_user(request_rec *r)
{
anon_auth_config_rec *sec =
(anon_auth_config_rec *) ap_get_module_config(r->per_dir_config,
- &auth_anon_module);
+ &anon_auth_module);
const char *sent_pw;
int res = DECLINED;
return res;
/* Ignore if we are not configured */
- if (!sec->auth_anon_passwords)
+ if (!sec->anon_auth_passwords)
return DECLINED;
/* Do we allow an empty userID and/or is it the magic one
*/
- if ((!(r->user[0])) && (sec->auth_anon_nouserid)) {
+ if ((!(r->user[0])) && (sec->anon_auth_nouserid)) {
res = OK;
}
else {
- auth_anon *p = sec->auth_anon_passwords;
+ anon_auth *p = sec->anon_auth_passwords;
res = DECLINED;
while ((res == DECLINED) && (p != NULL)) {
if (!(strcasecmp(r->user, p->password)))
/* username is OK */
(res == OK)
/* password been filled out ? */
- && ((!sec->auth_anon_mustemail) || strlen(sent_pw))
+ && ((!sec->anon_auth_mustemail) || strlen(sent_pw))
/* does the password look like an email address ? */
- && ((!sec->auth_anon_verifyemail)
+ && ((!sec->anon_auth_verifyemail)
|| ((strpbrk("@", sent_pw) != NULL)
&& (strpbrk(".", sent_pw) != NULL)))) {
- if (sec->auth_anon_logemail && ap_is_initial_req(r)) {
+ if (sec->anon_auth_logemail && ap_is_initial_req(r)) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, r,
"Anonymous: Passwd <%s> Accepted",
sent_pw ? sent_pw : "\'none\'");
return OK;
}
else {
- if (sec->auth_anon_authoritative) {
+ if (sec->anon_auth_authoritative) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, APR_SUCCESS, r,
"Anonymous: Authoritative, Passwd <%s> not accepted",
sent_pw ? sent_pw : "\'none\'");
conn_rec *c = r->connection;
anon_auth_config_rec *sec =
(anon_auth_config_rec *) ap_get_module_config(r->per_dir_config,
- &auth_anon_module);
+ &anon_auth_module);
- if (!sec->auth_anon)
+ if (!sec->anon_auth)
return DECLINED;
- if (strcasecmp(r->connection->user, sec->auth_anon))
+ if (strcasecmp(r->connection->user, sec->anon_auth))
return DECLINED;
return OK;
ap_hook_auth_checker(check_anon_access,NULL,NULL,AP_HOOK_MIDDLE);
}
-module AP_MODULE_DECLARE_DATA auth_anon_module =
+module AP_MODULE_DECLARE_DATA anon_auth_module =
{
STANDARD20_MODULE_STUFF,
create_anon_auth_dir_config,/* dir config creater */
static long num_buckets = DEF_NUM_BUCKETS;
-module AP_MODULE_DECLARE_DATA auth_digest_module;
+module AP_MODULE_DECLARE_DATA digest_auth_module;
/*
* initialization code
resp->raw_request_uri = r->unparsed_uri;
resp->psd_request_uri = &r->parsed_uri;
resp->needed_auth = 0;
- ap_set_module_config(r->request_config, &auth_digest_module, resp);
+ ap_set_module_config(r->request_config, &digest_auth_module, resp);
res = get_digest_rec(r, resp);
resp->client = get_client(resp->opaque_num, r);
while (mainreq->main != NULL) mainreq = mainreq->main;
while (mainreq->prev != NULL) mainreq = mainreq->prev;
resp = (digest_header_rec *) ap_get_module_config(mainreq->request_config,
- &auth_digest_module);
+ &digest_auth_module);
resp->needed_auth = 1;
/* get our conf */
conf = (digest_config_rec *) ap_get_module_config(r->per_dir_config,
- &auth_digest_module);
+ &digest_auth_module);
/* check for existence and syntax of Auth header */
{
const digest_config_rec *conf =
(digest_config_rec *) ap_get_module_config(r->per_dir_config,
- &auth_digest_module);
+ &digest_auth_module);
const char *user = r->user;
int m = r->method_number;
int method_restricted = 0;
note_digest_auth_failure(r, conf,
(digest_header_rec *) ap_get_module_config(r->request_config,
- &auth_digest_module),
+ &digest_auth_module),
0);
return HTTP_UNAUTHORIZED;
}
{
const digest_config_rec *conf =
(digest_config_rec *) ap_get_module_config(r->per_dir_config,
- &auth_digest_module);
+ &digest_auth_module);
digest_header_rec *resp =
(digest_header_rec *) ap_get_module_config(r->request_config,
- &auth_digest_module);
+ &digest_auth_module);
const char *ai = NULL, *digest = NULL, *nextnonce = "";
if (resp == NULL || !resp->needed_auth || conf == NULL)
ap_hook_fixups(add_auth_info, NULL, NULL, AP_HOOK_MIDDLE);
}
-module AP_MODULE_DECLARE_DATA auth_digest_module =
+module AP_MODULE_DECLARE_DATA digest_auth_module =
{
STANDARD20_MODULE_STUFF,
create_digest_dir_config, /* dir config creater */