diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2008-03-31 17:34:07 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2008-03-31 19:22:53 -0400 |
commit | bde2890148683118eaec4140c206c5f90fb44fa0 (patch) | |
tree | 4aef28b3a0ccfeac8ef8f1aa6bb703587e09804f /Xext | |
parent | c26bccf4173a037aa403c511dd08fd63cbbed87a (diff) |
XSELinux: Add a request to get a client's context from a resource ID.
(cherry picked from commit 9f56fc580646a519875b5a1452738d8c6e1fa860)
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/xselinux.c | 33 | ||||
-rw-r--r-- | Xext/xselinux.h | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 2e059a4c3..1e3b4d66c 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -1473,6 +1473,24 @@ ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) } static int +ProcSELinuxGetClientContext(ClientPtr client) +{ + ClientPtr target; + SELinuxSubjectRec *subj; + int rc; + + REQUEST(SELinuxGetContextReq); + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + + rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + subj = dixLookupPrivate(&target->devPrivates, subjectKey); + return SELinuxSendContextReply(client, subj->sid); +} + +static int SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id, int *size) { @@ -1686,6 +1704,8 @@ ProcSELinuxDispatch(ClientPtr client) return ProcSELinuxGetSelectionContext(client, dataKey); case X_SELinuxListSelections: return ProcSELinuxListSelections(client); + case X_SELinuxGetClientContext: + return ProcSELinuxGetClientContext(client); default: return BadRequest; } @@ -1783,6 +1803,17 @@ SProcSELinuxListProperties(ClientPtr client) } static int +SProcSELinuxGetClientContext(ClientPtr client) +{ + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id, n); + return ProcSELinuxGetClientContext(client); +} + +static int SProcSELinuxDispatch(ClientPtr client) { REQUEST(xReq); @@ -1835,6 +1866,8 @@ SProcSELinuxDispatch(ClientPtr client) return SProcSELinuxGetSelectionContext(client, dataKey); case X_SELinuxListSelections: return ProcSELinuxListSelections(client); + case X_SELinuxGetClientContext: + return SProcSELinuxGetClientContext(client); default: return BadRequest; } diff --git a/Xext/xselinux.h b/Xext/xselinux.h index 2d0de3222..7c3ffdcb7 100644 --- a/Xext/xselinux.h +++ b/Xext/xselinux.h @@ -52,6 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define X_SELinuxGetSelectionContext 19 #define X_SELinuxGetSelectionDataContext 20 #define X_SELinuxListSelections 21 +#define X_SELinuxGetClientContext 22 typedef struct { CARD8 reqType; |