[Pkg-wmaker-commits] [wmbiff] 07/14: fix a five-minute old regression test failure where null was returned instead of an empty string for an empty password. not sure it matters, but maybe.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:04:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_17
in repository wmbiff.

commit 663d15b1d3b382f008de75eb164934f0ef202d68
Author: bluehal <bluehal>
Date:   Sun Jul 20 00:52:32 2003 +0000

    fix a five-minute old regression test failure where null was returned instead of an empty string for an empty password.  not sure it matters, but maybe.
---
 wmbiff/passwordMgr.c | 18 +++++++++---------
 wmbiff/test_wmbiff.c |  4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/wmbiff/passwordMgr.c b/wmbiff/passwordMgr.c
index c0bc99a..0c7cdf3 100644
--- a/wmbiff/passwordMgr.c
+++ b/wmbiff/passwordMgr.c
@@ -237,6 +237,8 @@ char *passwordFor(const char *username,
 
 	/* else, try to get it. */
 	if (pc->askpass != NULL) {
+        char *retval;
+
         p->password_len = 32;
 #ifdef HAVE_APPLE_KEYCHAIN
         if(strcmp(pc->askpass, "internal:apple:keychain") == 0) {
@@ -253,15 +255,13 @@ char *passwordFor(const char *username,
 #ifdef HAVE_APPLE_KEYCHAIN
         }
 #endif
-        if(p->password[0] != '\0') {
-            char *retval = strdup(p->password);
-			strcpy(p->user, username);
-			strcpy(p->server, servername);
-			ENFROB(p->password);
-			p->next = pass_list;
-			pass_list = p;
-			return (retval);
-		}
+        retval = strdup(p->password);
+        strcpy(p->user, username);
+        strcpy(p->server, servername);
+        ENFROB(p->password);
+        p->next = pass_list;
+        pass_list = p;
+        return (retval);
 	}
 
 	return (NULL);
diff --git a/wmbiff/test_wmbiff.c b/wmbiff/test_wmbiff.c
index 8430690..56b3d9d 100644
--- a/wmbiff/test_wmbiff.c
+++ b/wmbiff/test_wmbiff.c
@@ -147,8 +147,8 @@ int test_passwordMgr(void) {
 	/* what it's like if ssh-askpass is ok'd with an empty password. */
 	m.askpass = "echo ; #";
 	b = passwordFor("try", "again", &m, 0);
-	if (strcmp(b, "") != 0) {
-		printf("FAILURE: expected '' got '%s'\n", b);
+	if (b == NULL || strcmp(b, "") != 0) {
+		printf("FAILURE: expected '' got '%s'\n", b ? b : "(null)");
 		return(1);
 	}
 	printf("SUCCESS: expected '' got '%s'\n", b);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list