Patch for mod_authn_dbd plaintext auth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux