Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > 11fc6b7abe02b90ced1cc403fa95dfc6 > files > 5

apache-mod_auth_mysql-3.0.0-24mdv2010.1.src.rpm


 - http://sourceforge.net/tracker/index.php?func=detail&aid=1335724&group_id=60218&atid=493464

--- mod_auth_mysql.c	2005-06-22 18:17:45.000000000 +0200
+++ mod_auth_mysql.c.oden	2006-04-30 15:12:54.000000000 +0200
@@ -288,6 +288,7 @@
 static short pw_aes(POOL * pool, const char * real_pw, const char * sent_pw, const char * salt);
 #endif
 static short pw_sha1(POOL * pool, const char * real_pw, const char * sent_pw, const char * salt);
+static short pw_apr(POOL * pool, const char * real_pw, const char * sent_pw, const char * salt);
 static short pw_plain(POOL * pool, const char * real_pw, const char * sent_pw, const char * salt);
 
 static char * format_remote_host(request_rec * r, char ** parm);
@@ -318,7 +319,8 @@
 #if _AES
 					   {"aes", SALT_REQUIRED, pw_aes},
 #endif
-					   {"sha1", NO_SALT, pw_sha1}};
+					   {"sha1", NO_SALT, pw_sha1},
+					   {"apr", NO_SALT, pw_apr}};
 typedef struct {		/* User formatting patterns */
   char pattern;			/* Pattern to match */
   char * (*func)(request_rec * r, char ** parm);
@@ -856,6 +858,12 @@
   return  strcasecmp(bin2hex(pool, scrambled_sent_pw, enc_len), real_pw) == 0;
 }
 
+/* checks passwords from htpasswd */
+static short pw_apr(POOL * pool, const char * real_pw, const char * sent_pw, const char * salt) {
+  /* apr_password_validate will do the job */
+  return apr_password_validate(sent_pw, real_pw) == APR_SUCCESS;
+}
+
 /* checks plain text passwords */
 static short pw_plain(POOL * pool, const char * real_pw, const char * sent_pw, const char * salt) {
   return strcmp(real_pw, sent_pw) == 0;