[dovecot-cvs] dovecot/src/auth auth-request.c, 1.94, 1.95 auth-request.h, 1.35, 1.36 auth-worker-client.c, 1.32, 1.33 db-sql.c, 1.13, 1.14 db-sql.h, 1.5, 1.6 mech-apop.c, 1.25, 1.26 mech-cram-md5.c, 1.26, 1.27 mech-digest-md5.c, 1.44, 1.45 mech-ntlm.c, 1.28, 1.29 mech-otp.c, 1.2, 1.3 mech-rpa.c, 1.29, 1.30 mech-skey.c, 1.2, 1.3 passdb-sql.c, 1.32, 1.33 passdb.c, 1.48, 1.49 passdb.h, 1.38, 1.39 userdb-static.c, 1.24, 1.25

tss at dovecot.org tss at dovecot.org
Sat Mar 31 07:41:58 EEST 2007


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv10389

Modified Files:
	auth-request.c auth-request.h auth-worker-client.c db-sql.c 
	db-sql.h mech-apop.c mech-cram-md5.c mech-digest-md5.c 
	mech-ntlm.c mech-otp.c mech-rpa.c mech-skey.c passdb-sql.c 
	passdb.c passdb.h userdb-static.c 
Log Message:
Reverted accidental commit. This code isn't ready yet.



Index: auth-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- auth-request.c	30 Mar 2007 14:12:46 -0000	1.94
+++ auth-request.c	31 Mar 2007 04:41:55 -0000	1.95
@@ -180,14 +180,6 @@
 	request->mech->auth_continue(request, data, data_size);
 }
 
-void auth_request_reset_passdb_lookup(struct auth_request *request)
-{
-	request->passdb_password = NULL;
-
-	if (request->extra_fields != NULL)
-		auth_stream_reply_reset(request->extra_fields);
-}
-
 static void auth_request_save_cache(struct auth_request *request,
 				    enum passdb_result result)
 {
@@ -208,7 +200,6 @@
 		   return success. */
 		return;
 	case PASSDB_RESULT_INTERNAL_FAILURE:
-	case PASSDB_RESULT_END_OF_LIST:
 		i_unreached();
 	}
 
@@ -345,7 +336,7 @@
 		   *result != PASSDB_RESULT_USER_DISABLED) {
 		/* try next passdb. */
                 request->passdb = request->passdb->next;
-		auth_request_reset_passdb_lookup(request);
+		request->passdb_password = NULL;
 
                 if (*result == PASSDB_RESULT_INTERNAL_FAILURE) {
 			/* remember that we have had an internal failure. at
@@ -353,6 +344,9 @@
 			   successfully login. */
 			request->passdb_internal_failure = TRUE;
 		}
+		if (request->extra_fields != NULL)
+			auth_stream_reply_reset(request->extra_fields);
+
 		return FALSE;
 	} else if (request->passdb_internal_failure) {
 		/* last passdb lookup returned internal failure. it may have
@@ -451,33 +445,27 @@
 	}
 }
 
-static bool
+static void
 auth_request_lookup_credentials_callback_finish(enum passdb_result result,
 						const char *password,
 						struct auth_request *request)
 {
 	if (!auth_request_handle_passdb_callback(&result, request)) {
-		if (result != PASSDB_RESULT_END_OF_LIST) {
-			/* see if we can get more credentials */
-			return FALSE;
-		}
-
 		/* try next passdb */
 		auth_request_lookup_credentials(request, request->credentials,
                 	request->private_callback.lookup_credentials);
-		return TRUE;
 	} else {
 		if (request->auth->verbose_debug_passwords &&
 		    result == PASSDB_RESULT_OK) {
 			auth_request_log_debug(request, "password",
 				"Credentials: %s", password);
 		}
-		return request->private_callback.
+		request->private_callback.
 			lookup_credentials(result, password, request);
 	}
 }
 
