From 7fffc5d3b41565d7ff43cf582c00cee1bdf76474 Mon Sep 17 00:00:00 2001 From: runge Date: Sat, 26 May 2007 23:22:48 +0000 Subject: x11vnc: in -unixpw, initial Escape means no echo username. --- x11vnc/unixpw.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'x11vnc/unixpw.c') diff --git a/x11vnc/unixpw.c b/x11vnc/unixpw.c index c4a08b9..9390b43 100644 --- a/x11vnc/unixpw.c +++ b/x11vnc/unixpw.c @@ -1126,6 +1126,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) { int x, y, i, rc, nmax = 100; static char user_r[100], user[100], pass[100]; static int u_cnt = 0, p_cnt = 0, first = 1; + static int echo = 1; char keystr[100]; char *str; @@ -1143,6 +1144,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) { in_login = 1; in_passwd = 0; unixpw_denied = 0; + echo = 1; if (init == 1) { tries = 0; } @@ -1209,6 +1211,11 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) { } else if (! down) { return; } + if (in_login && keysym == XK_Escape && u_cnt == 0) { + echo = 0; + rfbLog("unixpw_keystroke: echo off.\n"); + return; + } if (in_login) { if (keysym == XK_BackSpace || keysym == XK_Delete) { @@ -1295,8 +1302,10 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) { x = text_x(); y = text_y(); - rfbDrawString(pscreen, &default8x16Font, x, y, - str, white_pixel()); + if (echo) { + rfbDrawString(pscreen, &default8x16Font, x, y, + str, white_pixel()); + } mark_rect_as_modified(x, y-char_h, x+char_w, y, scaling); char_col++; @@ -1340,7 +1349,9 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) { if (db && db <= 2) fprintf(stderr, "u_cnt: %d %d/%d ks: 0x%x '%s'\n", u_cnt, x, y, keysym, keystr); - rfbDrawString(pscreen, &default8x16Font, x, y, keystr, white_pixel()); + if (echo ) { + rfbDrawString(pscreen, &default8x16Font, x, y, keystr, white_pixel()); + } mark_rect_as_modified(x, y-char_h, x+char_w, y, scaling); char_col++; -- cgit v1.2.3