Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 04.01.2012 14:34 schrieb Jeff King:
> Wouldn't you also have to drop checking of SSH_ASKPASS in the block
> right before calling git_terminal_prompt (right before the context in
> your patch)?

of course :( Thanks for spotting this...

diff --git a/prompt.c b/prompt.c
index 72ab9de..230ac3c 100644
--- a/prompt.c
+++ b/prompt.c
@@ -45,16 +45,23 @@ char *git_prompt(const char *prompt, int flags)
 		askpass = getenv("GIT_ASKPASS");
 		if (!askpass)
 			askpass = askpass_program;
-		if (!askpass)
-			askpass = getenv("SSH_ASKPASS");
 		if (askpass && *askpass)
 			return do_askpass(askpass, prompt);
 	}

 	r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
-	if (!r)
-		die_errno("could not read '%s'", prompt);
-	return r;
+	if (r)
+		return r;
+
+	if (flags & PROMPT_ASKPASS) {
+		const char *askpass;
+
+		askpass = getenv("SSH_ASKPASS");
+		if (askpass && *askpass)
+			return do_askpass(askpass, prompt);
+	}
+
+	die_errno("could not read '%s'", prompt);
 }

 char *git_getpass(const char *prompt)
-- 
Best regards,
 Sven Strickroth
 ClamAV, a GPL anti-virus toolkit   http://www.clamav.net
 PGP key id F5A9D4C4 @ any key-server
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]