summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-09-25 11:09:52 -0400
committerAdam Jackson <ajax@redhat.com>2019-09-30 11:25:58 -0400
commitd0d471579ca69365d4cd5a548ce6fc8b4662d467 (patch)
treecf164da53a499b42f0733431f37798eadd4d88ed
parent521682b8b72e3ad50c9ae66a9b35249100188eb2 (diff)
Remove non-Solaris SysV support
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--Xtrans.c5
-rw-r--r--Xtranslcl.c577
-rw-r--r--xtrans.m42
3 files changed, 2 insertions, 582 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 21f0bad..c1ebd26 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -75,7 +75,7 @@ from The Open Group.
#define TRANS_SOCKET_TCP_INDEX 7
#define TRANS_DNET_INDEX 8
#define TRANS_LOCAL_LOCAL_INDEX 9
-#define TRANS_LOCAL_PTS_INDEX 10
+/* 10 used to be PTS, but that's gone. */
#define TRANS_LOCAL_NAMED_INDEX 11
/* 12 used to be ISC, but that's gone. */
/* 13 used to be SCO, but that's gone. */
@@ -100,9 +100,6 @@ Xtransport_table Xtransports[] = {
#endif /* UNIXCONN */
#if defined(LOCALCONN)
{ &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX },
-#ifndef __sun
- { &TRANS(PTSFuncs), TRANS_LOCAL_PTS_INDEX },
-#endif /* __sun */
#if defined(SVR4) || defined(__SVR4)
{ &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX },
#endif
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 995d76e..ae3c0ad 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -78,11 +78,7 @@ from The Open Group.
#if defined(SVR4) || defined(__SVR4)
#include <sys/filio.h>
#endif
-#ifdef __sun
# include <stropts.h>
-#else
-# include <sys/stropts.h>
-#endif
#include <sys/wait.h>
#include <sys/types.h>
@@ -103,9 +99,6 @@ from The Open Group.
* - PTS
* - named pipes
*/
-#if !defined(__sun)
-# define LOCAL_TRANS_PTS
-#endif
#if defined(SVR4) || defined(__SVR4)
# define LOCAL_TRANS_NAMED
#endif
@@ -216,438 +209,35 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr,
-#ifdef LOCAL_TRANS_PTS
-/* PTS */
-
-#if defined(SYSV)
-#define SIGNAL_T int
-#else
-#define SIGNAL_T void
-#endif /* SYSV */
-
-typedef SIGNAL_T (*PFV)();
-
-extern PFV signal();
-
-extern char *ptsname(
- int
-);
-
-static void _dummy(int sig _X_UNUSED)
-
-{
-}
-#endif /* LOCAL_TRANS_PTS */
-#ifndef __sun
-#define X_STREAMS_DIR "/dev/X"
-#define DEV_SPX "/dev/spx"
-#else
#ifndef X11_t
#define X_STREAMS_DIR "/dev/X"
#else
#define X_STREAMS_DIR "/tmp/.X11-pipe"
#endif
-#endif
#define DEV_PTMX "/dev/ptmx"
#if defined(X11_t)
-#define PTSNODENAME "/dev/X/server."
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.X11-pipe/X"
-#else
-#define NAMEDNODENAME "/dev/X/Nserver."
-
-#endif /* !__sun */
#endif
#if defined(XIM_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.XIM-pipe/XIM"
-#else
-#define PTSNODENAME "/dev/X/XIM."
-#define NAMEDNODENAME "/dev/X/NXIM."
-#endif
#endif
#if defined(FS_t) || defined (FONT_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.font-pipe/fs"
-#else
-/*
- * USL has already defined something here. We need to check with them
- * and see if their choice is usable here.
- */
-#define PTSNODENAME "/dev/X/fontserver."
-#define NAMEDNODENAME "/dev/X/Nfontserver."
-#endif
#endif
#if defined(ICE_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.ICE-pipe/"
-#else
-#define PTSNODENAME "/dev/X/ICE."
-#define NAMEDNODENAME "/dev/X/NICE."
-#endif
#endif
#if defined(TEST_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.Test-unix/test"
-#endif
-#define PTSNODENAME "/dev/X/transtest."
#define NAMEDNODENAME "/dev/X/Ntranstest."
#endif
-#ifdef LOCAL_TRANS_PTS
-#ifdef TRANS_CLIENT
-
-static int
-TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port)
-
-{
-#ifdef PTSNODENAME
- int fd,server,exitval,alarm_time,ret;
- char server_path[64];
- char *slave, namelen;
- char buf[20]; /* MAX_PATH_LEN?? */
- PFV savef;
- pid_t saved_pid;
-#endif
-
- prmsg(2,"PTSOpenClient(%s)\n", port);
-
-#if !defined(PTSNODENAME)
- prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n");
- return -1;
-#else
- if (port && *port ) {
- if( *port == '/' ) { /* A full pathname */
- snprintf(server_path, sizeof(server_path), "%s", port);
- } else {
- snprintf(server_path, sizeof(server_path), "%s%s",
- PTSNODENAME, port);
- }
- } else {
- snprintf(server_path, sizeof(server_path), "%s%d",
- PTSNODENAME, getpid());
- }
-
-
- /*
- * Open the node the on which the server is listening.
- */
-
- if ((server = open (server_path, O_RDWR)) < 0) {
- prmsg(1,"PTSOpenClient: failed to open %s\n", server_path);
- return -1;
- }
-
-
- /*
- * Open the streams based pipe that will be this connection.
- */
-
- if ((fd = open(DEV_PTMX, O_RDWR)) < 0) {
- prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX);
- close(server);
- return(-1);
- }
-
- (void) grantpt(fd);
- (void) unlockpt(fd);
-
- slave = ptsname(fd); /* get name */
-
- if( slave == NULL ) {
- prmsg(1,"PTSOpenClient: failed to get ptsname()\n");
- close(fd);
- close(server);
- return -1;
- }
-
- /*
- * This is neccesary for the case where a program is setuid to non-root.
- * grantpt() calls /usr/lib/pt_chmod which is set-uid root. This program will
- * set the owner of the pt device incorrectly if the uid is not restored
- * before it is called. The problem is that once it gets restored, it
- * cannot be changed back to its original condition, hence the fork().
- */
-
- if(!(saved_pid=fork())) {
- uid_t saved_euid;
-
- saved_euid = geteuid();
- /** sets the euid to the actual/real uid **/
- if (setuid( getuid() ) == -1) {
- exit(1);
- }
- if( chown( slave, saved_euid, -1 ) < 0 ) {
- exit( 1 );
- }
-
- exit( 0 );
- }
-
- waitpid(saved_pid, &exitval, 0);
- if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) {
- close(fd);
- close(server);
- prmsg(1, "PTSOpenClient: cannot set the owner of %s\n",
- slave);
- return(-1);
- }
- if (chmod(slave, 0666) < 0) {
- close(fd);
- close(server);
- prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave);
- return(-1);
- }
-
- /*
- * write slave name to server
- */
-
- namelen = strlen(slave);
- buf[0] = namelen;
- (void) sprintf(&buf[1], slave);
- (void) write(server, buf, namelen+1);
- (void) close(server);
-
- /*
- * wait for server to respond
- */
-
- savef = signal(SIGALRM, _dummy);
- alarm_time = alarm (30); /* CONNECT_TIMEOUT */
-
- ret = read(fd, buf, 1);
-
- (void) alarm(alarm_time);
- (void) signal(SIGALRM, savef);
-
- if (ret != 1) {
- prmsg(1,
- "PTSOpenClient: failed to get acknoledgement from server\n");
- (void) close(fd);
- fd = -1;
- }
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0)
- {
- prmsg(1,"PTSOpenClient: failed to fill in addr info\n");
- close(fd);
- return -1;
- }
-
- return(fd);
-
-#endif /* !PTSNODENAME */
-}
-
-#endif /* TRANS_CLIENT */
-
-
-#ifdef TRANS_SERVER
-
-static int
-TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port)
-
-{
-#ifdef PTSNODENAME
- int fd, server;
- char server_path[64], *slave;
- int mode;
-#endif
-
- prmsg(2,"PTSOpenServer(%s)\n", port);
-
-#if !defined(PTSNODENAME)
- prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n");
- return -1;
-#else
- if (port && *port ) {
- if( *port == '/' ) { /* A full pathname */
- (void) sprintf(server_path, "%s", port);
- } else {
- (void) sprintf(server_path, "%s%s", PTSNODENAME, port);
- }
- } else {
- (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid());
- }
-
-#ifdef HAS_STICKY_DIR_BIT
- mode = 01777;
-#else
- mode = 0777;
-#endif
- if (trans_mkdir(X_STREAMS_DIR, mode) == -1) {
- prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n",
- X_STREAMS_DIR, errno);
- return(-1);
- }
-
-#if 0
- if( (fd=open(server_path, O_RDWR)) >= 0 ) {
- /*
- * This doesn't prevent the server from starting up, and doesn't
- * prevent clients from trying to connect to the in-use PTS (which
- * is often in use by something other than another server).
- */
- prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port);
- prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path);
- close(fd);
- return(-1);
- }
-#else
- /* Just remove the old path (which is what happens with UNIXCONN) */
-#endif
-
- unlink(server_path);
-
- if( (fd=open(DEV_PTMX, O_RDWR)) < 0) {
- prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX);
- return(-1);
- }
-
- grantpt(fd);
- unlockpt(fd);
-
- if( (slave=ptsname(fd)) == NULL) {
- prmsg(1, "PTSOpenServer: Unable to get slave device name\n");
- close(fd);
- return(-1);
- }
-
- if( link(slave,server_path) < 0 ) {
- prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path);
- close(fd);
- return(-1);
- }
-
- if( chmod(server_path, 0666) < 0 ) {
- prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path);
- close(fd);
- return(-1);
- }
-
- if( (server=open(server_path, O_RDWR)) < 0 ) {
- prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path);
- close(fd);
- return(-1);
- }
-
- close(server);
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
- {
- prmsg(1,"PTSOpenServer: failed to fill in addr info\n");
- close(fd);
- return -1;
- }
-
- return fd;
-
-#endif /* !PTSNODENAME */
-}
-
-static int
-TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
-
-{
- int newfd;
- int in;
- unsigned char length;
- char buf[256];
- struct sockaddr_un *sunaddr;
-
- prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd);
-
- if( (in=read(ciptr->fd,&length,1)) <= 0 ){
- if( !in ) {
- prmsg(2,
- "PTSAccept: Incoming connection closed\n");
- }
- else {
- prmsg(1,
- "PTSAccept: Error reading incoming connection. errno=%d \n",
- errno);
- }
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- if( (in=read(ciptr->fd,buf,length)) <= 0 ){
- if( !in ) {
- prmsg(2,
- "PTSAccept: Incoming connection closed\n");
- }
- else {
- prmsg(1,
-"PTSAccept: Error reading device name for new connection. errno=%d \n",
- errno);
- }
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- buf[length] = '\0';
-
- if( (newfd=open(buf,O_RDWR)) < 0 ) {
- prmsg(1, "PTSAccept: Failed to open %s\n",buf);
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- write(newfd,"1",1);
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- newciptr->addrlen=ciptr->addrlen;
- if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) {
- prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n");
- close(newfd);
- *status = TRANS_ACCEPT_BAD_MALLOC;
- return -1;
- }
-
- memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen);
-
- newciptr->peeraddrlen=sizeof(struct sockaddr_un);
- if( (sunaddr = malloc(newciptr->peeraddrlen)) == NULL ) {
- prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n");
- free(newciptr->addr);
- close(newfd);
- *status = TRANS_ACCEPT_BAD_MALLOC;
- return -1;
- }
-
- sunaddr->sun_family=AF_UNIX;
- strcpy(sunaddr->sun_path,buf);
-#if defined(BSD44SOCKETS)
- sunaddr->sun_len=strlen(sunaddr->sun_path);
-#endif
-
- newciptr->peeraddr=(char *)sunaddr;
-
- *status = 0;
-
- return newfd;
-}
-
-#endif /* TRANS_SERVER */
-#endif /* LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
@@ -664,9 +254,6 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port)
int fd;
char server_path[64];
struct stat filestat;
-# ifndef __sun
- extern int isastream(int);
-# endif
#endif
prmsg(2,"NAMEDOpenClient(%s)\n", port);
@@ -929,46 +516,6 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
#ifdef TRANS_REOPEN
-#ifdef LOCAL_TRANS_PTS
-
-static int
-TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
-
-{
-#ifdef PTSNODENAME
- char server_path[64];
-#endif
-
- prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port);
-
-#if !defined(PTSNODENAME)
- prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n");
- return 0;
-#else
- if (port && *port ) {
- if( *port == '/' ) { /* A full pathname */
- snprintf(server_path, sizeof(server_path), "%s", port);
- } else {
- snprintf(server_path, sizeof(server_path), "%s%s",
- PTSNODENAME, port);
- }
- } else {
- snprintf(server_path, sizeof(server_path), "%s%ld",
- PTSNODENAME, (long)getpid());
- }
-
- if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
- {
- prmsg(1,"PTSReopenServer: failed to fill in addr info\n");
- return 0;
- }
-
- return 1;
-
-#endif /* !PTSNODENAME */
-}
-
-#endif /* LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
@@ -1088,76 +635,6 @@ typedef struct _LOCALtrans2dev {
} LOCALtrans2dev;
static LOCALtrans2dev LOCALtrans2devtab[] = {
-#ifdef LOCAL_TRANS_PTS
-{"",
-#ifdef TRANS_CLIENT
- TRANS(PTSOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(PTSOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(PTSReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(PTSAccept)
-#endif /* TRANS_SERVER */
-},
-
-{"local",
-#ifdef TRANS_CLIENT
- TRANS(PTSOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(PTSOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(PTSReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(PTSAccept)
-#endif /* TRANS_SERVER */
-},
-
-{"pts",
-#ifdef TRANS_CLIENT
- TRANS(PTSOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(PTSOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(PTSReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(PTSAccept)
-#endif /* TRANS_SERVER */
-},
-#else /* !LOCAL_TRANS_PTS */
{"",
#ifdef TRANS_CLIENT
TRANS(NAMEDOpenClient),
@@ -1203,7 +680,6 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
TRANS(NAMEDAccept)
#endif /* TRANS_SERVER */
},
-#endif /* !LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
{"named",
@@ -1229,7 +705,6 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
#endif /* TRANS_SERVER */
},
-#ifdef __sun /* Alias "pipe" to named, since that's what Solaris called it */
{"pipe",
#ifdef TRANS_CLIENT
TRANS(NAMEDOpenClient),
@@ -1252,7 +727,6 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
TRANS(NAMEDAccept)
#endif /* TRANS_SERVER */
},
-#endif /* __sun */
#endif /* LOCAL_TRANS_NAMED */
@@ -1264,11 +738,7 @@ static const char *XLOCAL=NULL;
static char *workingXLOCAL=NULL;
static char *freeXLOCAL=NULL;
-#if defined(__sun)
#define DEF_XLOCAL "UNIX:NAMED"
-#else
-#define DEF_XLOCAL "UNIX:PTS:NAMED"
-#endif
static void
TRANS(LocalInitTransports)(const char *protocol)
@@ -1874,13 +1344,8 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
#ifdef TRANS_SERVER
static const char * local_aliases[] = {
-# ifdef LOCAL_TRANS_PTS
- "pts",
-# endif
"named",
-# ifdef __sun
"pipe", /* compatibility with Solaris Xlib */
-# endif
NULL };
#endif
@@ -1921,46 +1386,6 @@ Xtransport TRANS(LocalFuncs) = {
TRANS(LocalCloseForCloning),
};
-#ifdef LOCAL_TRANS_PTS
-
-Xtransport TRANS(PTSFuncs) = {
- /* Local Interface */
- "pts",
- TRANS_LOCAL,
-#ifdef TRANS_CLIENT
- TRANS(LocalOpenCOTSClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- NULL,
- TRANS(LocalOpenCOTSServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(LocalReopenCOTSServer),
-#endif
- TRANS(LocalSetOption),
-#ifdef TRANS_SERVER
- TRANS(LocalCreateListener),
- TRANS(LocalResetListener),
- TRANS(LocalAccept),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(LocalConnect),
-#endif /* TRANS_CLIENT */
- TRANS(LocalBytesReadable),
- TRANS(LocalRead),
- TRANS(LocalWrite),
- TRANS(LocalReadv),
- TRANS(LocalWritev),
-#if XTRANS_SEND_FDS
- TRANS(LocalSendFdInvalid),
- TRANS(LocalRecvFdInvalid),
-#endif
- TRANS(LocalDisconnect),
- TRANS(LocalClose),
- TRANS(LocalCloseForCloning),
-};
-
-#endif /* LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
@@ -2001,7 +1426,6 @@ Xtransport TRANS(NAMEDFuncs) = {
TRANS(LocalCloseForCloning),
};
-#ifdef __sun
Xtransport TRANS(PIPEFuncs) = {
/* Local Interface */
"pipe",
@@ -2038,7 +1462,6 @@ Xtransport TRANS(PIPEFuncs) = {
TRANS(LocalClose),
TRANS(LocalCloseForCloning),
};
-#endif /* __sun */
#endif /* LOCAL_TRANS_NAMED */
diff --git a/xtrans.m4 b/xtrans.m4
index 7c50bd9..0a5c5c1 100644
--- a/xtrans.m4
+++ b/xtrans.m4
@@ -122,7 +122,7 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
XTRANS_TCP_FLAGS
fi
[case $host_os in
- solaris*|sysv4*) localdef="yes" ;;
+ solaris*) localdef="yes" ;;
*) localdef="no" ;;
esac]
AC_ARG_ENABLE(local-transport,