diff options
Diffstat (limited to 'x11vnc/remote.c')
-rw-r--r-- | x11vnc/remote.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/x11vnc/remote.c b/x11vnc/remote.c index 6d4e48a..356aa81 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -484,6 +484,7 @@ void http_connections(int on) { if (screen->httpPort == 0) { int port = find_free_port(5800, 5850); if (port) { + /* mutex */ screen->httpPort = port; } } @@ -517,6 +518,7 @@ static void reset_httpport(int old, int new) { rfbLog("reset_httpport: cannot set httpport: %d" " in inetd.\n", hp); } else if (screen) { + /* mutex */ screen->httpPort = hp; screen->httpInitDone = FALSE; if (screen->httpListenSock > -1) { @@ -544,6 +546,7 @@ static void reset_rfbport(int old, int new) { rfbClientIteratorPtr iter; rfbClientPtr cl; int maxfd; + /* mutex */ if (rp == 0) { screen->autoPort = TRUE; } else { @@ -655,7 +658,9 @@ int remote_control_access_ok(void) { } } + X_LOCK; xha = XListHosts(dpy, &n, &enabled); + X_UNLOCK; if (! enabled) { rfbLog("X access control is disabled, X clients can\n"); rfbLog(" connect from any host. Run 'xhost -'\n"); @@ -1055,6 +1060,13 @@ char *process_remote_cmd(char *cmd, int stringonly) { close_clients(p); goto done; } + if (strstr(p, "id_cmd") == p) { + NOTAPP + COLON_CHECK("id_cmd:") + p += strlen("id_cmd:"); + id_cmd(p); + goto done; + } if (strstr(p, "id") == p) { int ok = 0; Window twin; @@ -1465,6 +1477,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enable sharing.\n"); shared = 1; if (screen) { + /* mutex */ screen->alwaysShared = TRUE; screen->neverShared = FALSE; } @@ -1477,6 +1490,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disable sharing.\n"); shared = 0; if (screen) { + /* mutex */ screen->alwaysShared = FALSE; screen->neverShared = TRUE; } @@ -1562,6 +1576,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } if (! screen->permitFileTransfer) { rfbLog("remote_cmd: enabling -ultrafilexfer for clients.\n"); + /* mutex */ screen->permitFileTransfer = TRUE; } goto done; @@ -1577,6 +1592,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } if (screen->permitFileTransfer) { rfbLog("remote_cmd: disabling -ultrafilexfer for clients.\n"); + /* mutex */ screen->permitFileTransfer = FALSE; } goto done; @@ -1595,6 +1611,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("rfbversion:"); if (sscanf(p, "%d.%d", &maj, &min) == 2) { + /* mutex */ screen->protocolMajorVersion = maj; screen->protocolMinorVersion = min; rfbLog("remote_cmd: set rfbversion to: %d.%d\n", maj, min); @@ -1766,6 +1783,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } listen_str = strdup("localhost"); + /* mutex */ screen->listenInterface = htonl(INADDR_LOOPBACK); rfbLog("listening on loopback network only.\n"); rfbLog("allow list is: '%s'\n", NONUL(allow_list)); @@ -1813,6 +1831,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } listen_str = NULL; + /* mutex */ screen->listenInterface = htonl(INADDR_ANY); rfbLog("listening on ALL network interfaces.\n"); rfbLog("allow list is: '%s'\n", NONUL(allow_list)); @@ -1853,6 +1872,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } ok = 1; + /* mutex */ if (listen_str == NULL || *listen_str == '\0' || !strcmp(listen_str, "any")) { screen->listenInterface = htonl(INADDR_ANY); @@ -4134,6 +4154,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } #endif } else { + X_LOCK; if (down == -1) { XTestFakeKeyEvent_wr(dpy, kc, 1, CurrentTime); usleep(50*1000); @@ -4141,6 +4162,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { XTestFakeKeyEvent_wr(dpy, kc, down, CurrentTime); } + X_UNLOCK; } goto done; } @@ -4340,8 +4362,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("bcx_xattach: failed grab check for '%s': %s. Retrying[%d]...\n", p, res, try); free(res); pointer(0, dpy_x/2 + try, dpy_y/2 + try, NULL); - XFlush_wr(dpy); #if !NO_X11 + X_LOCK; + XFlush_wr(dpy); if (dpy) { if (try == 2) { XSync(dpy, False); @@ -4349,6 +4372,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { XSync(dpy, True); } } + X_UNLOCK; #endif if (try == 1) { usleep(250*1000); @@ -4382,6 +4406,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (d < 0) d = 0; rfbLog("remote_cmd: setting defer to %d ms.\n", d); defer_update = d; + /* mutex */ screen->deferUpdateTime = d; got_defer = 1; goto done; @@ -4403,6 +4428,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (d < 0) d = 0; rfbLog("remote_cmd: setting defer to %d ms.\n", d); defer_update = d; + /* mutex */ screen->deferUpdateTime = d; got_defer = 1; goto done; @@ -4907,6 +4933,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (f < 0) f = 0; rfbLog("remote_cmd: setting progressive %d -> %d.\n", screen->progressiveSliceHeight, f); + /* mutex */ screen->progressiveSliceHeight = f; goto done; } @@ -4995,6 +5022,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { goto qry; } rfbLog("turning on enablehttpproxy.\n"); + /* mutex */ screen->httpEnableProxyConnect = 1; goto done; } @@ -5081,6 +5109,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { free(rfb_desktop_name); } rfb_desktop_name = strdup(p); + /* mutex */ screen->desktopName = rfb_desktop_name; rfbLog("remote_cmd: setting desktop name to %s\n", rfb_desktop_name); @@ -5449,6 +5478,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { passwds_new[0] = strdup(p); + /* mutex */ if (screen->authPasswdData && screen->passwordCheck == rfbCheckPasswordByList) { passwds_new[1] = passwds_old[1]; @@ -5984,8 +6014,10 @@ char *process_remote_cmd(char *cmd, int stringonly) { } } else { if (dpy) { /* raw_fb hack */ + X_LOCK; set_x11vnc_remote_prop(buf); XFlush_wr(dpy); + X_UNLOCK; } } #endif /* REMOTE_CONTROL */ |