Commit 603b5667 authored by runge's avatar runge

fix some non-gcc compiler warnings and signals in x11vnc

parent 4b8cc33e
2006-02-20 Karl Runge <runge@karlrunge.com>
* main.c, cursor.c, tightvnc-filetransfer: fix some non-gcc
compiler warnings.
2006-01-14 Karl Runge <runge@karlrunge.com> 2006-01-14 Karl Runge <runge@karlrunge.com>
* x11vnc: add -8to24 option for some multi-depth displays. * x11vnc: add -8to24 option for some multi-depth displays.
......
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_INIT(LibVNCServer, 0.8pre, http://sourceforge.net/projects/libvncserver) AC_INIT(LibVNCServer, 0.9pre, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE(LibVNCServer, 0.8pre) AM_INIT_AUTOMAKE(LibVNCServer, 0.9pre)
AM_CONFIG_HEADER(rfbconfig.h) AM_CONFIG_HEADER(rfbconfig.h)
AX_PREFIX_CONFIG_H([rfb/rfbconfig.h]) AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])
......
...@@ -341,7 +341,7 @@ char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource ...@@ -341,7 +341,7 @@ char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource
} }
} }
free(error); free(error);
return result; return (char *) result;
} }
void rfbFreeCursor(rfbCursorPtr cursor) void rfbFreeCursor(rfbCursorPtr cursor)
......
...@@ -400,6 +400,7 @@ clientOutput(void *data) ...@@ -400,6 +400,7 @@ clientOutput(void *data)
sraRgnDestroy(updateRegion); sraRgnDestroy(updateRegion);
} }
/* Not reached. */
return NULL; return NULL;
} }
......
...@@ -42,6 +42,9 @@ DisplayFileList(FileListInfo fli) ...@@ -42,6 +42,9 @@ DisplayFileList(FileListInfo fli)
rfbLog("DISPLAYING FILE NAMES IN THE LIST ...END\n\n"); rfbLog("DISPLAYING FILE NAMES IN THE LIST ...END\n\n");
} }
#ifndef __GNUC__
#define __FUNCTION__ "unknown"
#endif
int int
AddFileListItemInfo(FileListInfoPtr fileListInfoPtr, char* name, AddFileListItemInfo(FileListInfoPtr fileListInfoPtr, char* name,
......
...@@ -100,6 +100,9 @@ GetFileListResponseMsg(char* path, char flags) ...@@ -100,6 +100,9 @@ GetFileListResponseMsg(char* path, char flags)
return fileListMsg; return fileListMsg;
} }
#ifndef __GNUC__
#define __FUNCTION__ "unknown"
#endif
int int
CreateFileListInfo(FileListInfoPtr pFileListInfo, char* path, int flag) CreateFileListInfo(FileListInfoPtr pFileListInfo, char* path, int flag)
......
...@@ -84,6 +84,9 @@ InitFileTransfer() ...@@ -84,6 +84,9 @@ InitFileTransfer()
fileTransferInitted = TRUE; fileTransferInitted = TRUE;
} }
#ifndef __GNUC__
#define __FUNCTION__ "unknown"
#endif
/* /*
* This method is called from InitFileTransfer method and * This method is called from InitFileTransfer method and
......
#!/bin/bash #!/bin/bash
VERSION="0.8" VERSION="0.8.1"
cd "$(dirname "$0")" cd "$(dirname "$0")"
......
2006-02-20 Karl Runge <runge@karlrunge.com>
* x11vnc: add SIGINT SIGQUIT handling for run_user_command(),
set some signal handlers to SIG_DLF for forked children,
put a timeout on port 113 connection to viewer machine.
2006-02-06 Karl Runge <runge@karlrunge.com> 2006-02-06 Karl Runge <runge@karlrunge.com>
* x11vnc: fix AIX build wrt h_errno. * x11vnc: fix AIX build wrt h_errno.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -431,15 +431,39 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) { ...@@ -431,15 +431,39 @@ static int run_user_command(char *cmd, rfbClientPtr client, char *mode) {
#if LIBVNCSERVER_HAVE_FORK #if LIBVNCSERVER_HAVE_FORK
{ {
pid_t pid, pidw; pid_t pid, pidw;
if ((pid = fork()) > 0) { struct sigaction sa, intr, quit;
pidw = waitpid(pid, &rc, 0); sigset_t omask;
} else if (pid == -1) {
fprintf(stderr, "could not fork\n"); sa.sa_handler = SIG_IGN;
rfbLogPerror("fork"); sa.sa_flags = 0;
rc = system(cmd); sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, &intr);
sigaction(SIGQUIT, &sa, &quit);
sigaddset(&sa.sa_mask, SIGCHLD);
sigprocmask(SIG_BLOCK, &sa.sa_mask, &omask);
if ((pid = fork()) > 0 || pid == -1) {
if (pid != -1) {
pidw = waitpid(pid, &rc, 0);
}
sigaction(SIGINT, &intr, (struct sigaction *) NULL);
sigaction(SIGQUIT, &quit, (struct sigaction *) NULL);
sigprocmask(SIG_SETMASK, &omask, (sigset_t *) NULL);
if (pid == -1) {
fprintf(stderr, "could not fork\n");
rfbLogPerror("fork");
rc = system(cmd);
}
} else { } else {
/* this should close port 5900, etc.. */ /* this should close port 5900, etc.. */
int fd; int fd;
sigaction(SIGINT, &intr, (struct sigaction *) NULL);
sigaction(SIGQUIT, &quit, (struct sigaction *) NULL);
sigprocmask(SIG_SETMASK, &omask, (sigset_t *) NULL);
for (fd=3; fd<256; fd++) { for (fd=3; fd<256; fd++) {
close(fd); close(fd);
} }
......
...@@ -177,8 +177,47 @@ char *ident_username(rfbClientPtr client) { ...@@ -177,8 +177,47 @@ char *ident_username(rfbClientPtr client) {
if (!user || *user == '\0') { if (!user || *user == '\0') {
char msg[128]; char msg[128];
int n, sock, ok = 0; int n, sock, ok = 0;
int block = 0;
if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) {
/*
* need to check to see if the operation will block for
* a long time: a firewall may just ignore our packets.
*/
#if LIBVNCSERVER_HAVE_FORK
{ pid_t pid, pidw;
int rc;
if ((pid = fork()) > 0) {
usleep(100 * 1000); /* 0.1 sec */
pidw = waitpid(pid, &rc, WNOHANG);
if (pidw <= 0) {
usleep(1000 * 1000); /* 1.0 sec */
pidw = waitpid(pid, &rc, WNOHANG);
if (pidw <= 0) {
block = 1;
kill(pid, SIGTERM);
}
}
} else if (pid == -1) {
;
} else {
/* child */
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) {
exit(1);
} else {
close(sock);
exit(0);
}
}
}
#endif
if (block) {
;
} else if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) {
rfbLog("could not connect to ident: %s:%d\n", rfbLog("could not connect to ident: %s:%d\n",
client->host, 113); client->host, 113);
} else { } else {
......
...@@ -557,6 +557,11 @@ static int try_user_and_display(uid_t uid, char *dpystr) { ...@@ -557,6 +557,11 @@ static int try_user_and_display(uid_t uid, char *dpystr) {
Display *dpy2 = NULL; Display *dpy2 = NULL;
int rc; int rc;
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
rc = switch_user_env(uid, name, home, 0); rc = switch_user_env(uid, name, home, 0);
if (! rc) { if (! rc) {
exit(1); exit(1);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.TH X11VNC "1" "February 2006" "x11vnc " "User Commands" .TH X11VNC "1" "February 2006" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.8, lastmod: 2006-02-06 version: 0.8.1, lastmod: 2006-02-20
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
......
...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; ...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8 lastmod: 2006-02-06"; char lastmod[] = "0.8.1 lastmod: 2006-02-20";
/* X display info */ /* X display info */
......
...@@ -473,6 +473,11 @@ void spawn_grab_buster(void) { ...@@ -473,6 +473,11 @@ void spawn_grab_buster(void) {
fprintf(stderr, "spawn_grab_buster: could not fork\n"); fprintf(stderr, "spawn_grab_buster: could not fork\n");
rfbLogPerror("fork"); rfbLogPerror("fork");
} else { } else {
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
grab_buster_watch(parent, dstr); grab_buster_watch(parent, dstr);
exit(0); exit(0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment