From 64e731a9da82e3cc614e274d6fca6f855d0359b7 Mon Sep 17 00:00:00 2001 From: runge Date: Sun, 18 Jun 2006 23:59:45 +0000 Subject: x11vnc: --grabkbd, -grabptr, -env, -allowedcmds, unixpw+WAIT user fred:options --- x11vnc/remote.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 7 deletions(-) (limited to 'x11vnc/remote.c') diff --git a/x11vnc/remote.c b/x11vnc/remote.c index b68e9b1..ae5361f 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -296,7 +296,10 @@ int check_httpdir(void) { p = strtok(path, ":"); while(p) { - free(prog); + if (prog) { + free(prog); + prog = NULL; + } len = strlen(p) + 1 + strlen(base) + 1; prog = (char *) malloc(len); snprintf(prog, len, "%s/%s", p, base); @@ -314,6 +317,7 @@ int check_httpdir(void) { * 12345678901234567 * /path/to/bin/../share/x11vnc/classes/ssl * 123456789012345678901 + * 21 */ if ((q = strrchr(prog, '/')) == NULL) { rfbLog("check_httpdir: bad program path: %s\n", prog); @@ -648,13 +652,25 @@ char *process_remote_cmd(char *cmd, int stringonly) { /* comma separated batch mode */ char *s, *q, *res; char tmp[512]; - strcpy(buf, ""); + char **pieces; + int k = 0, n = 0; + + pieces = (char **) malloc(strlen(cmd) * sizeof(char *)); s = strdup(cmd + strlen("qry=")); q = strtok(s, ","); + while (q) { strcpy(tmp, "qry="); strncat(tmp, q, 500); - res = process_remote_cmd(tmp, 1); + pieces[n] = strdup(tmp); + n++; + q = strtok(NULL, ","); + } + free(s); + + strcpy(buf, ""); + for (k=0; k= X11VNC_REMOTE_MAX - 1) { rfbLog("overflow in process_remote_cmd:" @@ -666,12 +682,14 @@ char *process_remote_cmd(char *cmd, int stringonly) { strcat(buf, res); free(res); } - q = strtok(NULL, ","); - if (q) { + if (k < n - 1) { strcat(buf, ","); } } - free(s); + for (k=0; k