changeset 5631:139416ee311e HEAD

If wanted scheme is "" (userdb static lookup), switch it to the actual scheme we got. This should make caching work right for those lookups.
author Timo Sirainen <tss@iki.fi>
date Wed, 16 May 2007 23:38:58 +0300
parents 3e711b998274
children 2ed5abe3aaef
files src/auth/passdb.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/passdb.c	Wed May 16 21:50:16 2007 +0300
+++ b/src/auth/passdb.c	Wed May 16 23:38:58 2007 +0300
@@ -61,13 +61,6 @@
 	const char *plaintext;
 	int ret;
 
-	if (*wanted_scheme == '\0') {
-		/* anything goes */
-		*credentials_r = (const unsigned char *)input;
-		*size_r = strlen(input);
-		return TRUE;
-	}
-
 	ret = password_decode(input, input_scheme, credentials_r, size_r);
 	if (ret <= 0) {
 		if (ret < 0) {
@@ -81,6 +74,14 @@
 		return FALSE;
 	}
 
+	if (*wanted_scheme == '\0') {
+		/* anything goes. change the credentials_scheme to what we
+		   actually got, so blocking passdbs work. */
+		auth_request->credentials_scheme =
+			p_strdup(auth_request->pool, input_scheme);
+		return TRUE;
+	}
+
 	if (!password_scheme_is_alias(input_scheme, wanted_scheme)) {
 		if (!password_scheme_is_alias(input_scheme, "PLAIN")) {
 			auth_request_log_info(auth_request, "password",