Adds support for salted MD5 passwords (username+password concatenated) like in pg_shadow-table. Auth_PG_encrypted ON Auth_PG_hash_type MD5PGSQL --- libapache2-mod-auth-pgsql-2.0.3-orig/mod_auth_pgsql.c 2006-01-05 15:15:13.000000000 +0100 +++ libapache2-mod-auth-pgsql-2.0.3/mod_auth_pgsql.c 2010-02-14 18:28:11.000000000 +0100 @@ -142,6 +142,7 @@ #define AUTH_PG_HASH_TYPE_CRYPT 1 #define AUTH_PG_HASH_TYPE_MD5 2 #define AUTH_PG_HASH_TYPE_BASE64 3 +#define AUTH_PG_HASH_TYPE_MD5PGSQL 4 typedef struct { @@ -268,6 +269,8 @@ if (!strcasecmp(hash_type, "MD5")) sec->auth_pg_hash_type = AUTH_PG_HASH_TYPE_MD5; + else if (!strcasecmp(hash_type, "MD5PGSQL")) + sec->auth_pg_hash_type = AUTH_PG_HASH_TYPE_MD5PGSQL; else if (!strcasecmp(hash_type, "CRYPT")) sec->auth_pg_hash_type = AUTH_PG_HASH_TYPE_CRYPT; else if (!strcasecmp(hash_type, "BASE64")) @@ -753,6 +756,7 @@ char *sent_pw, *real_pw; int res; char *user; + char bss[MAX_STRING_LEN]; if ((res = ap_get_basic_auth_pw(r, (const char **) &sent_pw))) return res; @@ -837,6 +841,13 @@ case AUTH_PG_HASH_TYPE_MD5: sent_pw = auth_pg_md5(sent_pw); break; + case AUTH_PG_HASH_TYPE_MD5PGSQL: + bss[0] = '\0'; + apr_snprintf(bss, MAX_STRING_LEN, "%s%s",sent_pw,user); + sent_pw = bss; + sent_pw = auth_pg_md5(bss); + sec->auth_pg_hash_type=AUTH_PG_HASH_TYPE_MD5PGSQL; + break; case AUTH_PG_HASH_TYPE_CRYPT: sent_pw = (char *) crypt(sent_pw, real_pw); break;