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>
* x11vnc: add -8to24 option for some multi-depth displays.
......
# Process this file with autoconf to produce a configure script.
AC_INIT(LibVNCServer, 0.8pre, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE(LibVNCServer, 0.8pre)
AC_INIT(LibVNCServer, 0.9pre, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE(LibVNCServer, 0.9pre)
AM_CONFIG_HEADER(rfbconfig.h)
AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])
......
......@@ -341,7 +341,7 @@ char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource
}
}
free(error);
return result;
return (char *) result;
}
void rfbFreeCursor(rfbCursorPtr cursor)
......
......@@ -400,6 +400,7 @@ clientOutput(void *data)
sraRgnDestroy(updateRegion);
}
/* Not reached. */
return NULL;
}
......
......@@ -42,6 +42,9 @@ DisplayFileList(FileListInfo fli)
rfbLog("DISPLAYING FILE NAMES IN THE LIST ...END\n\n");
}
#ifndef __GNUC__
#define __FUNCTION__ "unknown"
#endif
int
AddFileListItemInfo(FileListInfoPtr fileListInfoPtr, char* name,
......
......@@ -100,6 +100,9 @@ GetFileListResponseMsg(char* path, char flags)
return fileListMsg;
}
#ifndef __GNUC__
#define __FUNCTION__ "unknown"
#endif
int
CreateFileListInfo(FileListInfoPtr pFileListInfo, char* path, int flag)
......
......@@ -84,6 +84,9 @@ InitFileTransfer()
fileTransferInitted = TRUE;
}
#ifndef __GNUC__
#define __FUNCTION__ "unknown"
#endif
/*
* This method is called from InitFileTransfer method and
......
#!/bin/bash
VERSION="0.8"
VERSION="0.8.1"
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>
* 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) {
#if LIBVNCSERVER_HAVE_FORK
{
pid_t pid, pidw;
if ((pid = fork()) > 0) {
pidw = waitpid(pid, &rc, 0);
} else if (pid == -1) {
fprintf(stderr, "could not fork\n");
rfbLogPerror("fork");
rc = system(cmd);
struct sigaction sa, intr, quit;
sigset_t omask;
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
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 {
/* this should close port 5900, etc.. */
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++) {
close(fd);
}
......
......@@ -177,8 +177,47 @@ char *ident_username(rfbClientPtr client) {
if (!user || *user == '\0') {
char msg[128];
int n, sock, ok = 0;
if ((sock = rfbConnectToTcpAddr(client->host, 113)) < 0) {
int block = 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",
client->host, 113);
} else {
......
......@@ -557,6 +557,11 @@ static int try_user_and_display(uid_t uid, char *dpystr) {
Display *dpy2 = NULL;
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);
if (! rc) {
exit(1);
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "February 2006" "x11vnc " "User Commands"
.SH NAME
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
.B x11vnc
[OPTION]...
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* 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 */
......
......@@ -473,6 +473,11 @@ void spawn_grab_buster(void) {
fprintf(stderr, "spawn_grab_buster: could not fork\n");
rfbLogPerror("fork");
} else {
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
grab_buster_watch(parent, dstr);
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