X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=2ea5c3c0fbedb89e4189d32a455f289398ce106b;hb=828ea97de486c1693d6e4f2c7347acb50235a85d;hp=c8d0ea5d75e89a6b15b62e7057e97947036e11ea;hpb=835fbdb67aa011639e1502e42e831be058ee7e32;p=git.git diff --git a/connect.c b/connect.c index c8d0ea5d7..2ea5c3c0f 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; -}