[PATCH xserver 03/24] Xext, os: Remove OS-internal usages within XACE and XSELinux
Keith Packard
keithp at keithp.com
Sun Sep 20 23:16:14 PDT 2015
These extensions were accessing internal OS functions and
structures. Expose the necessary functionality to them and remove
their use of osdep.h
Signed-off-by: Keith Packard <keithp at keithp.com>
---
Xext/xace.c | 13 ++-----------
Xext/xselinux_hooks.c | 1 -
include/os.h | 7 +++++++
os/access.c | 14 ++++++++++++++
4 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/Xext/xace.c b/Xext/xace.c
index b3c67f6..fcb38db 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -29,11 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "xacestr.h"
-#define XSERV_t
-#define TRANS_SERVER
-#include <X11/Xtrans/Xtrans.h>
-#include "../os/osdep.h"
-
_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
/* Special-cased hook functions. Called by Xserver.
@@ -342,15 +337,11 @@ XaceCensorImage(ClientPtr client,
int
XaceGetConnectionNumber(ClientPtr client)
{
- XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
-
- return _XSERVTransGetConnectionNumber(ci);
+ return GetClientFd(client);
}
int
XaceIsLocal(ClientPtr client)
{
- XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
-
- return _XSERVTransIsLocal(ci);
+ return ClientIsLocal(client);
}
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index e69bfe7..d9f2f68 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -41,7 +41,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "extnsionst.h"
#include "xacestr.h"
#include "client.h"
-#include "../os/osdep.h"
#define _XSELINUX_NEED_FLASK_MAP
#include "xselinuxint.h"
diff --git a/include/os.h b/include/os.h
index b2b96c8..9937f2e 100644
--- a/include/os.h
+++ b/include/os.h
@@ -415,6 +415,7 @@ typedef struct {
extern _X_EXPORT int
GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
+
extern _X_EXPORT void
FreeLocalClientCreds(LocalClientCredRec *);
@@ -422,6 +423,12 @@ extern _X_EXPORT int
ChangeAccessControl(ClientPtr /*client */ , int /*fEnabled */ );
extern _X_EXPORT int
+GetClientFd(ClientPtr);
+
+extern _X_EXPORT Bool
+ClientIsLocal(ClientPtr client);
+
+extern _X_EXPORT int
GetAccessControl(void);
extern _X_EXPORT void
diff --git a/os/access.c b/os/access.c
index 75e7a69..2bde4fe 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1575,6 +1575,20 @@ GetAccessControl(void)
return AccessEnabled;
}
+int
+GetClientFd(ClientPtr client)
+{
+ return ((OsCommPtr) client->osPrivate)->fd;
+}
+
+Bool
+ClientIsLocal(ClientPtr client)
+{
+ XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
+
+ return _XSERVTransIsLocal(ci);
+}
+
/*****************************************************************************
* FamilyServerInterpreted host entry implementation
*
--
2.5.0
More information about the xorg-devel
mailing list