summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-01-09 13:07:25 -0800
committerKeith Packard <keithp@keithp.com>2012-01-09 13:07:25 -0800
commit0b113f7cdf5228dccd51a749a339c8669e3f20ff (patch)
tree5fe6eb1f0b7b79194e6c5f7fdb9604b5a948068b /os
parent0b2c6491c5e5e1c9ba067299f3de61f5acee263b (diff)
parent777bf90abeac37087a3d0538b847742523d5acf2 (diff)
Diffstat (limited to 'os')
-rw-r--r--os/access.c9
-rw-r--r--os/connection.c16
-rw-r--r--os/io.c21
-rw-r--r--os/osdep.h23
4 files changed, 32 insertions, 37 deletions
diff --git a/os/access.c b/os/access.c
index b609442de..ed13d0a0d 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1045,13 +1045,6 @@ ComputeLocalClient(ClientPtr client)
return FALSE;
}
-Bool LocalClient(ClientPtr client)
-{
- if (!client->osPrivate)
- return FALSE;
- return ((OsCommPtr)client->osPrivate)->local_client;
-}
-
/*
* Return the uid and gid of a connected local client
*
@@ -1209,7 +1202,7 @@ AuthorizedClient(ClientPtr client)
if (rc != Success)
return rc;
- return LocalClient(client) ? Success : BadAccess;
+ return client->local ? Success : BadAccess;
}
/* Add a host to the access control list. This is the external interface
diff --git a/os/connection.c b/os/connection.c
index 8a677a7ef..2c90d72a9 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -745,7 +745,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
free(oc);
return NullClient;
}
- oc->local_client = ComputeLocalClient(client);
+ client->local = ComputeLocalClient(client);
#if !defined(WIN32)
ConnectionTranslation[fd] = client->index;
#else
@@ -873,6 +873,8 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure)
* Fail a connection due to lack of client or file descriptor space
************/
+#define BOTIMEOUT 200 /* in milliseconds */
+
static void
ErrorConnMax(XtransConnInfo trans_conn)
{
@@ -880,7 +882,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
xConnSetupPrefix csp;
char pad[3];
struct iovec iov[3];
- char byteOrder = 0;
+ char order = 0;
int whichbyte = 1;
struct timeval waittime;
fd_set mask;
@@ -893,16 +895,16 @@ ErrorConnMax(XtransConnInfo trans_conn)
FD_SET(fd, &mask);
(void)Select(fd + 1, &mask, NULL, NULL, &waittime);
/* try to read the byte-order of the connection */
- (void)_XSERVTransRead(trans_conn, &byteOrder, 1);
- if ((byteOrder == 'l') || (byteOrder == 'B'))
+ (void)_XSERVTransRead(trans_conn, &order, 1);
+ if (order == 'l' || order == 'B' || order == 'r' || order == 'R')
{
csp.success = xFalse;
csp.lengthReason = sizeof(NOROOM) - 1;
csp.length = (sizeof(NOROOM) + 2) >> 2;
csp.majorVersion = X_PROTOCOL;
csp.minorVersion = X_PROTOCOL_REVISION;
- if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
- (!(*(char *) &whichbyte) && (byteOrder == 'l')))
+ if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+ (!(*(char *) &whichbyte) && (order == 'l' || order == 'r')))
{
swaps(&csp.majorVersion);
swaps(&csp.minorVersion);
@@ -1030,7 +1032,7 @@ CloseDownConnection(ClientPtr client)
if (FlushCallback)
CallCallbacks(&FlushCallback, NULL);
- if (oc->output && oc->output->count)
+ if (oc->output)
FlushClient(client, oc, (char *)NULL, 0);
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
diff --git a/os/io.c b/os/io.c
index ebb821653..78b7260c7 100644
--- a/os/io.c
+++ b/os/io.c
@@ -84,6 +84,23 @@ SOFTWARE.
CallbackListPtr ReplyCallback;
CallbackListPtr FlushCallback;
+typedef struct _connectionInput {
+ struct _connectionInput *next;
+ char *buffer; /* contains current client input */
+ char *bufptr; /* pointer to current start of data */
+ int bufcnt; /* count of bytes in buffer */
+ int lenLastReq;
+ int size;
+ unsigned int ignoreBytes; /* bytes to ignore before the next request */
+} ConnectionInput, *ConnectionInputPtr;
+
+typedef struct _connectionOutput {
+ struct _connectionOutput *next;
+ unsigned char *buf;
+ int size;
+ int count;
+} ConnectionOutput, *ConnectionOutputPtr;
+
static ConnectionInputPtr AllocateInputBuffer(void);
static ConnectionOutputPtr AllocateOutputBuffer(void);
@@ -112,6 +129,8 @@ static OsCommPtr AvailableInput = (OsCommPtr)NULL;
((xBigReq *)(req))->length)
#define MAX_TIMES_PER 10
+#define BUFSIZE 4096
+#define BUFWATERMARK 8192
/*
* A lot of the code in this file manipulates a ConnectionInputPtr:
@@ -889,7 +908,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
long notWritten;
long todo;
- if (!oco)
+ if (!oco || !oco->count)
return 0;
written = 0;
padsize = padlength[extraCount & 3];
diff --git a/os/osdep.h b/os/osdep.h
index 71a7e44e3..c9add48ee 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -52,10 +52,6 @@ SOFTWARE.
#ifndef _OSDEP_H_
#define _OSDEP_H_ 1
-#define BOTIMEOUT 200 /* in milliseconds */
-#define BUFSIZE 4096
-#define BUFWATERMARK 8192
-
#if defined(XDMCP) || defined(HASXDMAUTH)
#include <X11/Xdmcp.h>
#endif
@@ -112,22 +108,8 @@ typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name,
unsigned data_length, char *data);
#endif
-typedef struct _connectionInput {
- struct _connectionInput *next;
- char *buffer; /* contains current client input */
- char *bufptr; /* pointer to current start of data */
- int bufcnt; /* count of bytes in buffer */
- int lenLastReq;
- int size;
- unsigned int ignoreBytes; /* bytes to ignore before the next request */
-} ConnectionInput, *ConnectionInputPtr;
-
-typedef struct _connectionOutput {
- struct _connectionOutput *next;
- int size;
- unsigned char *buf;
- int count;
-} ConnectionOutput, *ConnectionOutputPtr;
+typedef struct _connectionInput *ConnectionInputPtr;
+typedef struct _connectionOutput *ConnectionOutputPtr;
struct _osComm;
@@ -166,7 +148,6 @@ typedef struct _osComm {
XID auth_id; /* authorization id */
CARD32 conn_time; /* timestamp if not established, else 0 */
struct _XtransConnInfo *trans_conn; /* transport connection object */
- Bool local_client;
} OsCommRec, *OsCommPtr;
extern int FlushClient(