Hi, On Sun, Mar 28, 2021 at 02:03:37PM +0200, Tõivo Leedjärv wrote: > The specific issue I ran into was getpass() having 8 character limit > on Solaris/illumos.
Ah, thanks for that reminder. That is, indeed, a strong argument (and who knows which other platforms might do this and we don't know about it yet). > If you don't mind the code being guarded by an #ifdef TARGET_SOLARIS > then a simple alternative patch would look something like this: > - char *gp = getpass(prompt); > +#ifndef TARGET_SOLARIS > + char *gp = getpass(prompt); /* On Solaris, returns up to 9 bytes */ > +#else > + char *gp = getpassphrase(prompt); /* Returns up to 257 bytes */ > +#endif No extra #ifdef please - let's go for a v2 of your patch, with the error checking. > > Actually we should catch errors here and log them. If tcsetattr() fails, > > the tty will be in a messed-up state - so we want to know that it happened, > > and possibly also the "why". > > Right. What you have in mind, would that look like msg(M_ERR, > "...explanation...") or perhaps an M_WARN? msg(M_WARN | M_ERRNO, "tcsetattr() failed to restore tty settings") (or some other wording to that extent) should do. (Some parts of the code uses the M_* macros differently, but half of that is due to unclear documentation how they should be used, and lack of stringent commit regime :) ) gert -- "If was one thing all people took for granted, was conviction that if you feed honest figures into a computer, honest figures come out. Never doubted it myself till I met a computer with a sense of humor." Robert A. Heinlein, The Moon is a Harsh Mistress Gert Doering - Munich, Germany g...@greenie.muc.de
signature.asc
Description: PGP signature
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel