summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-12-22 19:27:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-12-22 19:27:23 (GMT)
commitded408fd20e2fedb76850c9fa9bbaa26b888aa7c (patch)
treef048693eb0afb979809bee23bd03f3f2dd53564a /connect.c
parent200888ef3bbc150cc20b99e0aa039c751c00e07a (diff)
parent34961d30dae69b00a8a5aabd568fb87f376ebb87 (diff)
downloadgit-ded408fd20e2fedb76850c9fa9bbaa26b888aa7c.zip
git-ded408fd20e2fedb76850c9fa9bbaa26b888aa7c.tar.gz
git-ded408fd20e2fedb76850c9fa9bbaa26b888aa7c.tar.bz2
Merge branch 'jk/git-prompt'
* jk/git-prompt: contrib: add credential helper for OS X Keychain Makefile: OS X has /dev/tty Makefile: linux has /dev/tty credential: use git_prompt instead of git_getpass prompt: use git_terminal_prompt add generic terminal prompt function refactor git_getpass into generic prompt function move git_getpass to its own source file imap-send: don't check return value of git_getpass imap-send: avoid buffer overflow Conflicts: Makefile
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/connect.c b/connect.c
index c8d0ea5..2ea5c3c 100644
--- a/connect.c
+++ b/connect.c
@@ -608,47 +608,3 @@ int finish_connect(struct child_process *conn)
free(conn);
return code;
}
-
-char *git_getpass(const char *prompt)
-{
- const char *askpass;
- struct child_process pass;
- const char *args[3];
- static struct strbuf buffer = STRBUF_INIT;
-
- askpass = getenv("GIT_ASKPASS");
- if (!askpass)
- askpass = askpass_program;
- if (!askpass)
- askpass = getenv("SSH_ASKPASS");
- if (!askpass || !(*askpass)) {
- char *result = getpass(prompt);
- if (!result)
- die_errno("Could not read password");
- return result;
- }
-
- args[0] = askpass;
- args[1] = prompt;
- args[2] = NULL;
-
- memset(&pass, 0, sizeof(pass));
- pass.argv = args;
- pass.out = -1;
-
- if (start_command(&pass))
- exit(1);
-
- strbuf_reset(&buffer);
- if (strbuf_read(&buffer, pass.out, 20) < 0)
- die("failed to read password from %s\n", askpass);
-
- close(pass.out);
-
- if (finish_command(&pass))
- exit(1);
-
- strbuf_setlen(&buffer, strcspn(buffer.buf, "\r\n"));
-
- return buffer.buf;
-}