aboutsummaryrefslogtreecommitdiff
path: root/imap-send.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-12-22 11:27:23 -0800
committerJunio C Hamano <gitster@pobox.com>2011-12-22 11:27:23 -0800
commitded408fd20e2fedb76850c9fa9bbaa26b888aa7c (patch)
treef048693eb0afb979809bee23bd03f3f2dd53564a /imap-send.c
parent200888ef3bbc150cc20b99e0aa039c751c00e07a (diff)
parent34961d30dae69b00a8a5aabd568fb87f376ebb87 (diff)
downloadgit-ded408fd20e2fedb76850c9fa9bbaa26b888aa7c.tar.gz
git-ded408fd20e2fedb76850c9fa9bbaa26b888aa7c.tar.xz
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 'imap-send.c')
-rw-r--r--imap-send.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/imap-send.c b/imap-send.c
index 91763d301..e40125a22 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -25,6 +25,7 @@
#include "cache.h"
#include "exec_cmd.h"
#include "run-command.h"
+#include "prompt.h"
#ifdef NO_OPENSSL
typedef void *SSL;
#else
@@ -1208,13 +1209,10 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
goto bail;
}
if (!srvc->pass) {
- char prompt[80];
- sprintf(prompt, "Password (%s@%s): ", srvc->user, srvc->host);
- arg = git_getpass(prompt);
- if (!arg) {
- perror("getpass");
- exit(1);
- }
+ struct strbuf prompt = STRBUF_INIT;
+ strbuf_addf(&prompt, "Password (%s@%s): ", srvc->user, srvc->host);
+ arg = git_getpass(prompt.buf);
+ strbuf_release(&prompt);
if (!*arg) {
fprintf(stderr, "Skipping account %s@%s, no password\n", srvc->user, srvc->host);
goto bail;