Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 32123 invoked from network); 9 Jun 2007 05:42:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jun 2007 05:42:45 -0000 Received: (qmail 10288 invoked by uid 500); 9 Jun 2007 05:42:36 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 9336 invoked by uid 500); 9 Jun 2007 05:42:34 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 9288 invoked by uid 99); 9 Jun 2007 05:42:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2007 22:42:34 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of markc@renta.net designates 203.25.238.7 as permitted sender) Received: from [203.25.238.7] (HELO mail.renta.net) (203.25.238.7) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2007 22:42:30 -0700 Received: from aria.lan (60-240-81-28-nsw-pppoe.tpgi.com.au [::ffff:60.240.81.28]) (AUTH: CRAM-MD5 markc@renta.net, SSL: TLSv1/SSLv3,256bits,AES256-SHA) by mail.renta.net with esmtp; Sat, 09 Jun 2007 15:42:08 +1000 id 000479B4.466A3DB0.00005411 From: Mark Constable Organization: http://markc.renta.net To: modules-dev@httpd.apache.org Subject: Patch for mod_authn_dbd plaintext auth Date: Sat, 9 Jun 2007 05:42:06 +0000 User-Agent: KMail/1.9.7 Cc: users@httpd.apache.org, foddrick@foddrick.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706090542.07140.markc@renta.net> X-Virus-Checked: Checked by ClamAV on apache.org I need this, not sure if it's of value to anyone else? --- httpd-2.2.4/modules/aaa/mod_authn_dbd.c.orig 2006-07-12 03:38:44.000000000 +0000 +++ httpd-2.2.4/modules/aaa/mod_authn_dbd.c 2007-06-09 05:35:33.000000000 +0000 @@ -29,6 +29,7 @@ typedef struct { const char *user; const char *realm; + int plaintext; } authn_dbd_conf; typedef struct { const char *label; @@ -51,6 +52,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->plaintext = (add->plaintext == NULL) ? base->plaintext : add->plaintext; return ret; } static const char *authn_dbd_prepare(cmd_parms *cmd, void *cfg, const char *query) @@ -80,6 +82,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("AuthDBDPlaintext", ap_set_flag_slot, + (void *)APR_OFFSETOF(authn_dbd_conf, plaintext), ACCESS_CONF, + "Query used to fetch plaintext passwords"), {NULL} }; static authn_status authn_dbd_password(request_rec *r, const char *user, @@ -134,7 +139,11 @@ return AUTH_USER_NOT_FOUND; } - rv = apr_password_validate(password, dbd_password); + if (conf->plaintext) { + rv = (strcmp(password, dbd_password) == 0) ? APR_SUCCESS : APR_EMISMATCH; + } else { + rv = apr_password_validate(password, dbd_password); + } if (rv != APR_SUCCESS) { return AUTH_DENIED; --markc