Hi,

Thank you both for the review and feedback.

On Sun, Mar 28, 2021 at 10:52 AM Gert Doering <g...@greenie.muc.de> wrote:
>
> On the necessity for the patch, I have mixed feelings - I do not see
> any OS remove getpass() any time soon, as it would break applications...

The specific issue I ran into was getpass() having 8 character limit
on Solaris/illumos.

Still, there is no inherent need to go the way of removing getpass().
There is a workaround for the length limit because Solaris/illumos
have getpassphrase() for which the man page declares "The
getpassphrase() function is identical to getpass(), except that it
reads and returns a string of up to 257 characters in length."

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

or even go one further and do a #define getpass(x) getpassphrase(x)
for TARGET_SOLARIS.

> > > +        (void) tcsetattr(fileno(fp), TCSAFLUSH, &tty_save);
> >
> > We should not need to cast to void - I don't think we have warnings set
> > for non-checked return values.
>
> 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?

-- 
Toivo


_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to