git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: "Jarosław Honkis via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Jarosław Honkis" <yaras6@gmail.com>
Subject: [PATCH 1/1] credential: do not mask the username
Date: Mon, 29 Apr 2019 15:06:11 -0700 (PDT)	[thread overview]
Message-ID: <e459e487d3848ae1b7f37676bd9d2a2f9c967430.1556575570.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.138.git.gitgitgadget@gmail.com>

From: =?UTF-8?q?Jaros=C5=82aw=20Honkis?= <yaras6@gmail.com>

When a user is asked for credentials there is no need to mask the
username, so the PROMPT_ASKPASS flag on calling credential_ask_one for
login is unnecessary.

The `credential_ask_one()` function internally uses `git_prompt()` which
in case it is given the flag PROMPT_ASKPASS uses masked input method
instead of git_terminal_prompt, which does not mask user input.

This fixes https://github.com/git-for-windows/git/issue/675

Signed-off-by: Jarosław Honkis <yaras6@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 credential.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/credential.c b/credential.c
index 62be651b03..e9108a9e8a 100644
--- a/credential.c
+++ b/credential.c
@@ -136,7 +136,9 @@ static void credential_getpass(struct credential *c)
 {
 	if (!c->username)
 		c->username = credential_ask_one("Username", c,
-						 PROMPT_ASKPASS|PROMPT_ECHO);
+						 (getenv("GIT_ASKPASS") ?
+						  PROMPT_ASKPASS : 0) |
+						 PROMPT_ECHO);
 	if (!c->password)
 		c->password = credential_ask_one("Password", c,
 						 PROMPT_ASKPASS);
-- 
gitgitgadget

  reply	other threads:[~2019-04-29 22:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 22:06 [PATCH 0/1] " Johannes Schindelin via GitGitGadget
2019-04-29 22:06 ` Jarosław Honkis via GitGitGadget [this message]
2019-04-29 22:12   ` [PATCH 1/1] " Eric Sunshine
2019-04-29 23:06     ` Johannes Schindelin
2019-04-29 23:40   ` Jeff King
2019-04-30 22:07     ` Johannes Schindelin
2019-04-30 22:21       ` Jeff King
2019-05-03  9:09         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e459e487d3848ae1b7f37676bd9d2a2f9c967430.1556575570.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=yaras6@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).