Re: [PATCH] compat: add a getpass() compatibility function
Am 19.05.2011 um 21:19 schrieb Erik Faye-Lund:
Show 24 quoted lines
> 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 :-).
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.