summaryrefslogtreecommitdiffstats
path: root/x11vnc/unixpw.c
diff options
context:
space:
mode:
authorrunge <runge@karlrunge.com>2009-12-18 11:46:10 -0500
committerrunge <runge@karlrunge.com>2009-12-18 11:46:10 -0500
commit06987b1c0216429e6744bf5a2c306d0e6853f879 (patch)
treef2a3f6e24d5742c4297130cdfc5673550ca53bae /x11vnc/unixpw.c
parentd6c012e9688d32d80c288541615c01cd082ecf0a (diff)
downloadlibvncserver-06987b1c0216429e6744bf5a2c306d0e6853f879.zip
libvncserver-06987b1c0216429e6744bf5a2c306d0e6853f879.tar.gz
x11vnc: fix keycode and other remote control actions under
DIRECT: with an extra XFlush and other safety measures. fflush(stderr) much in su_verify. Make the -unixpw env. vars UNIXPW_DISABLE_SSL and UNIXPW_DISABLE_LOCALHOST work correctly. Make -loopbg actually imply -bg.
Diffstat (limited to 'x11vnc/unixpw.c')
-rw-r--r--x11vnc/unixpw.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/x11vnc/unixpw.c b/x11vnc/unixpw.c
index cda5f70..d84ddd9 100644
--- a/x11vnc/unixpw.c
+++ b/x11vnc/unixpw.c
@@ -960,6 +960,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
first = 0;
}
rfbLog("su_verify: '%s' for %s.\n", user, cmd ? "command" : "login");
+ fflush(stderr);
if (! scheck(user, 100, "username")) {
return 0;
@@ -992,6 +993,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
}
if (bin_su == NULL) {
rfbLogPerror("existence /bin/su");
+ fflush(stderr);
return 0;
}
@@ -1006,6 +1008,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
}
if (bin_true == NULL) {
rfbLogPerror("existence /bin/true");
+ fflush(stderr);
return 0;
}
@@ -1013,6 +1016,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
if (slave == NULL) {
rfbLogPerror("get_pty failed.");
+ fflush(stderr);
return 0;
}
@@ -1021,6 +1025,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
if (fd < 0) {
rfbLogPerror("get_pty fd < 0");
+ fflush(stderr);
return 0;
}
@@ -1029,6 +1034,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
pid = fork();
if (pid < 0) {
rfbLogPerror("fork");
+ fflush(stderr);
close(fd);
return 0;
}
@@ -1248,6 +1254,7 @@ int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int
}
if (j >= 32-1) {
rfbLog("su_verify: problem finding Password:\n");
+ fflush(stderr);
return 0;
}
instr[j++] = tolower((unsigned char)cbuf[0]);
@@ -1399,10 +1406,12 @@ int unixpw_verify(char *user, char *pass) {
if (cmd_verify(user, pass)) {
rfbLog("unixpw_verify: cmd_verify login for '%s'"
" succeeded.\n", user);
+ fflush(stderr);
ok = 1;
} else {
rfbLog("unixpw_verify: cmd_verify login for '%s'"
" failed.\n", user);
+ fflush(stderr);
usleep(3000*1000);
ok = 0;
}
@@ -1410,10 +1419,12 @@ int unixpw_verify(char *user, char *pass) {
if (crypt_verify(user, pass)) {
rfbLog("unixpw_verify: crypt_verify login for '%s'"
" succeeded.\n", user);
+ fflush(stderr);
ok = 1;
} else {
rfbLog("unixpw_verify: crypt_verify login for '%s'"
" failed.\n", user);
+ fflush(stderr);
usleep(3000*1000);
ok = 0;
}
@@ -1421,10 +1432,12 @@ int unixpw_verify(char *user, char *pass) {
if (su_verify(user, pass, NULL, NULL, NULL, 1)) {
rfbLog("unixpw_verify: su_verify login for '%s'"
" succeeded.\n", user);
+ fflush(stderr);
ok = 1;
} else {
rfbLog("unixpw_verify: su_verify login for '%s'"
" failed.\n", user);
+ fflush(stderr);
/* use su(1)'s sleep */
ok = 0;
}
@@ -1451,6 +1464,7 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
*colon = '\0';
rfbLog("unixpw_verify: colon: '%s'\n", user);
}
+ fflush(stderr);
if (unixpw_client) {
cd = (ClientData *) unixpw_client->clientData;
if (cd) {
OpenPOWER on IntegriCloud