summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-03-21 14:39:00 -0400
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2007-03-21 14:39:00 -0400
commit9c144f8ac5cea25deaa543767dbaf371d029c608 (patch)
treee35a336f333e27f0b8170eed7755c99a6673aff0
parent2945deba1d4a7dce4f6dd0c568297a1c537fdfb4 (diff)
xace: add XACE_SELECTION_ACCESS hook for selection redirection/access.
-rw-r--r--Xext/xace.c10
-rw-r--r--Xext/xace.h15
-rw-r--r--Xext/xacestr.h8
-rw-r--r--dix/dispatch.c7
4 files changed, 29 insertions, 11 deletions
diff --git a/Xext/xace.c b/Xext/xace.c
index ee0f39c20..2b873cbf0 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -147,6 +147,16 @@ int XaceHook(int hook, ...)
prv = &rec.rval;
break;
}
+ case XACE_SELECTION_ACCESS: {
+ XaceSelectionAccessRec rec = {
+ va_arg(ap, ClientPtr),
+ va_arg(ap, Selection*),
+ TRUE /* default allow */
+ };
+ calldata = &rec;
+ prv = &rec.rval;
+ break;
+ }
case XACE_SITE_POLICY: {
XaceSitePolicyRec rec = {
va_arg(ap, char*),
diff --git a/Xext/xace.h b/Xext/xace.h
index 7360dae5b..020a047d0 100644
--- a/Xext/xace.h
+++ b/Xext/xace.h
@@ -50,13 +50,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_BACKGRND_ACCESS 7
#define XACE_EXT_ACCESS 8
#define XACE_HOSTLIST_ACCESS 9
-#define XACE_SITE_POLICY 10
-#define XACE_DECLARE_EXT_SECURE 11
-#define XACE_AUTH_AVAIL 12
-#define XACE_KEY_AVAIL 13
-#define XACE_AUDIT_BEGIN 14
-#define XACE_AUDIT_END 15
-#define XACE_NUM_HOOKS 16
+#define XACE_SELECTION_ACCESS 10
+#define XACE_SITE_POLICY 11
+#define XACE_DECLARE_EXT_SECURE 12
+#define XACE_AUTH_AVAIL 13
+#define XACE_KEY_AVAIL 14
+#define XACE_AUDIT_BEGIN 15
+#define XACE_AUDIT_END 16
+#define XACE_NUM_HOOKS 17
extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
diff --git a/Xext/xacestr.h b/Xext/xacestr.h
index bd3088381..4c480a4ea 100644
--- a/Xext/xacestr.h
+++ b/Xext/xacestr.h
@@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "windowstr.h"
#include "inputstr.h"
+#include "selection.h"
#include "xace.h"
/* XACE_CORE_DISPATCH */
@@ -93,6 +94,13 @@ typedef struct {
int rval;
} XaceHostlistAccessRec;
+/* XACE_SELECTION_ACCESS */
+typedef struct {
+ ClientPtr client;
+ Selection *selection;
+ int rval;
+} XaceSelectionAccessRec;
+
/* XACE_SITE_POLICY */
typedef struct {
char *policyString;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index d44687ec3..498f18a9c 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1113,7 +1113,8 @@ ProcGetSelectionOwner(register ClientPtr client)
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
- if (i < NumCurrentSelections)
+ if (i < NumCurrentSelections &&
+ XaceHook(XACE_SELECTION_ACCESS, client, &CurrentSelections[i]))
reply.owner = CurrentSelections[i].window;
else
reply.owner = None;
@@ -1153,9 +1154,7 @@ ProcConvertSelection(register ClientPtr client)
CurrentSelections[i].selection != stuff->selection) i++;
if ((i < NumCurrentSelections) &&
(CurrentSelections[i].window != None) &&
- XaceHook(XACE_RESOURCE_ACCESS, client,
- CurrentSelections[i].window, RT_WINDOW,
- DixReadAccess, CurrentSelections[i].pWin))
+ XaceHook(XACE_SELECTION_ACCESS, client, &CurrentSelections[i]))
{
event.u.u.type = SelectionRequest;
event.u.selectionRequest.time = stuff->time;