-bool auth_request_lookup_credentials_callback(enum passdb_result result,
+void auth_request_lookup_credentials_callback(enum passdb_result result,
 					      const char *password,
 					      struct auth_request *request)
 {
@@ -487,9 +475,7 @@
 
 	request->state = AUTH_REQUEST_STATE_MECH_CONTINUE;
 
-	if (result == PASSDB_RESULT_END_OF_LIST) {
-		/* no more results */
-	} else if (result != PASSDB_RESULT_INTERNAL_FAILURE)
+	if (result != PASSDB_RESULT_INTERNAL_FAILURE)
 		auth_request_save_cache(request, result);
 	else {
 		/* lookup failed. if we're looking here only because the
@@ -508,12 +494,8 @@
 		}
 	}
 
-	if (!auth_request_lookup_credentials_callback_finish(result, password,
-							     request)) {
-		request->state = AUTH_REQUEST_STATE_PASSDB;
-		return FALSE;
-	}
-	return TRUE;
+	auth_request_lookup_credentials_callback_finish(result, password,
+							request);
 }
 
 void auth_request_lookup_credentials(struct auth_request *request,
@@ -552,9 +534,8 @@
 			auth_request_lookup_credentials_callback);
 	} else {
 		/* this passdb doesn't support credentials */
-		bool ret = auth_request_lookup_credentials_callback(
+		auth_request_lookup_credentials_callback(
 			PASSDB_RESULT_SCHEME_NOT_AVAILABLE, NULL, request);
-		i_assert(ret);
 	}
 }
 

Index: auth-request.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- auth-request.h	30 Mar 2007 14:12:46 -0000	1.35
+++ auth-request.h	31 Mar 2007 04:41:55 -0000	1.36
@@ -110,7 +110,6 @@
 			  const unsigned char *data, size_t data_size);
 void auth_request_continue(struct auth_request *request,
 			   const unsigned char *data, size_t data_size);
-void auth_request_reset_passdb_lookup(struct auth_request *request);
 
 void auth_request_verify_plain(struct auth_request *request,
 			       const char *password,
@@ -157,10 +156,9 @@
 
 void auth_request_verify_plain_callback(enum passdb_result result,
 					struct auth_request *request);
-bool auth_request_lookup_credentials_callback(enum passdb_result result,
+void auth_request_lookup_credentials_callback(enum passdb_result result,
 					      const char *credentials,
-					      struct auth_request *request)
-	__attr_warn_unused_result__;
+					      struct auth_request *request);
 void auth_request_set_credentials(struct auth_request *request,
 				  enum passdb_credentials credentials,
 				  const char *data,

Index: auth-worker-client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-worker-client.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- auth-worker-client.c	30 Mar 2007 14:12:46 -0000	1.32
+++ auth-worker-client.c	31 Mar 2007 04:41:55 -0000	1.33
@@ -164,7 +164,7 @@
 		verify_plain(auth_request, password, verify_plain_callback);
 }
 
-static bool
+static void
 lookup_credentials_callback(enum passdb_result result, const char *credentials,
 			    struct auth_request *request)
 {
@@ -195,7 +195,6 @@
 	auth_request_unref(&request);
 	auth_worker_client_check_throttle(client);
 	auth_worker_client_unref(&client);
-	return TRUE;
 }
 
 static void

Index: db-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-sql.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- db-sql.c	31 Mar 2007 04:40:42 -0000	1.13
+++ db-sql.c	31 Mar 2007 04:41:55 -0000	1.14
@@ -22,7 +22,6 @@
 	DEF_STR(user_query),
  	DEF_STR(update_query),
 	DEF_STR(default_pass_scheme),
-	DEF_INT(allow_multiple_rows),
 
 	{ 0, NULL, 0 }
 };
@@ -33,8 +32,7 @@
 	MEMBER(password_query) "SELECT password FROM users WHERE userid = '%u'",
 	MEMBER(user_query) "SELECT home, uid, gid FROM users WHERE userid = '%u'",
 	MEMBER(update_query) "UPDATE users SET password = '%w' WHERE userid = '%u'",
-	MEMBER(default_pass_scheme) "PLAIN-MD5",
-	MEMBER(allow_multiple_rows) FALSE
+	MEMBER(default_pass_scheme) "PLAIN-MD5"
 };
 
 static struct sql_connection *connections = NULL;

Index: db-sql.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-sql.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- db-sql.h	30 Mar 2007 14:12:46 -0000	1.5
+++ db-sql.h	31 Mar 2007 04:41:55 -0000	1.6
@@ -10,8 +10,6 @@
 	const char *user_query;
 	const char *update_query;
 	const char *default_pass_scheme;
-
-	bool allow_multiple_rows;
 };
 
 struct sql_connection {

Index: mech-apop.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-apop.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mech-apop.c	30 Mar 2007 14:12:46 -0000	1.25
+++ mech-apop.c	31 Mar 2007 04:41:55 -0000	1.26
@@ -43,7 +43,7 @@
 	return memcmp(digest, request->digest, 16) == 0;
 }
 
