[X2Go-Commits] libpam-x2go.git - x2gosession (branch) updated: 0f1fce81e56f13852b79db0ca40879547cb1a6af

X2Go dev team git-admin at x2go.org
Wed Apr 24 18:47:25 CEST 2013


The branch, x2gosession has been updated
       via  0f1fce81e56f13852b79db0ca40879547cb1a6af (commit)
       via  829831debae6d31f199056444739f90b0f9e996d (commit)
      from  c1d37b4bf2191349d7836a4ddfd7b851328e9684 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 src/pam-freerdp.c |   43 +++++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

The diff of changes is:
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 02524fb..4714165 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -50,14 +50,14 @@ get_item (pam_handle_t * pamh, int type)
 	if (type != PAM_TYPE_DOMAIN) {
 		char * value = NULL;
 		if (pam_get_item(pamh, type, (const void **)&value) == PAM_SUCCESS && value != NULL) {
-			return strdup(value);
+			return value;
 		}
 		if (type == PAM_AUTHTOK && global_password != NULL) {
-			return strdup(global_password);
+			return global_password;
 		}
 	} else {
 		if (global_domain != NULL) {
-			return strdup(global_domain);
+			return global_domain;
 		}
 	}
 	/* Now we need to prompt */
@@ -100,13 +100,13 @@ get_item (pam_handle_t * pamh, int type)
 		return NULL;
 	}
 
-	char * retval = responses->resp;
+	char * promptval = responses->resp;
 	free(responses);
 
 	if (type == PAM_RHOST) {
-		char * subloc = strstr(retval, "://");
+		char * subloc = strstr(promptval, "://");
 		if (subloc != NULL) {
-			char * original = retval;
+			char * original = promptval;
 			char * newish = subloc + strlen("://");
 			char * endslash = strstr(newish, "/");
 
@@ -114,19 +114,23 @@ get_item (pam_handle_t * pamh, int type)
 				endslash[0] = '\0';
 			}
 
-			retval = strdup(newish);
+			promptval = strdup(newish);
 			free(original);
 		}
 	}
 
-	if (retval != NULL) { /* Can't believe it really would be at this point, but let's be sure */
+	char * retval = NULL;
+	if (promptval != NULL) { /* Can't believe it really would be at this point, but let's be sure */
 		if (type != PAM_TYPE_DOMAIN) {
-			pam_set_item(pamh, type, (const void *)retval);
+			pam_set_item(pamh, type, (const void *)promptval);
+			/* We're returning the value saved by PAM so we can clear promptval */
+			pam_get_item(pamh, type, (const void **)&retval);
 		} else {
 			if (global_domain != NULL) {
 				free(global_domain);
 			}
-			global_domain = strdup(retval);
+			global_domain = strdup(promptval);
+			retval = global_domain;
 		}
 		if (type == PAM_AUTHTOK) {
 			if (global_password != NULL) {
@@ -134,9 +138,12 @@ get_item (pam_handle_t * pamh, int type)
 				munlock(global_password, strlen(global_password));
 				free(global_password);
 			}
-			global_password = strdup(retval);
+			global_password = strdup(promptval);
 			mlock(global_password, strlen(global_password));
+			retval = global_password;
 		}
+
+		free(promptval);
 	}
 
 	return retval;
@@ -227,14 +234,8 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags, int argc, const char **argv)
 	}
 	}
 
-	/* Free Memory and return our status */
+	/* Return our status */
 done:
-	if (username != NULL) { free(username); }
-	if (password != NULL) { free(password); }
-	if (ruser != NULL)    { free(ruser); }
-	if (rhost != NULL)    { free(rhost); }
-	if (rdomain != NULL)  { free(rdomain); }
-
 	return retval;
 }
 
@@ -365,12 +366,6 @@ pam_sm_open_session (pam_handle_t *pamh, int flags, int argc, const char ** argv
 	free(buffer);
 
 done:
-	if (username != NULL) { free(username); }
-	if (password != NULL) { free(password); }
-	if (ruser != NULL)    { free(ruser); }
-	if (rhost != NULL)    { free(rhost); }
-	if (rdomain != NULL)  { free(rdomain); }
-
     return retval;
 }
 


hooks/post-receive
-- 
libpam-x2go.git (Remote login session via X2Go (PAM module))

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libpam-x2go.git" (Remote login session via X2Go (PAM module)).




More information about the x2go-commits mailing list