aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/programs/Xserver/os/access.c17
-rw-r--r--nx-X11/programs/Xserver/os/connection.c1
-rw-r--r--nx-X11/programs/Xserver/os/osdep.h4
3 files changed, 19 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c
index d745bde3a..e9d5d8ae8 100644
--- a/nx-X11/programs/Xserver/os/access.c
+++ b/nx-X11/programs/Xserver/os/access.c
@@ -1217,12 +1217,17 @@ ResetHosts (char *display)
}
/* Is client on the local host */
-Bool LocalClient(ClientPtr client)
+Bool
+ComputeLocalClient(ClientPtr client)
{
int alen, family, notused;
Xtransaddr *from = NULL;
void *addr;
register HOST *host;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
+
+ if (!oc->trans_conn)
+ return FALSE;
#ifdef XCSECURITY
/* untrusted clients can't change host access */
@@ -1233,8 +1238,7 @@ Bool LocalClient(ClientPtr client)
return FALSE;
}
#endif
- if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
- &notused, &alen, &from))
+ if (!_XSERVTransGetPeerAddr (oc->trans_conn, &notused, &alen, &from))
{
family = ConvertAddr ((struct sockaddr *) from,
&alen, (void **)&addr);
@@ -1260,6 +1264,13 @@ Bool LocalClient(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
*
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index 538996198..cee621384 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -754,6 +754,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
free (oc);
return NullClient;
}
+ oc->local_client = ComputeLocalClient(client);
{
#if !defined(WIN32)
ConnectionTranslation[fd] = client->index;
diff --git a/nx-X11/programs/Xserver/os/osdep.h b/nx-X11/programs/Xserver/os/osdep.h
index dc66649dc..709f33943 100644
--- a/nx-X11/programs/Xserver/os/osdep.h
+++ b/nx-X11/programs/Xserver/os/osdep.h
@@ -176,6 +176,7 @@ 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(
@@ -239,6 +240,9 @@ typedef long int fd_mask;
#define ffs mffs
extern int mffs(fd_mask);
+/* in access.c */
+extern Bool ComputeLocalClient(ClientPtr client);
+
/* in auth.c */
extern void GenerateRandomData (int len, char *buf);