diff options
author | runge <runge> | 2009-01-04 04:56:53 +0000 |
---|---|---|
committer | runge <runge> | 2009-01-04 04:56:53 +0000 |
commit | 91174efbb8e2fb09520477af6593f99b865777b0 (patch) | |
tree | 796e0213305556909052c8ea203c048eab732353 | |
parent | 4fdb4cc67f1563156593e5b3deca80acf35f39ed (diff) | |
download | libtdevnc-91174efbb8e2fb09520477af6593f99b865777b0.tar.gz libtdevnc-91174efbb8e2fb09520477af6593f99b865777b0.zip |
x11vnc: fix compiler warnings.
-rw-r--r-- | x11vnc/README | 2 | ||||
-rw-r--r-- | x11vnc/avahi.c | 3 | ||||
-rw-r--r-- | x11vnc/cleanup.c | 5 | ||||
-rw-r--r-- | x11vnc/connections.c | 3 | ||||
-rw-r--r-- | x11vnc/connections.h | 1 | ||||
-rw-r--r-- | x11vnc/enc.h | 10 | ||||
-rw-r--r-- | x11vnc/gui.c | 3 | ||||
-rw-r--r-- | x11vnc/scan.c | 2 | ||||
-rw-r--r-- | x11vnc/screen.c | 4 | ||||
-rw-r--r-- | x11vnc/solid.c | 2 | ||||
-rw-r--r-- | x11vnc/sslhelper.c | 35 | ||||
-rw-r--r-- | x11vnc/x11vnc.c | 15 | ||||
-rw-r--r-- | x11vnc/xwrappers.c | 14 |
13 files changed, 58 insertions, 41 deletions
diff --git a/x11vnc/README b/x11vnc/README index 8d4ed68..d0c1cc4 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Sat Jan 3 19:10:09 EST 2009 +x11vnc README file Date: Sat Jan 3 23:43:28 EST 2009 The following information is taken from these URLs: diff --git a/x11vnc/avahi.c b/x11vnc/avahi.c index 5b9882b..5f4e8ba 100644 --- a/x11vnc/avahi.c +++ b/x11vnc/avahi.c @@ -1,6 +1,7 @@ /* -- avahi.c -- */ #include "x11vnc.h" +#include "connections.h" void avahi_initialise(void); void avahi_advertise(const char *name, const char *host, const uint16_t port); @@ -21,6 +22,8 @@ static int try_avahi_helper(const char *name, const char *host, const uint16_t p char *cmd, *p, *path = getenv("PATH"), portstr[32]; int i; + if (!name || !host || !port) {} + /* avahi-publish */ if (no_external_cmds || !cmd_ok("zeroconf")) { return 0; diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c index 08a4e1f..0a3b9af 100644 --- a/x11vnc/cleanup.c +++ b/x11vnc/cleanup.c @@ -15,6 +15,9 @@ #include "macosx.h" #include "macosxCG.h" #include "avahi.h" +#include "screen.h" +#include "xrecord.h" +#include "xevents.h" /* * Exiting and error handling routines @@ -270,6 +273,8 @@ static int Xerror(Display *d, XErrorEvent *error) { return (*Xerror_def)(d, error); } +void watch_loop(void); + static int XIOerr(Display *d) { static int reopen = 0, rmax = 1; X_UNLOCK; diff --git a/x11vnc/connections.c b/x11vnc/connections.c index e759707..ee1ba1d 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -2833,6 +2833,7 @@ static void turn_off_truecolor_ad(rfbClientPtr client) { */ rfbBool password_check_chat_helper(rfbClientPtr cl, const char* response, int len) { + if (response || len) {} if (cl != chat_window_client) { rfbLog("invalid client during chat_helper login\n"); return FALSE; @@ -2851,12 +2852,14 @@ rfbBool password_check_chat_helper(rfbClientPtr cl, const char* response, int le } enum rfbNewClientAction new_client_chat_helper(rfbClientPtr client) { + if (client) {} client->clientGoneHook = client_gone_chat_helper; rfbLog("new chat helper\n"); return(RFB_CLIENT_ACCEPT); } void client_gone_chat_helper(rfbClientPtr client) { + if (client) {} rfbLog("finished chat helper\n"); chat_window_client = NULL; } diff --git a/x11vnc/connections.h b/x11vnc/connections.h index 975195e..0818536 100644 --- a/x11vnc/connections.h +++ b/x11vnc/connections.h @@ -37,5 +37,6 @@ extern void check_new_clients(void); extern int accept_client(rfbClientPtr client); extern int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input, int len, FILE *output); +extern int check_access(char *addr); #endif /* _X11VNC_CONNECTIONS_H */ diff --git a/x11vnc/enc.h b/x11vnc/enc.h index 664342a..bf4fd84 100644 --- a/x11vnc/enc.h +++ b/x11vnc/enc.h @@ -13,8 +13,8 @@ * * compile via: - cc -O -o ultravnc_dsm_helper ultravnc_dsm_helper.c -lssl -lcrypto - cc -DDBG -O -o ultravnc_dsm_helper ultravnc_dsm_helper.c -lssl -lcrypto + cc -O -o ultravnc_dsm_helper ultravnc_dsm_helper.c -lcrypto + cc -DDBG -O -o ultravnc_dsm_helper ultravnc_dsm_helper.c -lcrypto * * See usage below for how to run it. @@ -369,7 +369,7 @@ extern void enc_do(char *ciph, char *keyfile, char *lport, char *rhp) { int i; len = 0; pw_in = 1; - for (i=0; i < strlen(keyfile); i++) { + for (i=0; i < (int) strlen(keyfile); i++) { /* load the string to keydata: */ int n = i + strlen("pw="); keydata[i] = keyfile[n]; @@ -462,7 +462,7 @@ static void enc_xfer(int sock_fr, int sock_to, int encrypt) { unsigned char salt[SALT+1]; unsigned char ivec[EVP_MAX_IV_LENGTH]; - int i, cnt, len, m, n = 0, vb = 0, pa = 1, first = 1; + int i, cnt, len, m, n = 0, vb = 0, first = 1; int whoops = 1; /* for the msrc4 problem */ char *encstr, *encsym; @@ -788,7 +788,7 @@ static void enc_xfer(int sock_fr, int sock_to, int encrypt) { * decrypter. */ static void enc_connections(int listen_port, char *connect_host, int connect_port) { - int listen_fd, conn1, conn2, ret, n, one = 1; + int listen_fd, conn1, conn2, ret, one = 1; socklen_t clen; struct hostent *hp; struct sockaddr_in client, server; diff --git a/x11vnc/gui.c b/x11vnc/gui.c index 41c4202..f0dd16c 100644 --- a/x11vnc/gui.c +++ b/x11vnc/gui.c @@ -674,7 +674,7 @@ void do_gui(char *opts, int sleep) { char *cmd, *p, *p2, *p1, *p0 = getenv("PATH"); char tf1[] = "/tmp/x11vnc_port_prompt.2XXXXXX"; char tf2[] = "/tmp/x11vnc_port_prompt.1XXXXXX"; - int fd, i, port; + int fd; char *dstr = "", *wish = NULL; char line[128]; FILE *fp; @@ -831,7 +831,6 @@ void do_gui(char *opts, int sleep) { if (icon_mode) { char tf[] = "/tmp/x11vnc.tray.XXXXXX"; int fd; - struct stat sbuf; fd = mkstemp(tf); if (fd < 0) { diff --git a/x11vnc/scan.c b/x11vnc/scan.c index 864e16a..2738de2 100644 --- a/x11vnc/scan.c +++ b/x11vnc/scan.c @@ -341,7 +341,7 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, void shm_delete(XShmSegmentInfo *shm) { #if LIBVNCSERVER_HAVE_XSHM - if (getenv("X11VNC_SHM_DEBUG")) fprintf(stderr, "shm_delete: 0x%x\n", shm); + if (getenv("X11VNC_SHM_DEBUG")) fprintf(stderr, "shm_delete: %p\n", (void *) shm); if (shm != NULL && shm->shmaddr != (char *) -1) { shmdt(shm->shmaddr); } diff --git a/x11vnc/screen.c b/x11vnc/screen.c index 2d7ed73..a65230d 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -27,6 +27,8 @@ #include "solid.h" #include "inet.h" #include "xrandr.h" +#include "xrecord.h" +#include "pm.h" #include <rfb/rfbclient.h> @@ -55,8 +57,6 @@ rfbBool vnc_reflect_send_pointer(int x, int y, int mask); rfbBool vnc_reflect_send_key(uint32_t key, rfbBool down); rfbBool vnc_reflect_send_cuttext(char *str, int len); -void watch_loop(void); - static void debug_colormap(XImage *fb); static void set_visual(char *str); static void nofb_hook(rfbClientPtr cl); diff --git a/x11vnc/solid.c b/x11vnc/solid.c index 97b6704..f699ff1 100644 --- a/x11vnc/solid.c +++ b/x11vnc/solid.c @@ -924,7 +924,9 @@ static void solid_macosx(int restore) { if (restore) { rfbLog("restore pid: %d\n", (int) solid_macosx_pid); if (solid_macosx_pid > 0) { +#if 0 int i, status; +#endif rfbLog("kill -TERM macosx_solid_background helper pid: %d\n", (int) solid_macosx_pid); kill(solid_macosx_pid, SIGTERM); #if 0 diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c index 7e1fffd..1f7598f 100644 --- a/x11vnc/sslhelper.c +++ b/x11vnc/sslhelper.c @@ -1629,6 +1629,9 @@ static int check_ssl_access(char *addr) { static int write_exact(int sock, char *buf, int len); static int read_exact(int sock, char *buf, int len); +/* XXX not in rfb.h: */ +void rfbClientSendString(rfbClientPtr cl, char *reason); + static int finish_auth(rfbClientPtr client, char *type) { int security_result, ret; @@ -1859,10 +1862,10 @@ void accept_openssl(int mode, int presock) { * here, since we use INADDR_LOOPBACK). */ rb = (unsigned char *) calloc(6, 1); - RAND_bytes((char *)rb, 6); - sprintf(cookie, "RB=%d%d%d%d%d%d/%f%f/0x%x", + RAND_bytes(rb, 6); + sprintf(cookie, "RB=%d%d%d%d%d%d/%f%f/%p", rb[0], rb[1], rb[2], rb[3], rb[4], rb[5], - dnow() - x11vnc_start, x11vnc_start, rb); + dnow() - x11vnc_start, x11vnc_start, (void *)rb); if (mode != OPENSSL_INETD) { name = get_remote_host(sock); @@ -2780,6 +2783,7 @@ static int switch_to_anon_dh(void) { static int anontls_dialog(int s_in, int s_out) { + if (s_in || s_out) {} anontls_selected = 1; if (!switch_to_anon_dh()) { @@ -2798,7 +2802,7 @@ static int anontls_dialog(int s_in, int s_out) { static int vencrypt_dialog(int s_in, int s_out) { char buf[256], buf2[256]; int subtypes[16]; - int n, i, ival, ok, db = 1, nsubtypes = 0; + int n, i, ival, ok, nsubtypes = 0; vencrypt_selected = 0; @@ -2829,7 +2833,7 @@ static int vencrypt_dialog(int s_in, int s_out) { /* accept only 0.2 */ if (buf[0] != 0 || buf[1] != 2) { rfbLog("vencrypt: unsupported VeNCrypt version, closing connection.\n"); - buf[0] = 255; + buf[0] = (char) 255; write_exact(s_out, buf, 1); close(s_in); close(s_out); return 0; @@ -2965,12 +2969,12 @@ static int check_vnc_tls_mode(int s_in, int s_out) { return 1; } if (ssl_client_mode) { - /* XXX check if this can be done in SSL client mode. */ if (vencrypt_mode == VENCRYPT_FORCE || anontls_mode == ANONTLS_FORCE) { rfbLog("check_vnc_tls_mode: VENCRYPT_FORCE/ANONTLS_FORCE in client\n"); - rfbLog("check_vnc_tls_mode: connect mode prevents normal SSL.\n"); - //return 0; + rfbLog("check_vnc_tls_mode: connect mode.\n"); + /* this is OK, continue on below for dialog. */ } else { + /* otherwise we must assume normal SSL (we send client hello) */ return 1; } } @@ -3104,6 +3108,8 @@ static void pr_ssl_info(int verb) { SSL_SESSION *s; char *proto = "unknown"; + if (verb) {} + if (ssl == NULL) { return; } @@ -3131,7 +3137,7 @@ static void pr_ssl_info(int verb) { static void ssl_timeout (int sig) { int i; rfbLog("sig: %d, ssl_init[%d] timed out.\n", sig, getpid()); - for (i=0; i < 256; i) { + for (i=0; i < 256; i++) { close(i); } exit(1); @@ -3139,7 +3145,7 @@ static void ssl_timeout (int sig) { static int ssl_init(int s_in, int s_out, int skip_vnc_tls) { unsigned char *sid = (unsigned char *) "x11vnc SID"; - char *name; + char *name = NULL; int peerport = 0; int db = 0, rc, err; int ssock = s_in; @@ -3159,7 +3165,7 @@ static int ssl_init(int s_in, int s_out, int skip_vnc_tls) { if (skip_vnc_tls) { rfbLog("SSL: ssl_helper[%d]: HTTPS mode, skipping check_vnc_tls_mode()\n", - getpid(), name, peerport); + getpid()); } else if (!check_vnc_tls_mode(s_in, s_out)) { return 0; } @@ -3343,7 +3349,7 @@ static int ssl_init(int s_in, int s_out, int skip_vnc_tls) { return 1; } -static symmetric_encryption_xfer(int csock, int s_in, int s_out); +static void symmetric_encryption_xfer(int csock, int s_in, int s_out); static void ssl_xfer(int csock, int s_in, int s_out, int is_https) { int dbxfer = 0, db = 0, check_pending, fdmax, nfd, n, i, err; @@ -3951,9 +3957,10 @@ if (db) rfbLog("raw_xfer bad write: %d -> %d | %d/%d errno=%d\n", csock, s_out #endif #include "enc.h" -static symmetric_encryption_xfer(int csock, int s_in, int s_out) { +static void symmetric_encryption_xfer(int csock, int s_in, int s_out) { char tmp[100]; char *cipher, *keyfile, *q; + if (! enc_str) { return; } @@ -3971,6 +3978,8 @@ static symmetric_encryption_xfer(int csock, int s_in, int s_out) { /* TBD: s_in != s_out */ + if (s_out) {} + sprintf(tmp, "fd=%d,%d", s_in, csock); enc_do(cipher, keyfile, "-1", tmp); diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index dd9f69a..c5e65e7 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -148,6 +148,7 @@ /* * main routine for the x11vnc program */ +void watch_loop(void); static int limit_shm(void); static void check_rcfile(int argc, char **argv); @@ -284,7 +285,7 @@ void terminal_services(char *list) { PropModeReplace, (unsigned char *)list, strlen(list)); XSync(dpy, False); } - if (db) fprintf(stderr, "TS_REDIR_LIST Atom: %d.\n"); + if (db) fprintf(stderr, "TS_REDIR_LIST Atom: %d.\n", (int) at); oh_restart_it_all: @@ -512,7 +513,7 @@ if (tstk[j] != 0) fprintf(stderr, "B redir[%d][%d] = %d %s\n", i, j, tstk[j], t } } if (did_ts && rate_count > 100) { - int k, db_netstat = 1; + int db_netstat = 1; char dcmd[100]; if (no_external_cmds) { @@ -639,7 +640,7 @@ void do_tsd(void) { if (a != None) { get_prop(prop, 512, a); } - if (db) fprintf(stderr, "TS_REDIR_LIST Atom: %d = '%s'\n", a, prop); + if (db) fprintf(stderr, "TS_REDIR_LIST Atom: %d = '%s'\n", (int) a, prop); if (prop[0] == '\0') { return; @@ -772,7 +773,7 @@ static void check_redir_services(void) { pid = (pid_t) atoi(prop); } } - if (db) fprintf(stderr, "TS_REDIR_PID Atom: %d = '%s'\n", a, prop); + if (db) fprintf(stderr, "TS_REDIR_PID Atom: %d = '%s'\n", (int) a, prop); if (getenv("FD_TAG")) { a = XInternAtom(dpy, "FD_TAG", False); @@ -783,7 +784,7 @@ static void check_redir_services(void) { PropModeReplace, (unsigned char *)tag, strlen(tag)); XSync(dpy, False); } - if (db) fprintf(stderr, "FD_TAG Atom: %d = '%s'\n", a, prop); + if (db) fprintf(stderr, "FD_TAG Atom: %d = '%s'\n", (int) a, prop); } prop[0] = '\0'; @@ -791,7 +792,7 @@ static void check_redir_services(void) { if (a != None) { get_prop(prop, 512, a); } - if (db) fprintf(stderr, "TS_REDIR Atom: %d = '%s'\n", a, prop); + if (db) fprintf(stderr, "TS_REDIR Atom: %d = '%s'\n", (int) a, prop); if (prop[0] == '\0') { rfbLog("TS_REDIR is empty, restarting...\n"); restart = 1; @@ -2264,7 +2265,6 @@ int main(int argc, char* argv[]) { continue; } if (!strcmp(arg, "-sleepin")) { - int n; CHECK_ARGC do_sleepin(argv[++i]); continue; @@ -2557,7 +2557,6 @@ int main(int argc, char* argv[]) { continue; } if (!strcmp(arg, "-enc")) { - char *q; use_openssl = 1; CHECK_ARGC enc_str = strdup(argv[++i]); diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index 95e9e9f..282c221 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -189,7 +189,7 @@ Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) { Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) { #if LIBVNCSERVER_HAVE_XSHM - if (getenv("X11VNC_SHM_DEBUG")) fprintf(stderr, "XShmDetach_wr: 0x%x disp: 0x%x\n", shminfo, disp); + if (getenv("X11VNC_SHM_DEBUG")) fprintf(stderr, "XShmDetach_wr: %p disp: %p\n", (void *)shminfo, (void *)disp); return XShmDetach(disp, shminfo); #else if (!disp || !shminfo) {} @@ -386,6 +386,8 @@ static void copy_raw_fb_low_bpp(XImage *dest, int x, int y, unsigned int w, static int last_bpp = -1; static int cga = -1; + if (rm_f | gm_f | bm_f) {} + if (cga < 0) { if (getenv("RAWFB_CGA")) { cga = 1; @@ -412,7 +414,7 @@ static void copy_raw_fb_low_bpp(XImage *dest, int x, int y, unsigned int w, for (br = 0; br < 8; br++) { unsigned int pbit, k, m = 0; - for (k=0; k < raw_fb_native_bpp; k++) { + for (k=0; k < (unsigned int) raw_fb_native_bpp; k++) { pbit = 1 << (br+k); m |= pbit; } @@ -427,8 +429,6 @@ if (0) fprintf(stderr, "x=%d y=%d w=%d h=%d bpl=%d d_bpl=%d-%dx%dx%d/%d %p\n", for (line = 0; line < h; line++) { -//fprintf(stderr, "w=%d h=%d x=%d y+line=%d\n", w, h, x, y+line); - if (! raw_fb_seek) { /* mmap */ src = raw_fb_addr + raw_fb_offset + bpl*(y+line); @@ -456,14 +456,12 @@ if (0) fprintf(stderr, "x=%d y=%d w=%d h=%d bpl=%d d_bpl=%d-%dx%dx%d/%d %p\n", } } } - for (ix = 0; ix < w; ix++) { + for (ix = 0; ix < (int) w; ix++) { int bx = (x + ix) * raw_fb_native_bpp; int ib = bx / 8; int br = bx - ib * 8; unsigned char val; -//fprintf(stderr, "%d\n", ix); - val = *((unsigned char*) (buf + ib)); val = msk[br] & val; @@ -504,8 +502,6 @@ if (0) fprintf(stderr, "x=%d y=%d w=%d h=%d bpl=%d d_bpl=%d-%dx%dx%d/%d %p\n", *(dst+ix) = (char) val; } -//fprintf(stderr, "\n", ix); - dst += dest->bytes_per_line; } } |