[PATCH] Add hidden password support for windows platform
Kevin Cernekee
cernekee at gmail.com
Wed Jul 2 12:36:04 PDT 2014
On Wed, Jul 2, 2014 at 12:08 PM, Jason Wessel
<jason.wessel at windriver.com> wrote:
> static void read_stdin(char **string, int hidden)
> {
> char *c = malloc(1025), *ret;
> @@ -417,8 +450,12 @@ static void read_stdin(char **string, int hidden)
> exit(1);
> }
>
> -#ifndef _WIN32
> if (hidden) {
> +#ifdef _WIN32
> + disable_echo();
> + ret = fgets(c, 1025, stdin);
> + restore_echo();
> +#else /* ! _WIN32 */
> struct termios t;
> int fd = fileno(stdin);
>
> @@ -431,8 +468,8 @@ static void read_stdin(char **string, int hidden)
> t.c_lflag |= ECHO;
> tcsetattr(fd, TCSANOW, &t);
> fprintf(stderr, "\n");
> - } else
> #endif
It would be nicer if we could just call {disable,restore}_echo() from
this function without having to worry about WIN32 / !WIN32.
Maybe if enough of these special cases accumulate, we could wind up
with all of the Windows implementations/stubs in windows.c, and the
UNIX/Linux versions in unix.c. That could also capture the
differences in the syslog and --background logic.
David, what do you think?
More information about the openconnect-devel
mailing list