From: Ben Walton <bwalton@artsci.utoronto.ca>
To: gitster@pobox.com, peff@peff.net, git@vger.kernel.org
Cc: Ben Walton <bwalton@artsci.utoronto.ca>
Subject: [PATCH] Avoid crippled getpass function on Solaris
Date: Sun, 5 Aug 2012 19:17:52 -0400 [thread overview]
Message-ID: <1344208672-20028-1-git-send-email-bwalton@artsci.utoronto.ca> (raw)
On Solaris getpass() returns at most 8 characters which cripples the
credential reading for accounts using longer passwords. The alternate
function getpassphrase() was introduced in SunOS 5.6 and will return
up to 256 characters.
Ensure that git_terminal_prompt uses the more able function when
building on Solaris.
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
Hi Jeff and Junio,
I considered making this minor change a few different ways but settled
on this as it seemed (to my eye) to most closely adhere to the way
other such things were done in the compatibility code. I'm entirely
open to modifying this if it's felt that there is a clearer/cleaner
way to do it.
I'd even considered making the function swap generic enough to be
driven by the build system. That seemed over the top though, given
that most systems either have a decent getpass() or don't use this
code path at all.
I've also briefly dabbled with getting Solaris to simply use the
HAVE_DEV_TTY code path but the terminal echo stuff hasn't worked
nicely for me just yet. (It reads the password with nothing echoed
but then displays the string after reading the newline.) This might
still be a better approach in the future, but for now, having long
password reading capability will still be a benefit to users on this
platform.
Thanks
-Ben
compat/terminal.c | 2 +-
compat/terminal.h | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/compat/terminal.c b/compat/terminal.c
index 6d16c8f..e1ab536 100644
--- a/compat/terminal.c
+++ b/compat/terminal.c
@@ -75,7 +75,7 @@ char *git_terminal_prompt(const char *prompt, int echo)
char *git_terminal_prompt(const char *prompt, int echo)
{
- return getpass(prompt);
+ return GETPASS(prompt);
}
#endif
diff --git a/compat/terminal.h b/compat/terminal.h
index 97db7cd..8d7b3f9 100644
--- a/compat/terminal.h
+++ b/compat/terminal.h
@@ -3,4 +3,13 @@
char *git_terminal_prompt(const char *prompt, int echo);
+/* getpass() returns at most 8 characters on solaris so use
+ getpassphrase() which returns up to 256. */
+# if defined (__SVR4) && defined (__sun) /* solaris */
+#define GETPASS getpassphrase
+#else
+#define GETPASS getpass
+#endif
+
+
#endif /* COMPAT_TERMINAL_H */
--
1.7.10.3
next reply other threads:[~2012-08-05 23:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-05 23:17 Ben Walton [this message]
2012-08-06 1:56 ` [PATCH] Avoid crippled getpass function on Solaris Tay Ray Chuan
2012-08-06 2:41 ` Ben Walton
2012-08-06 1:59 ` Junio C Hamano
2012-08-06 2:35 ` Ben Walton
2012-08-06 19:39 ` Jeff King
2012-08-06 19:57 ` Junio C Hamano
2012-08-06 21:31 ` Ben Walton
2012-08-06 21:34 ` Jeff King
2012-08-06 22:09 ` Ben Walton
2012-08-06 22:31 ` Jeff King
2012-08-06 22:39 ` Ben Walton
2012-08-06 22:42 ` Jeff King
2012-08-06 23:31 ` Ben Walton
2012-08-07 0:01 ` Jeff King
2012-08-06 23:05 ` Andreas Schwab
2012-08-07 0:23 ` Jeff King
2012-08-07 0:35 ` Jeff King
2012-08-07 2:18 ` Tay Ray Chuan
2012-08-07 3:01 ` Ben Walton
2012-08-07 3:07 ` [PATCH] Enable HAVE_DEV_TTY for Solaris Ben Walton
2012-08-07 3:43 ` Junio C Hamano
2012-08-07 4:03 ` Jeff King
2012-08-07 4:10 ` Jeff King
2012-08-07 15:31 ` Ben Walton
2012-08-08 14:13 ` Erik Faye-Lund
2012-08-08 21:05 ` Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344208672-20028-1-git-send-email-bwalton@artsci.utoronto.ca \
--to=bwalton@artsci.utoronto.ca \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).