--- mod_authn_dbd.c Fri Apr 21 18:53:06 2006 +++ mod_authn_dbd.c Fri Mar 17 07:43:55 2006 @@ -29,6 +29,7 @@ typedef struct { const char *user; const char *realm; + int plain_text; } authn_dbd_conf; typedef struct { const char *label; @@ -42,6 +43,7 @@ static void *authn_dbd_cr_conf(apr_pool_t *pool, char *dummy) { authn_dbd_conf *ret = apr_pcalloc(pool, sizeof(authn_dbd_conf)); + ret->plain_text = -1; return ret; } static void *authn_dbd_merge_conf(apr_pool_t *pool, void *BASE, void *ADD) @@ -51,6 +53,7 @@ authn_dbd_conf *ret = apr_palloc(pool, sizeof(authn_dbd_conf)); ret->user = (add->user == NULL) ? base->user : add->user; ret->realm = (add->realm == NULL) ? base->realm : add->realm; + ret->plain_text = (add->plain_text == -1) ? base->plain_text : add->plain_text; return ret; } static const char *authn_dbd_prepare(cmd_parms *cmd, void *cfg, const char *query) @@ -80,6 +84,9 @@ AP_INIT_TAKE1("AuthDBDUserRealmQuery", authn_dbd_prepare, (void *)APR_OFFSETOF(authn_dbd_conf, realm), ACCESS_CONF, "Query used to fetch password for user+realm"), + AP_INIT_FLAG("AuthDBDPlainTextPasswords", ap_set_flag_slot, + (void *)APR_OFFSETOF(authn_dbd_conf, plain_text), ACCESS_CONF, + "PlainTextPasswords are used instead of crypt'ed"), {NULL} }; static authn_status authn_dbd_password(request_rec *r, const char *user, @@ -134,7 +141,17 @@ return AUTH_USER_NOT_FOUND; } + if (conf->plain_text != 1) { rv = apr_password_validate(password, dbd_password); + } + else { + if (strcmp(password,dbd_password) == 0) { + rv = APR_SUCCESS; + } + else { + rv = APR_EMISMATCH; + } + } if (rv != APR_SUCCESS) { return AUTH_DENIED;