You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Randy Terbush <ra...@hyperreal.org> on 1997/09/01 00:23:22 UTC
cvs commit: apachen/src/modules/standard mod_auth_dbm.c
randy 97/08/31 15:23:22
Modified: src/modules/standard mod_auth_dbm.c
Log:
Convert log_*() to aplog_error().
Style changes.
Revision Changes Path
1.28 +34 -29 apachen/src/modules/standard/mod_auth_dbm.c
Index: mod_auth_dbm.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_auth_dbm.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- mod_auth_dbm.c 1997/08/24 16:43:26 1.27
+++ mod_auth_dbm.c 1997/08/31 22:23:20 1.28
@@ -151,7 +151,8 @@
module dbm_auth_module;
-static char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) {
+static char *get_dbm_pw (request_rec *r, char *user, char *auth_dbmpwfile)
+{
DBM *f;
datum d, q;
char *pw = NULL;
@@ -164,15 +165,16 @@
#endif
- if(!(f=dbm_open(auth_dbmpwfile,O_RDONLY,0664))) {
- log_reason ("could not open dbm auth file", auth_dbmpwfile, r);
+ if (!(f=dbm_open(auth_dbmpwfile,O_RDONLY,0664))) {
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+ "could not open dbm auth file: %s", auth_dbmpwfile);
return NULL;
}
d = dbm_fetch(f, q);
if (d.dptr) {
- pw = palloc (r->pool, d.dsize + 1);
+ pw = palloc(r->pool, d.dsize + 1);
strncpy(pw,d.dptr,d.dsize);
pw[d.dsize] = '\0'; /* Terminate the string */
}
@@ -209,36 +211,36 @@
static int dbm_authenticate_basic_user (request_rec *r)
{
dbm_auth_config_rec *sec =
- (dbm_auth_config_rec *)get_module_config (r->per_dir_config,
- &dbm_auth_module);
+ (dbm_auth_config_rec *)get_module_config(r->per_dir_config,
+ &dbm_auth_module);
conn_rec *c = r->connection;
char *sent_pw, *real_pw, *colon_pw;
char errstr[MAX_STRING_LEN];
int res;
- if ((res = get_basic_auth_pw (r, &sent_pw)))
+ if ((res = get_basic_auth_pw(r, &sent_pw)))
return res;
- if(!sec->auth_dbmpwfile)
+ if (!sec->auth_dbmpwfile)
return DECLINED;
if(!(real_pw = get_dbm_pw(r, c->user, sec->auth_dbmpwfile))) {
if (!(sec->auth_dbmauthoritative))
return DECLINED;
ap_snprintf(errstr, sizeof(errstr), "DBM user %s not found", c->user);
- log_reason (errstr, r->filename, r);
- note_basic_auth_failure (r);
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server, "%s: %s", errstr, r->filename);
+ note_basic_auth_failure(r);
return AUTH_REQUIRED;
}
/* Password is up to first : if exists */
colon_pw = strchr(real_pw,':');
if (colon_pw) *colon_pw='\0';
/* anyone know where the prototype for crypt is? */
- if(strcmp(real_pw,(char *)crypt(sent_pw,real_pw))) {
+ if (strcmp(real_pw,(char *)crypt(sent_pw,real_pw))) {
ap_snprintf(errstr, sizeof(errstr),
- "user %s: password mismatch",c->user);
- log_reason (errstr, r->uri, r);
- note_basic_auth_failure (r);
+ "user %s: password mismatch",c->user);
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server, "%s: %s", errstr, r->uri);
+ note_basic_auth_failure(r);
return AUTH_REQUIRED;
}
return OK;
@@ -246,15 +248,16 @@
/* Checking ID */
-static int dbm_check_auth(request_rec *r) {
+static int dbm_check_auth (request_rec *r)
+{
dbm_auth_config_rec *sec =
- (dbm_auth_config_rec *)get_module_config (r->per_dir_config,
- &dbm_auth_module);
+ (dbm_auth_config_rec *)get_module_config(r->per_dir_config,
+ &dbm_auth_module);
char *user = r->connection->user;
int m = r->method_number;
char errstr[MAX_STRING_LEN];
- array_header *reqs_arr = requires (r);
+ array_header *reqs_arr = requires(r);
require_line *reqs = reqs_arr ? (require_line *)reqs_arr->elts : NULL;
register int x;
@@ -264,14 +267,14 @@
if (!sec->auth_dbmgrpfile) return DECLINED;
if (!reqs_arr) return DECLINED;
- for(x=0; x < reqs_arr->nelts; x++) {
+ for (x = 0; x < reqs_arr->nelts; x++) {
if (! (reqs[x].method_mask & (1 << m))) continue;
t = reqs[x].requirement;
w = getword(r->pool, &t, ' ');
- if(!strcmp(w,"group") && sec->auth_dbmgrpfile) {
+ if (!strcmp(w,"group") && sec->auth_dbmgrpfile) {
const char *orig_groups,*groups;
char *v;
@@ -279,25 +282,27 @@
if (!(sec->auth_dbmauthoritative))
return DECLINED;
ap_snprintf(errstr, sizeof(errstr),
- "user %s not in DBM group file %s",
- user, sec->auth_dbmgrpfile);
- log_reason (errstr, r->filename, r);
- note_basic_auth_failure (r);
+ "user %s not in DBM group file %s",
+ user, sec->auth_dbmgrpfile);
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+ "%s: %s", errstr, r->filename);
+ note_basic_auth_failure(r);
return AUTH_REQUIRED;
}
orig_groups = groups;
- while(t[0]) {
+ while (t[0]) {
w = getword(r->pool, &t, ' ');
groups = orig_groups;
- while(groups[0]) {
+ while (groups[0]) {
v = getword(r->pool, &groups,',');
- if(!strcmp(v,w))
+ if (!strcmp(v,w))
return OK;
}
}
ap_snprintf(errstr, sizeof(errstr),
- "user %s not in right group",user);
- log_reason (errstr, r->filename, r);
+ "user %s not in right group", user);
+ aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+ "%s: %s", errstr, r->filename);
note_basic_auth_failure(r);
return AUTH_REQUIRED;
}