-static bool
+static void
 apop_credentials_callback(enum passdb_result result,
 			  const char *credentials,
 			  struct auth_request *auth_request)
@@ -53,9 +53,10 @@
 
 	switch (result) {
 	case PASSDB_RESULT_OK:
-		if (!verify_credentials(request, credentials))
-			return FALSE;
-		auth_request_success(auth_request, NULL, 0);
+		if (verify_credentials(request, credentials))
+			auth_request_success(auth_request, NULL, 0);
+		else
+			auth_request_fail(auth_request);
 		break;
 	case PASSDB_RESULT_INTERNAL_FAILURE:
 		auth_request_internal_failure(auth_request);
@@ -64,7 +65,6 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
 static void

Index: mech-cram-md5.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-cram-md5.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mech-cram-md5.c	30 Mar 2007 14:12:46 -0000	1.26
+++ mech-cram-md5.c	31 Mar 2007 04:41:55 -0000	1.27
@@ -107,7 +107,7 @@
 	return TRUE;
 }
 
-static bool credentials_callback(enum passdb_result result,
+static void credentials_callback(enum passdb_result result,
 				 const char *credentials,
 				 struct auth_request *auth_request)
 {
@@ -116,11 +116,10 @@
 
 	switch (result) {
 	case PASSDB_RESULT_OK:
-		if (!verify_credentials(request, credentials)) {
-			/* see if we have more credentials */
-			return FALSE;
-		}
-		auth_request_success(auth_request, NULL, 0);
+		if (verify_credentials(request, credentials))
+			auth_request_success(auth_request, NULL, 0);
+		else
+			auth_request_fail(auth_request);
 		break;
 	case PASSDB_RESULT_INTERNAL_FAILURE:
 		auth_request_internal_failure(auth_request);
@@ -129,7 +128,6 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
 static void

Index: mech-digest-md5.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-digest-md5.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- mech-digest-md5.c	30 Mar 2007 14:12:46 -0000	1.44
+++ mech-digest-md5.c	31 Mar 2007 04:41:55 -0000	1.45
@@ -518,7 +518,7 @@
 	return !failed;
 }
 
-static bool credentials_callback(enum passdb_result result,
+static void credentials_callback(enum passdb_result result,
 				 const char *credentials,
 				 struct auth_request *auth_request)
 {
@@ -527,8 +527,10 @@
 
 	switch (result) {
 	case PASSDB_RESULT_OK:
-		if (!verify_credentials(request, credentials))
-			return FALSE;
+		if (!verify_credentials(request, credentials)) {
+			auth_request_fail(auth_request);
+			return;
+		}
 
 		request->authenticated = TRUE;
 		auth_request->callback(auth_request,
@@ -543,7 +545,6 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
 static void

Index: mech-ntlm.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-ntlm.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mech-ntlm.c	30 Mar 2007 14:12:46 -0000	1.28
+++ mech-ntlm.c	31 Mar 2007 04:41:55 -0000	1.29
@@ -61,7 +61,7 @@
 	return memcmp(lm_response, client_response, LM_RESPONSE_SIZE) == 0;
 }
 
-static bool
+static void
 lm_credentials_callback(enum passdb_result result,
 			const char *credentials,
 			struct auth_request *auth_request)
@@ -71,10 +71,10 @@
 
 	switch (result) {
 	case PASSDB_RESULT_OK:
-		if (!lm_verify_credentials(request, credentials))
-			return FALSE;
-
-		auth_request_success(auth_request, NULL, 0);
+		if (lm_verify_credentials(request, credentials))
+			auth_request_success(auth_request, NULL, 0);
+		else
+			auth_request_fail(auth_request);
 		break;
 	case PASSDB_RESULT_INTERNAL_FAILURE:
 		auth_request_internal_failure(auth_request);
@@ -83,7 +83,6 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
 static int ntlm_verify_credentials(struct ntlm_auth_request *request,
@@ -146,7 +145,7 @@
 	}
 }
 
-static bool
+static void
 ntlm_credentials_callback(enum passdb_result result,
 			  const char *credentials,
 			  struct auth_request *auth_request)
@@ -160,14 +159,16 @@
 		ret = ntlm_verify_credentials(request, credentials);
 		if (ret > 0) {
 			auth_request_success(auth_request, NULL, 0);
-			return TRUE;
+			return;
+		}
+		if (ret < 0) {
+			auth_request_fail(auth_request);
+			return;
 		}
-		if (ret < 0)
-			return FALSE;
 		break;
 	case PASSDB_RESULT_INTERNAL_FAILURE:
 		auth_request_internal_failure(auth_request);
-		return TRUE;
+		return;
 	default:
 		break;
 	}
@@ -176,7 +177,6 @@
 	   try with LM credentials */
 	auth_request_lookup_credentials(auth_request, PASSDB_CREDENTIALS_LANMAN,
 					lm_credentials_callback);
-	return TRUE;
 }
 
 static void

Index: mech-otp.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-otp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mech-otp.c	30 Mar 2007 14:12:46 -0000	1.2
+++ mech-otp.c	31 Mar 2007 04:41:55 -0000	1.3
@@ -54,7 +54,7 @@
 			       answer, strlen(answer));
 }
 
-static bool
+static void
 skey_credentials_callback(enum passdb_result result,
 			  const char *credentials,
 			  struct auth_request *auth_request)
@@ -70,10 +70,9 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
-static bool
+static void
 otp_credentials_callback(enum passdb_result result,
 			 const char *credentials,
 			 struct auth_request *auth_request)
@@ -92,7 +91,6 @@
 						skey_credentials_callback);
 		break;
 	}
