Re: crypt support for musl libc

 new new list compose Reply to this message Top page
Attachments:
+ (text/plain)

Delete this message
Author: Celeste
Date:  
To: Kaz Kylheku
CC: txr-users
Subject: Re: crypt support for musl libc
> Let's make the test
>
> (crypt "a" "::") :error


This works alright.

Looking forward to the next version with this fix, so i can give TXR in Alpine Linux a long-awaited upgrade :)



------- Original Message -------
On Monday, September 4th, 2023 at 06:19, Kaz Kylheku <kaz@???> wrote:


> On 2023-09-03 19:58, Celeste wrote:
>
> > Thanks for taking the time to look into this issue, Kaz.
> >
> > The patch, however, does not solve the failing test on musl.
> >
> > (crypt "a" "$") returns "$OGH2VZh3lDE", which is also the output of `mkpasswd -m des -S '*$' a`, in case you want to try it in an Alpine VM.
>
>
> OK, thanks, I have a better idea now.
>
> Let's make the test
>
> (crypt "a" "::") :error
>
> Musl's crypt is actually routing all the unrecognized salt codes to DES.
> There is no $9$ algorithm.
>
> Its DES implementation accepts salts that are invalid in traditional
> crypt; it accepts almost anything.
>
> According to the code, only these characters are disallowed:
> NUL, NL and : (colon):
>
> /*
> * When we choose to "support" invalid salts, nevertheless disallow those
> * containing characters that would violate the passwd file format.
> */
> static inline int ascii_is_unsafe(unsigned char ch)
> {
> return !ch || ch == '\n' || ch == ':';
> }
>
> My motivation is that I would like to have at least one test which elicits
> a null return from crypt due to bad input, in addition to the
> (crypt "a" "b") :error test.