aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/access.c10
-rw-r--r--xorg-server/os/connection.c16
-rw-r--r--xorg-server/os/io.c22
-rw-r--r--xorg-server/os/osdep.h19
4 files changed, 32 insertions, 35 deletions
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c
index 550f2ed8c..104b6a713 100644
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@ -1007,14 +1007,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
*
@@ -1176,7 +1168,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/xorg-server/os/connection.c b/xorg-server/os/connection.c
index 721ad65b3..6cd8bcf43 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -764,7 +764,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
@@ -894,7 +894,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
xConnSetupPrefix csp;
char pad[3] = { 0, 0, 0 };
struct iovec iov[3];
- char byteOrder = 0;
+ char order = 0;
int whichbyte = 1;
struct timeval waittime;
fd_set mask;
@@ -907,15 +907,15 @@ 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);
swaps(&csp.length);
@@ -1038,8 +1038,8 @@ CloseDownConnection(ClientPtr client)
if (FlushCallback)
CallCallbacks(&FlushCallback, NULL);
- if (oc->output && oc->output->count)
- FlushClient(client, oc, (char *) NULL, 0);
+ if (oc->output)
+ FlushClient(client, oc, (char *) NULL, 0);
#ifdef XDMCP
XdmcpCloseDisplay(oc->fd);
#endif
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c
index e44db3933..2f091c417 100644
--- a/xorg-server/os/io.c
+++ b/xorg-server/os/io.c
@@ -82,6 +82,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;
+
+typedef struct _connectionOutput {
+ struct _connectionOutput *next;
+ unsigned char *buf;
+ int size;
+ int count;
+} ConnectionOutput;
+
static ConnectionInputPtr AllocateInputBuffer(void);
static ConnectionOutputPtr AllocateOutputBuffer(void);
@@ -846,10 +863,13 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
long todo;
if (!oco)
- return 0;
+ return 0;
written = 0;
padsize = padding_for_int32(extraCount);
notWritten = oco->count + extraCount + padsize;
+ if (!notWritten)
+ return 0;
+
todo = notWritten;
while (notWritten) {
long before = written; /* amount of whole thing written */
diff --git a/xorg-server/os/osdep.h b/xorg-server/os/osdep.h
index fff088701..0ccdb62ef 100644
--- a/xorg-server/os/osdep.h
+++ b/xorg-server/os/osdep.h
@@ -107,22 +107,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;
@@ -162,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(ClientPtr /*who */ ,