-	return TRUE;
 }
 
 static void

Index: mech-rpa.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-rpa.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mech-rpa.c	30 Mar 2007 14:12:46 -0000	1.29
+++ mech-rpa.c	31 Mar 2007 04:41:55 -0000	1.30
@@ -453,7 +453,7 @@
 	return memcmp(response, request->user_response, 16) == 0;
 }
 
-static bool
+static void
 rpa_credentials_callback(enum passdb_result result,
 			 const char *credentials,
 			 struct auth_request *auth_request)
@@ -466,13 +466,14 @@
 	switch (result) {
 	case PASSDB_RESULT_OK:
 		if (!verify_credentials(request, credentials))
-			return FALSE;
-
-		token4 = mech_rpa_build_token4(request, &token4_size);
-		auth_request->callback(auth_request,
-				       AUTH_CLIENT_RESULT_CONTINUE,
-				       token4, token4_size);
-		request->phase = 2;
+			auth_request_fail(auth_request);
+		else {
+			token4 = mech_rpa_build_token4(request, &token4_size);
+			auth_request->callback(auth_request,
+					       AUTH_CLIENT_RESULT_CONTINUE,
+					       token4, token4_size);
+			request->phase = 2;
+		}
 		break;
 	case PASSDB_RESULT_INTERNAL_FAILURE:
 		auth_request_internal_failure(auth_request);
@@ -481,7 +482,6 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
 static void

Index: mech-skey.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-skey.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mech-skey.c	30 Mar 2007 14:12:46 -0000	1.2
+++ mech-skey.c	31 Mar 2007 04:41:55 -0000	1.3
@@ -60,7 +60,7 @@
 			       answer, strlen(answer));
 }
 
-static bool
+static void
 otp_credentials_callback(enum passdb_result result,
 			 const char *credentials,
 			 struct auth_request *auth_request)
@@ -76,10 +76,9 @@
 		auth_request_fail(auth_request);
 		break;
 	}
-	return TRUE;
 }
 
-static bool
+static void
 skey_credentials_callback(enum passdb_result result,
 			  const char *credentials,
 			  struct auth_request *auth_request)
@@ -98,7 +97,6 @@
 						otp_credentials_callback);
 		break;
 	}
-	return TRUE;
 }
 
 static void

Index: passdb-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-sql.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- passdb-sql.c	30 Mar 2007 14:12:46 -0000	1.32
+++ passdb-sql.c	31 Mar 2007 04:41:55 -0000	1.33
@@ -52,131 +52,76 @@
 	}
 }
 
