svn commit: samba r21122 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/nsswitch

gd at samba.org gd at samba.org
Fri Feb 2 13:03:06 GMT 2007


Author: gd
Date: 2007-02-02 13:03:06 +0000 (Fri, 02 Feb 2007)
New Revision: 21122

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21122

Log:
Simplify code in pam_winbind a bit.

Guenther

Modified:
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
   branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.c	2007-02-02 12:38:18 UTC (rev 21121)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.c	2007-02-02 13:03:06 UTC (rev 21122)
@@ -1593,20 +1593,19 @@
 		ZERO_STRUCT(response);
 
 		retval = pam_get_user(pamh, &user, "Username: ");
-		if (retval == PAM_SUCCESS) {
-			if (user == NULL) {
-				_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
-				retval = PAM_USER_UNKNOWN;
-				goto out;
-			}
-			if (retval == PAM_SUCCESS) {
-				_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained", user);
-			}
-		} else {
-			_pam_log_debug(pamh, ctrl, LOG_DEBUG, "could not identify user");
+		if (retval) {
+			_pam_log(pamh, ctrl, LOG_ERR, "could not identify user");
 			goto out;
 		}
 
+		if (user == NULL) {
+			_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
+			retval = PAM_USER_UNKNOWN;
+			goto out;
+		}
+
+		_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained", user);
+
 		ccname = pam_getenv(pamh, "KRB5CCNAME");
 		if (ccname == NULL) {
 			_pam_log_debug(pamh, ctrl, LOG_DEBUG, "user has no KRB5CCNAME environment");
@@ -1677,22 +1676,20 @@
 	 * First get the name of a user
 	 */
 	ret = pam_get_user(pamh, &user, "Username: ");
-	if (ret == PAM_SUCCESS) {
-		if (user == NULL) {
-			_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
-			ret = PAM_USER_UNKNOWN;
-			goto out;
-		}
-		if (ret == PAM_SUCCESS) {
-			_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained",
-				 user);
-		}
-	} else {
-		_pam_log_debug(pamh, ctrl, LOG_DEBUG,
+	if (ret) {
+		_pam_log(pamh, ctrl, LOG_ERR,
 			 "password - could not identify user");
 		goto out;
 	}
 
+	if (user == NULL) {
+		_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
+		ret = PAM_USER_UNKNOWN;
+		goto out;
+	}
+
+	_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained", user);
+
 	/* check if this is really a user in winbindd, not only in NSS */
 	ret = valid_user(pamh, ctrl, user);
 	switch (ret) {

Modified: branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c	2007-02-02 12:38:18 UTC (rev 21121)
+++ branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c	2007-02-02 13:03:06 UTC (rev 21122)
@@ -1320,20 +1320,19 @@
 		ZERO_STRUCT(response);
 
 		retval = pam_get_user(pamh, &user, "Username: ");
-		if (retval == PAM_SUCCESS) {
-			if (user == NULL) {
-				_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
-				retval = PAM_USER_UNKNOWN;
-				goto out;
-			}
-			if (retval == PAM_SUCCESS) {
-				_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained", user);
-			}
-		} else {
-			_pam_log_debug(pamh, ctrl, LOG_DEBUG, "could not identify user");
+		if (retval) {
+			_pam_log(pamh, ctrl, LOG_ERR, "could not identify user");
 			goto out;
 		}
 
+		if (user == NULL) {
+			_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
+			retval = PAM_USER_UNKNOWN;
+			goto out;
+		}
+
+		_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained", user);
+
 		ccname = pam_getenv(pamh, "KRB5CCNAME");
 		if (ccname == NULL) {
 			_pam_log_debug(pamh, ctrl, LOG_DEBUG, "user has no KRB5CCNAME environment");
@@ -1401,22 +1400,20 @@
 	 * First get the name of a user
 	 */
 	ret = pam_get_user(pamh, &user, "Username: ");
-	if (ret == PAM_SUCCESS) {
-		if (user == NULL) {
-			_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
-			ret = PAM_USER_UNKNOWN;
-			goto out;
-		}
-		if (ret == PAM_SUCCESS) {
-			_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained",
-				 user);
-		}
-	} else {
-		_pam_log_debug(pamh, ctrl, LOG_DEBUG,
+	if (ret) {
+		_pam_log(pamh, ctrl, LOG_ERR,
 			 "password - could not identify user");
 		goto out;
 	}
 
+	if (user == NULL) {
+		_pam_log(pamh, ctrl, LOG_ERR, "username was NULL!");
+		ret = PAM_USER_UNKNOWN;
+		goto out;
+	}
+
+	_pam_log_debug(pamh, ctrl, LOG_DEBUG, "username [%s] obtained", user);
+
 	/* check if this is really a user in winbindd, not only in NSS */
 	ret = valid_user(pamh, ctrl, user);
 	switch (ret) {



More information about the samba-cvs mailing list