git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] compat: add a getpass() compatibility function

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
May 19, 2011, 20:12 UTC
Message-ID
<BANLkTimG8E_Riz3rYC9PMw_2-D=Za0Ar6w@mail.gmail.com>
In-Reply-To
<74D1D7FC-A747-4F85-8B1E-7ABFC9DA70A3@gieschke.de>
On Thu, May 19, 2011 at 9:42 PM, Rafael Gieschke <rafael@gieschke.de> wrote:
Show 30 quoted lines
>
> Am 19.05.2011 um 21:19 schrieb Erik Faye-Lund:
>
>> On Thu, May 19, 2011 at 9:16 PM, Rafael Gieschke <rafael@gieschke.de> wrote:
>>>
>>> Am 19.05.2011 um 20:07 schrieb Erik Faye-Lund:
>>>> diff --git a/compat/mingw.h b/compat/mingw.h
>>>> index 62eccd3..e37d557 100644
>>>> --- a/compat/mingw.h
>>>> +++ b/compat/mingw.h
>>>> @@ -48,6 +48,8 @@ typedef int socklen_t;
>>>> #define EAFNOSUPPORT WSAEAFNOSUPPORT
>>>> #define ECONNABORTED WSAECONNABORTED
>>>>
>>>> +#define PASS_MAX 512
>>>> +
>>>
>>> It might be worth to have this in git-compat-util.h, so it can also be used by compat/getpass.c. I'm not sure about the name, however; it's a remote password and MAX_PASS is about local passwords AFAIK. Maybe PASS_MAX_REMOTE or something similiar. Like that, compat/getpass.c could also be used in case MAX_PASS has some insanely low value on a platform.
>>>
>>>
>>
>> PASS_MAX should be defined in limits.h (which is included by
>> git-compat-util.h) on POSIX platforms:
>> http://pubs.opengroup.org/onlinepubs/007908799/xsh/limits.h.html
>>
>> If it turns out it's not on some platforms, perhaps a define-guarded
>> version would make sense in git-compat-util.h instead.
>
> It is defined even on Android :-).
>
Good to hear.
> But I still wonder whether it's the right thing or if you should use it only for local passwords.
>
> If you imagine a platform with MAX_PASS=8, git couldn't connect to an IMAP server with a password of 10 chars on this platform without any proper reason.
>

Well, those platforms would currently fail, since that's the limit on the string returned from getpass. Since that hasn't happened yet, I suspect that this is a very theoretical problem.

If we created our own define we could fix such problems by setting NO_GETPASS and having a reasonable lengthy GIT_MAX_PASS. But let's leave that theoretical fix for when/if it turns out to be real, huh?

Previous: Rafael GieschkeNext: Erik Faye-Lund
Message 10 of 19 in “compat: add a getpass() compatibility function”
  1. compat: add a getpass() compatibility functionRafael Gieschke, May 19, 2011
  2. Erik Faye-LundMay 19, 2011
  3. Junio C HamanoMay 19, 2011
  4. Rafael GieschkeMay 19, 2011
  5. Junio C HamanoMay 19, 2011
  6. Erik Faye-LundMay 19, 2011
  7. Rafael GieschkeMay 19, 2011
  8. Erik Faye-LundMay 19, 2011
  9. Rafael GieschkeMay 19, 2011
  10. Erik Faye-LundMay 19, 2011
  11. Erik Faye-LundMay 19, 2011
  12. Rafael GieschkeMay 20, 2011
  13. Erik Faye-LundMay 20, 2011
  14. Junio C HamanoMay 20, 2011
  15. Erik Faye-LundMay 20, 2011
  16. Erik Faye-LundMay 19, 2011
  17. Jonathan NiederMay 19, 2011
  18. Erik Faye-LundMay 19, 2011
  19. Junio C HamanoMay 19, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.