[Dovecot] [PATCH, RFC 10/13] OTP: add need_set_credentials flag

Andrey Panin pazke at donpac.ru
Mon Jun 26 15:58:16 EEST 2006


Add passdb_need_set_credentials flag into mech_module structure to mark
authentication mechanisms which need credentials update to work properly.

diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/auth.c dovecot/src/auth/auth.c
--- dovecot.vanilla/src/auth/auth.c	2006-06-23 13:42:22.123507928 +0400
+++ dovecot/src/auth/auth.c	2006-06-23 13:44:31.606823472 +0400
@@ -143,6 +143,17 @@ static bool auth_passdb_list_have_creden
 	return FALSE;
 }
 
+static int auth_passdb_list_have_set_credentials(struct auth *auth)
+{
+	struct auth_passdb *passdb;
+
+	for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next) {
+		if (passdb->passdb->iface.set_credentials != NULL)
+			return TRUE;
+	}
+	return FALSE;
+}
+
 static void auth_mech_list_verify_passdb(struct auth *auth)
 {
 	struct mech_module_list *list;
@@ -154,6 +165,9 @@ static void auth_mech_list_verify_passdb
 		if (list->module.passdb_need_credentials &&
                     !auth_passdb_list_have_credentials(auth))
 			break;
+ 		if (list->module.passdb_need_set_credentials &&
+ 		    !auth_passdb_list_have_set_credentials(auth))
+ 			break;
 	}
 
 	if (list != NULL) {
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-anonymous.c dovecot/src/auth/mech-anonymous.c
--- dovecot.vanilla/src/auth/mech-anonymous.c	2006-06-23 13:42:22.123507928 +0400
+++ dovecot/src/auth/mech-anonymous.c	2006-06-23 13:44:31.606823472 +0400
@@ -41,6 +41,7 @@ struct mech_module mech_anonymous = {
 
 	MEMBER(passdb_need_plain) FALSE,
 	MEMBER(passdb_need_credentials) FALSE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_anonymous_auth_new,
 	mech_generic_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-apop.c dovecot/src/auth/mech-apop.c
--- dovecot.vanilla/src/auth/mech-apop.c	2006-06-23 13:42:22.123507928 +0400
+++ dovecot/src/auth/mech-apop.c	2006-06-23 13:44:31.607823320 +0400
@@ -156,6 +156,7 @@ const struct mech_module mech_apop = {
 
 	MEMBER(passdb_need_plain) FALSE,
 	MEMBER(passdb_need_credentials) TRUE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_apop_auth_new,
 	mech_apop_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-cram-md5.c dovecot/src/auth/mech-cram-md5.c
--- dovecot.vanilla/src/auth/mech-cram-md5.c	2006-06-23 13:42:22.123507928 +0400
+++ dovecot/src/auth/mech-cram-md5.c	2006-06-23 13:44:31.607823320 +0400
@@ -188,6 +188,7 @@ struct mech_module mech_cram_md5 = {
 
 	MEMBER(passdb_need_plain) FALSE,
 	MEMBER(passdb_need_credentials) TRUE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_cram_md5_auth_new,
 	mech_cram_md5_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-digest-md5.c dovecot/src/auth/mech-digest-md5.c
--- dovecot.vanilla/src/auth/mech-digest-md5.c	2006-06-23 13:42:22.123507928 +0400
+++ dovecot/src/auth/mech-digest-md5.c	2006-06-23 13:44:31.607823320 +0400
@@ -618,6 +618,7 @@ struct mech_module mech_digest_md5 = {
 
 	MEMBER(passdb_need_plain) FALSE,
 	MEMBER(passdb_need_credentials) TRUE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_digest_md5_auth_new,
 	mech_digest_md5_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-gssapi.c dovecot/src/auth/mech-gssapi.c
--- dovecot.vanilla/src/auth/mech-gssapi.c	2006-06-23 13:42:22.124507776 +0400
+++ dovecot/src/auth/mech-gssapi.c	2006-06-23 13:44:31.607823320 +0400
@@ -393,6 +393,7 @@ const struct mech_module mech_gssapi = {
 
 	MEMBER(passdb_need_plain) FALSE, 
 	MEMBER(passdb_need_credentials) FALSE, 
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_gssapi_auth_new,
 	mech_gssapi_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech.h dovecot/src/auth/mech.h
--- dovecot.vanilla/src/auth/mech.h	2006-06-23 13:42:22.124507776 +0400
+++ dovecot/src/auth/mech.h	2006-06-23 13:44:31.608823168 +0400
@@ -26,6 +26,7 @@ struct mech_module {
         enum mech_security_flags flags;
 	unsigned int passdb_need_plain:1;
 	unsigned int passdb_need_credentials:1;
+	unsigned int passdb_need_set_credentials:1;
 
 	struct auth_request *(*auth_new)(void);
 	void (*auth_initial)(struct auth_request *request,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-login.c dovecot/src/auth/mech-login.c
--- dovecot.vanilla/src/auth/mech-login.c	2006-06-23 13:42:22.124507776 +0400
+++ dovecot/src/auth/mech-login.c	2006-06-23 13:44:31.608823168 +0400
@@ -84,6 +84,7 @@ const struct mech_module mech_login = {
 
 	MEMBER(passdb_need_plain) TRUE,
 	MEMBER(passdb_need_credentials) FALSE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_login_auth_new,
 	mech_login_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-ntlm.c dovecot/src/auth/mech-ntlm.c
--- dovecot.vanilla/src/auth/mech-ntlm.c	2006-06-23 13:42:22.124507776 +0400
+++ dovecot/src/auth/mech-ntlm.c	2006-06-23 13:44:31.608823168 +0400
@@ -262,6 +262,7 @@ const struct mech_module mech_ntlm = {
 
 	MEMBER(passdb_need_plain) FALSE,
 	MEMBER(passdb_need_credentials) TRUE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_ntlm_auth_new,
 	mech_generic_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-plain.c dovecot/src/auth/mech-plain.c
--- dovecot.vanilla/src/auth/mech-plain.c	2006-06-23 13:42:22.124507776 +0400
+++ dovecot/src/auth/mech-plain.c	2006-06-23 13:44:31.608823168 +0400
@@ -91,6 +91,7 @@ struct mech_module mech_plain = {
 
 	MEMBER(passdb_need_plain) TRUE,
 	MEMBER(passdb_need_credentials) FALSE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_plain_auth_new,
 	mech_generic_auth_initial,
diff -urdpNX /usr/share/dontdiff -x Makefile dovecot.vanilla/src/auth/mech-rpa.c dovecot/src/auth/mech-rpa.c
--- dovecot.vanilla/src/auth/mech-rpa.c	2006-06-23 13:42:22.124507776 +0400
+++ dovecot/src/auth/mech-rpa.c	2006-06-23 13:44:31.608823168 +0400
@@ -601,6 +601,7 @@ const struct mech_module mech_rpa = {
 
 	MEMBER(passdb_need_plain) FALSE,
 	MEMBER(passdb_need_credentials) TRUE,
+	MEMBER(passdb_need_set_credentials) FALSE,
 
 	mech_rpa_auth_new,
 	mech_generic_auth_initial,



More information about the dovecot mailing list