-static int sql_query_next_row(struct sql_result *result,
-			      struct passdb_sql_request *sql_request)
-{
-	struct auth_request *auth_request = sql_request->auth_request;
-	struct passdb_module *_module = auth_request->passdb->passdb;
-	struct sql_passdb_module *module = (struct sql_passdb_module *)_module;
-	int ret;
-
-	ret = sql_result_next_row(result);
-	if (ret <= 0) {
-		if (ret == 0)
-			return 0;
-
-		auth_request_log_error(auth_request, "sql",
-				       "Password query failed: %s",
-				       sql_result_get_error(result));
-		return -1;
-	}
-
-	sql_query_save_results(result, sql_request);
-
-	/* Note that we really want to check if the password field is
-	   found. Just checking if password is set isn't enough,
-	   because with proxies we might want to return NULL as
-	   password. */
-	if (sql_result_find_field(result, "password") < 0) {
-		auth_request_log_error(auth_request, "sql",
-			"Password query must return a field named 'password'");
-	}
-
-	if (!module->conn->set.allow_multiple_rows) {
-		if (sql_result_next_row(result) > 0) {
-			auth_request_log_error(auth_request, "sql",
-				"Password query returned multiple matches "
-				"and allow_multiple_rows=no");
-			return -1;
-		}
-	}
-	return 1;
-}
-
 static void sql_query_callback(struct sql_result *result,
 			       struct passdb_sql_request *sql_request)
 {
 	struct auth_request *auth_request = sql_request->auth_request;
 	enum passdb_result passdb_result;
 	const char *user, *password, *scheme;
-	unsigned int row;
 	int ret;
-	bool send_last = FALSE;
 
 	passdb_result = PASSDB_RESULT_INTERNAL_FAILURE;
-
 	user = auth_request->user;
-	for (row = 0;; row++) {
-		if (row > 0)
-			auth_request_reset_passdb_lookup(auth_request);
+	password = NULL;
 
-		ret = sql_query_next_row(result, sql_request);
-		if (row > 0 && ret == 0) {
-			/* no more rows. use the last result. */
-			send_last = TRUE;
-			break;
-		}
+	ret = sql_result_next_row(result);
+	if (ret < 0) {
+		auth_request_log_error(auth_request, "sql",
+				       "Password query failed: %s",
+				       sql_result_get_error(result));
+	} else if (ret == 0) {
+		auth_request_log_info(auth_request, "sql", "unknown user");
+		passdb_result = PASSDB_RESULT_USER_UNKNOWN;
+	} else {
+		sql_query_save_results(result, sql_request);
 
-		switch (ret) {
-		case 1:
+		/* Note that we really want to check if the password field is
+		   found. Just checking if password is set isn't enough,
+		   because with proxies we might want to return NULL as
+		   password. */
+		if (sql_result_find_field(result, "password") < 0) {
+			auth_request_log_error(auth_request, "sql",
+				"Password query must return a field named "
+				"'password'");
+		} else if (sql_result_next_row(result) > 0) {
+			auth_request_log_error(auth_request, "sql",
+				"Password query returned multiple matches");
+		} else {
 			/* passdb_password may change on the way,
 			   so we'll need to strdup. */
 			password = t_strdup(auth_request->passdb_password);
 			if (password == NULL)
 				auth_request->no_password = TRUE;
 			passdb_result = PASSDB_RESULT_OK;
-			break;
-		case 0:
-			auth_request_log_info(auth_request, "sql",
-					      "unknown user");
-			passdb_result = PASSDB_RESULT_USER_UNKNOWN;
-			password = NULL;
-			break;
-		default:
-			passdb_result = PASSDB_RESULT_INTERNAL_FAILURE;
-			password = NULL;
-			break;
 		}
+	}
 
-		scheme = password_get_scheme(&password);
-		/* auth_request_set_field() sets scheme */
-		i_assert(password == NULL || scheme != NULL);
-
-		if (auth_request->credentials != -1) {
-			lookup_credentials_callback_t *callback =
-				sql_request->callback.lookup_credentials;
-
-			if (passdb_handle_credentials(passdb_result, password,
-						      scheme, callback,
-						      auth_request))
-				break;
-		} else {
-			/* verify plain */
-			if (password == NULL)
-				break;
-
-			if (auth_request_password_verify(auth_request,
-						auth_request->mech_password,
-						password, scheme, "sql") > 0) {
-				passdb_result = PASSDB_RESULT_OK;
-				break;
-			}
-			passdb_result = PASSDB_RESULT_PASSWORD_MISMATCH;
-		}
+	scheme = password_get_scheme(&password);
+	/* auth_request_set_field() sets scheme */
+	i_assert(password == NULL || scheme != NULL);
 
-		/* see if there's another row */
+	if (auth_request->credentials != -1) {
+		passdb_handle_credentials(passdb_result, password, scheme,
+			sql_request->callback.lookup_credentials,
+			auth_request);
+		auth_request_unref(&auth_request);
+		return;
 	}
 
-	if (auth_request->credentials == -1)
+	/* verify plain */
+	if (password == NULL) {
 		sql_request->callback.verify_plain(passdb_result, auth_request);
-	else if (send_last) {
-		lookup_credentials_callback_t *callback =
-			sql_request->callback.lookup_credentials;
-
-		if (!passdb_handle_credentials(PASSDB_RESULT_END_OF_LIST, NULL,
-					       NULL, callback, auth_request))
-			i_unreached();
+		auth_request_unref(&auth_request);
+		return;
 	}
+
+	ret = auth_request_password_verify(auth_request,
+					   auth_request->mech_password,
+					   password, scheme, "sql");
+
+	sql_request->callback.verify_plain(ret > 0 ? PASSDB_RESULT_OK :
+					   PASSDB_RESULT_PASSWORD_MISMATCH,
+					   auth_request);
 	auth_request_unref(&auth_request);
 }
 

Index: passdb.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- passdb.c	30 Mar 2007 14:12:46 -0000	1.48
+++ passdb.c	31 Mar 2007 04:41:55 -0000	1.49
@@ -118,19 +118,21 @@
 	return password;
 }
 
-bool passdb_handle_credentials(enum passdb_result result,
+void passdb_handle_credentials(enum passdb_result result,
 			       const char *password, const char *scheme,
 			       lookup_credentials_callback_t *callback,
                                struct auth_request *auth_request)
 {
-	if (result != PASSDB_RESULT_OK)
-		return callback(result, NULL, auth_request);
+	if (result != PASSDB_RESULT_OK) {
+		callback(result, NULL, auth_request);
+		return;
+	}
 
 	password = password == NULL ? NULL :
 		passdb_get_credentials(auth_request, password, scheme);
 	if (password == NULL)
 		result = PASSDB_RESULT_SCHEME_NOT_AVAILABLE;
-	return callback(result, password, auth_request);
+	callback(result, password, auth_request);
 }
 
 struct auth_passdb *passdb_preinit(struct auth *auth, const char *driver,

Index: passdb.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- passdb.h	30 Mar 2007 14:12:46 -0000	1.38
+++ passdb.h	31 Mar 2007 04:41:55 -0000	1.39
@@ -27,7 +27,6 @@
 	PASSDB_RESULT_USER_UNKNOWN = -3,
 	PASSDB_RESULT_USER_DISABLED = -4,
 	PASSDB_RESULT_PASS_EXPIRED = -5,
-	PASSDB_RESULT_END_OF_LIST = -6,
 
 	PASSDB_RESULT_PASSWORD_MISMATCH = 0,
 	PASSDB_RESULT_OK = 1
@@ -35,11 +34,7 @@
 
 typedef void verify_plain_callback_t(enum passdb_result result,
 				     struct auth_request *request);
-/* Returns TRUE if successful, FALSE if more credentials are wanted
-   (ie. support for multiple passwords). If FALSE is returned, the caller must
-   call this function again. If there are no more results,
-   result=PASSDB_RESULT_END_OF_LIST */
-typedef bool lookup_credentials_callback_t(enum passdb_result result,
+typedef void lookup_credentials_callback_t(enum passdb_result result,
 					   const char *password,
 					   struct auth_request *request);
 typedef void set_credentials_callback_t(enum passdb_result result,
@@ -85,11 +80,10 @@
 passdb_get_credentials(struct auth_request *auth_request,
 		       const char *password, const char *scheme);
 
-bool passdb_handle_credentials(enum passdb_result result,
+void passdb_handle_credentials(enum passdb_result result,
 			       const char *password, const char *scheme,
 			       lookup_credentials_callback_t *callback,
-			       struct auth_request *auth_request)
-	__attr_warn_unused_result__;
+                               struct auth_request *auth_request);
 
 const char *passdb_credentials_to_str(enum passdb_credentials credentials,
 				      const char *wanted_scheme);

Index: userdb-static.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-static.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- userdb-static.c	30 Mar 2007 14:12:46 -0000	1.24
+++ userdb-static.c	31 Mar 2007 04:41:55 -0000	1.25
@@ -60,7 +60,7 @@
 	t_pop();
 }
 
-static bool
+static void
 static_credentials_callback(enum passdb_result result,
 			    const char *password __attr_unused__,
 			    struct auth_request *auth_request)
@@ -92,7 +92,6 @@
 	}
 
 	i_free(ctx);
-	return TRUE;
 }
 
 static void static_lookup(struct auth_request *auth_request,



More information about the dovecot-cvs mailing list