[dovecot-cvs] dovecot/src/auth passdb-pam.c,1.37.2.1,1.37.2.2

cras at dovecot.org cras at dovecot.org
Sun Jun 11 21:14:36 EEST 2006


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

Modified Files:
      Tag: branch_1_0
	passdb-pam.c 
Log Message:
Don't call pam_setcred() unless setcred=yes PAM passdb argument was given.



Index: passdb-pam.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-pam.c,v
retrieving revision 1.37.2.1
retrieving revision 1.37.2.2
diff -u -d -r1.37.2.1 -r1.37.2.2
--- passdb-pam.c	11 Jun 2006 12:51:36 -0000	1.37.2.1
+++ passdb-pam.c	11 Jun 2006 18:14:34 -0000	1.37.2.2
@@ -61,7 +61,7 @@
 struct pam_passdb_module {
 	struct passdb_module module;
 
-	bool pam_session;
+	bool pam_setcred, pam_session;
 	const char *service_name, *pam_cache_key;
 	struct timeout *to_wait;
 };
@@ -187,10 +187,13 @@
 	}
 
 #ifdef HAVE_PAM_SETCRED
-	if ((status = pam_setcred(pamh, PAM_ESTABLISH_CRED)) != PAM_SUCCESS) {
-		*error = t_strdup_printf("pam_setcred() failed: %s",
-					 pam_strerror(pamh, status));
-		return status;
+	if (module->pam_setcred) {
+		if ((status = pam_setcred(pamh, PAM_ESTABLISH_CRED)) !=
+		    PAM_SUCCESS) {
+			*error = t_strdup_printf("pam_setcred() failed: %s",
+						 pam_strerror(pamh, status));
+			return status;
+		}
 	}
 #endif
 
@@ -443,6 +446,8 @@
 		if (strcmp(t_args[i], "-session") == 0 ||
 		    strcmp(t_args[i], "session=yes") == 0)
 			module->pam_session = TRUE;
+		else if (strcmp(t_args[i], "setcred=yes") == 0)
+			module->pam_setcred = TRUE;
 		else if (strncmp(t_args[i], "cache_key=", 10) == 0) {
 			module->module.cache_key =
 				p_strdup(auth_passdb->auth->pool,



More information about the dovecot-cvs mailing list