Compare commits
4 Commits
scaling-mr
...
XACE-SELIN
Author | SHA1 | Date | |
---|---|---|---|
|
c46728b819 | ||
|
716be2e5ec | ||
|
9e0eb0615c | ||
|
67fd0cc248 |
|
@ -887,7 +887,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
{
|
||||
XacePropertyAccessRec *rec = calldata;
|
||||
SecurityStateRec *subj, *obj;
|
||||
ATOM name = rec->pProp->propertyName;
|
||||
ATOM name = (*rec->ppProp)->propertyName;
|
||||
Mask requested = rec->access_mode;
|
||||
Mask allowed = SecurityAllowedMask | DixReadAccess;
|
||||
|
||||
|
|
|
@ -56,9 +56,9 @@ int XaceHookDispatch(ClientPtr client, int major)
|
|||
}
|
||||
|
||||
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||
PropertyPtr pProp, Mask access_mode)
|
||||
PropertyPtr *ppProp, Mask access_mode)
|
||||
{
|
||||
XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success };
|
||||
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ extern int XaceHook(
|
|||
*/
|
||||
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
||||
extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||
PropertyPtr pProp, Mask access_mode);
|
||||
PropertyPtr *ppProp, Mask access_mode);
|
||||
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||
|
||||
/* Register a callback for a given hook.
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
ClientPtr client;
|
||||
WindowPtr pWin;
|
||||
PropertyPtr pProp;
|
||||
PropertyPtr *ppProp;
|
||||
Mask access_mode;
|
||||
int status;
|
||||
} XacePropertyAccessRec;
|
||||
|
|
126
Xext/xselinux.c
126
Xext/xselinux.c
|
@ -250,6 +250,62 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
|||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Looks up the SID corresponding to the given property name
|
||||
*/
|
||||
static int
|
||||
SELinuxPropertyToSID(Atom propertyName, security_id_t ssid,
|
||||
security_id_t *sid_rtn, int *poly_rtn)
|
||||
{
|
||||
const char *name = NameForAtom(propertyName);
|
||||
security_context_t con;
|
||||
security_id_t tsid;
|
||||
int poly = 1;
|
||||
|
||||
/* Look in the mappings of property names to contexts */
|
||||
if (selabel_lookup(label_hnd, &con, name, SELABEL_X_PROP) == 0) {
|
||||
poly = 0;
|
||||
} else if (errno != ENOENT) {
|
||||
ErrorF("SELinux: a property label lookup failed!\n");
|
||||
return BadValue;
|
||||
} else if (selabel_lookup(label_hnd, &con, name, SELABEL_X_POLYPROP) < 0) {
|
||||
ErrorF("SELinux: a property label lookup failed!\n");
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (poly_rtn)
|
||||
*poly_rtn = poly;
|
||||
|
||||
/* Get a SID for context */
|
||||
if (avc_context_to_sid(con, &tsid) < 0) {
|
||||
ErrorF("SELinux: a context_to_SID call failed!\n");
|
||||
freecon(con);
|
||||
return BadAlloc;
|
||||
}
|
||||
freecon(con);
|
||||
|
||||
/* Perform a transition */
|
||||
if (avc_compute_create(ssid, tsid, SECCLASS_X_PROPERTY, sid_rtn) < 0) {
|
||||
ErrorF("SELinux: a compute_create call failed!\n");
|
||||
sidput(tsid);
|
||||
return BadValue;
|
||||
}
|
||||
sidput(tsid);
|
||||
|
||||
/* Polyinstantiate if necessary to obtain the final SID */
|
||||
if (poly) {
|
||||
tsid = *sid_rtn;
|
||||
if (avc_compute_member(ssid, tsid, SECCLASS_X_PROPERTY, sid_rtn) < 0) {
|
||||
ErrorF("SELinux: a compute_member call failed!\n");
|
||||
sidput(tsid);
|
||||
return BadValue;
|
||||
}
|
||||
sidput(tsid);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the object class corresponding to the given resource type.
|
||||
*/
|
||||
|
@ -677,46 +733,48 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
XacePropertyAccessRec *rec = calldata;
|
||||
SELinuxSubjectRec *subj;
|
||||
SELinuxObjectRec *obj;
|
||||
SELinuxAuditRec auditdata = { .client = rec->client };
|
||||
PropertyPtr pProp = *rec->ppProp;
|
||||
Atom name = pProp->propertyName;
|
||||
SELinuxAuditRec auditdata = { .client = rec->client, .property = name };
|
||||
int rc;
|
||||
|
||||
subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
|
||||
obj = dixLookupPrivate(&rec->pProp->devPrivates, objectKey);
|
||||
obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
|
||||
|
||||
/* If this is a new object that needs labeling, do it now */
|
||||
if (rec->access_mode & DixCreateAccess) {
|
||||
const char *name = NameForAtom(rec->pProp->propertyName);
|
||||
security_context_t con;
|
||||
security_id_t sid;
|
||||
|
||||
/* Look in the mappings of property names to contexts */
|
||||
if (selabel_lookup(label_hnd, &con, name, SELABEL_X_PROP) < 0) {
|
||||
ErrorF("SELinux: a property label lookup failed!\n");
|
||||
rec->status = BadValue;
|
||||
return;
|
||||
}
|
||||
/* Get a SID for context */
|
||||
if (avc_context_to_sid(con, &sid) < 0) {
|
||||
ErrorF("SELinux: a context_to_SID call failed!\n");
|
||||
rec->status = BadAlloc;
|
||||
return;
|
||||
}
|
||||
|
||||
sidput(obj->sid);
|
||||
|
||||
/* Perform a transition to obtain the final SID */
|
||||
if (avc_compute_create(subj->sid, sid, SECCLASS_X_PROPERTY,
|
||||
&obj->sid) < 0) {
|
||||
ErrorF("SELinux: a SID transition call failed!\n");
|
||||
freecon(con);
|
||||
rec->status = BadValue;
|
||||
rc = SELinuxPropertyToSID(name, subj->sid, &obj->sid, &obj->poly);
|
||||
if (rc != Success) {
|
||||
rec->status = rc;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* If this is a polyinstantiated object, find the right instance */
|
||||
else if (obj->poly) {
|
||||
security_id_t tsid;
|
||||
rc = SELinuxPropertyToSID(name, subj->sid, &tsid, NULL);
|
||||
if (rc != Success) {
|
||||
rec->status = rc;
|
||||
return;
|
||||
}
|
||||
|
||||
while (pProp->propertyName != name || obj->sid != tsid) {
|
||||
if ((pProp = pProp->next) == NULL)
|
||||
break;
|
||||
obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
|
||||
}
|
||||
sidput(tsid);
|
||||
|
||||
if (pProp)
|
||||
*rec->ppProp = pProp;
|
||||
else {
|
||||
rec->status = BadMatch;
|
||||
return;
|
||||
}
|
||||
freecon(con);
|
||||
}
|
||||
|
||||
/* Perform the security check */
|
||||
auditdata.property = rec->pProp->propertyName;
|
||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_PROPERTY, rec->access_mode,
|
||||
&auditdata);
|
||||
if (rc != Success)
|
||||
|
@ -1226,16 +1284,8 @@ ProcSELinuxGetPropertyContext(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
pProp = wUserProps(pWin);
|
||||
while (pProp) {
|
||||
if (pProp->propertyName == stuff->property)
|
||||
break;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
if (!pProp)
|
||||
return BadValue;
|
||||
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess);
|
||||
rc = dixLookupProperty(&pProp, pWin, stuff->property, client,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
223
dix/property.c
223
dix/property.c
|
@ -63,11 +63,10 @@ SOFTWARE.
|
|||
/*****************************************************************
|
||||
* Property Stuff
|
||||
*
|
||||
* ChangeProperty, DeleteProperty, GetProperties,
|
||||
* ListProperties
|
||||
* dixLookupProperty, dixChangeProperty, DeleteProperty
|
||||
*
|
||||
* Properties below to windows. A allocate slots each time
|
||||
* a property is added. No fancy searching done.
|
||||
* Properties belong to windows. The list of properties should not be
|
||||
* traversed directly. Instead, use the three functions listed above.
|
||||
*
|
||||
*****************************************************************/
|
||||
|
||||
|
@ -91,17 +90,22 @@ PrintPropertys(WindowPtr pWin)
|
|||
}
|
||||
#endif
|
||||
|
||||
static _X_INLINE PropertyPtr
|
||||
FindProperty(WindowPtr pWin, Atom propertyName)
|
||||
_X_EXPORT int
|
||||
dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
|
||||
ClientPtr client, Mask access_mode)
|
||||
{
|
||||
PropertyPtr pProp = wUserProps(pWin);
|
||||
while (pProp)
|
||||
{
|
||||
PropertyPtr pProp;
|
||||
int rc = BadMatch;
|
||||
client->errorValue = propertyName;
|
||||
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||
if (pProp->propertyName == propertyName)
|
||||
break;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
return pProp;
|
||||
|
||||
if (pProp)
|
||||
rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
|
||||
*result = pProp;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -125,65 +129,69 @@ ProcRotateProperties(ClientPtr client)
|
|||
WindowPtr pWin;
|
||||
Atom * atoms;
|
||||
PropertyPtr * props; /* array of pointer */
|
||||
PropertyPtr pProp;
|
||||
PropertyPtr pProp, saved;
|
||||
|
||||
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
|
||||
if (rc != Success)
|
||||
if (rc != Success || stuff->nAtoms <= 0)
|
||||
return rc;
|
||||
if (!stuff->nAtoms)
|
||||
return(Success);
|
||||
|
||||
atoms = (Atom *) & stuff[1];
|
||||
props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr));
|
||||
if (!props)
|
||||
return(BadAlloc);
|
||||
saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec));
|
||||
if (!props || !saved) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < stuff->nAtoms; i++)
|
||||
{
|
||||
if (!ValidAtom(atoms[i])) {
|
||||
xfree(props);
|
||||
rc = BadAtom;
|
||||
client->errorValue = atoms[i];
|
||||
return BadAtom;
|
||||
goto out;
|
||||
}
|
||||
for (j = i + 1; j < stuff->nAtoms; j++)
|
||||
if (atoms[j] == atoms[i])
|
||||
{
|
||||
xfree(props);
|
||||
return BadMatch;
|
||||
rc = BadMatch;
|
||||
goto out;
|
||||
}
|
||||
pProp = FindProperty(pWin, atoms[i]);
|
||||
if (!pProp) {
|
||||
xfree(props);
|
||||
return BadMatch;
|
||||
}
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp,
|
||||
DixReadAccess|DixWriteAccess);
|
||||
if (rc != Success) {
|
||||
xfree(props);
|
||||
client->errorValue = atoms[i];
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
|
||||
DixReadAccess|DixWriteAccess);
|
||||
if (rc != Success)
|
||||
goto out;
|
||||
|
||||
props[i] = pProp;
|
||||
saved[i] = *pProp;
|
||||
}
|
||||
delta = stuff->nPositions;
|
||||
|
||||
/* If the rotation is a complete 360 degrees, then moving the properties
|
||||
around and generating PropertyNotify events should be skipped. */
|
||||
|
||||
if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 )
|
||||
if (abs(delta) % stuff->nAtoms)
|
||||
{
|
||||
while (delta < 0) /* faster if abs value is small */
|
||||
delta += stuff->nAtoms;
|
||||
for (i = 0; i < stuff->nAtoms; i++)
|
||||
{
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue,
|
||||
props[i]->propertyName);
|
||||
|
||||
props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
|
||||
j = (i + delta) % stuff->nAtoms;
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
|
||||
|
||||
/* Preserve name and devPrivates */
|
||||
props[j]->type = saved[i].type;
|
||||
props[j]->format = saved[i].format;
|
||||
props[j]->size = saved[i].size;
|
||||
props[j]->data = saved[i].data;
|
||||
}
|
||||
}
|
||||
out:
|
||||
xfree(saved);
|
||||
xfree(props);
|
||||
return Success;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -253,9 +261,9 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
totalSize = len * sizeInBytes;
|
||||
|
||||
/* first see if property already exists */
|
||||
pProp = FindProperty(pWin, property);
|
||||
rc = dixLookupProperty(&pProp, pWin, property, pClient, DixWriteAccess);
|
||||
|
||||
if (!pProp) /* just add to list */
|
||||
if (rc == BadMatch) /* just add to list */
|
||||
{
|
||||
if (!pWin->optional && !MakeWindowOptional (pWin))
|
||||
return(BadAlloc);
|
||||
|
@ -276,7 +284,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
memmove((char *)data, (char *)value, totalSize);
|
||||
pProp->size = len;
|
||||
pProp->devPrivates = NULL;
|
||||
rc = XaceHookPropertyAccess(pClient, pWin, pProp,
|
||||
rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
|
||||
DixCreateAccess|DixWriteAccess);
|
||||
if (rc != Success) {
|
||||
xfree(data);
|
||||
|
@ -287,13 +295,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
pProp->next = pWin->optional->userProps;
|
||||
pWin->optional->userProps = pProp;
|
||||
}
|
||||
else
|
||||
else if (rc == Success)
|
||||
{
|
||||
rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess);
|
||||
if (rc != Success) {
|
||||
pClient->errorValue = property;
|
||||
return rc;
|
||||
}
|
||||
/* To append or prepend to a property the request format and type
|
||||
must match those of the already defined property. The
|
||||
existing format and type are irrelevant when using the mode
|
||||
|
@ -347,6 +350,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
pProp->size += len;
|
||||
}
|
||||
}
|
||||
else
|
||||
return rc;
|
||||
|
||||
if (sendevent)
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
|
||||
|
@ -369,37 +374,29 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
|
|||
PropertyPtr pProp, prevProp;
|
||||
int rc;
|
||||
|
||||
if (!(pProp = wUserProps (pWin)))
|
||||
return(Success);
|
||||
prevProp = (PropertyPtr)NULL;
|
||||
while (pProp)
|
||||
{
|
||||
if (pProp->propertyName == propName)
|
||||
break;
|
||||
prevProp = pProp;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
if (pProp)
|
||||
{
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess);
|
||||
if (rc == BadMatch)
|
||||
return Success; /* Succeed if property does not exist */
|
||||
|
||||
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
|
||||
{
|
||||
if (rc == Success) {
|
||||
if (pWin->optional->userProps == pProp) {
|
||||
/* Takes care of head */
|
||||
if (!(pWin->optional->userProps = pProp->next))
|
||||
CheckWindowOptionalNeed (pWin);
|
||||
}
|
||||
else
|
||||
{
|
||||
prevProp->next = pProp->next;
|
||||
}
|
||||
} else {
|
||||
/* Need to traverse to find the previous element */
|
||||
prevProp = pWin->optional->userProps;
|
||||
while (prevProp->next != pProp)
|
||||
prevProp = prevProp->next;
|
||||
prevProp->next = pProp->next;
|
||||
}
|
||||
|
||||
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
|
||||
dixFreePrivates(pProp->devPrivates);
|
||||
xfree(pProp->data);
|
||||
xfree(pProp);
|
||||
}
|
||||
return(Success);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -453,15 +450,16 @@ ProcGetProperty(ClientPtr client)
|
|||
int rc;
|
||||
WindowPtr pWin;
|
||||
xGetPropertyReply reply;
|
||||
Mask access_mode = DixGetPropAccess;
|
||||
Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess;
|
||||
REQUEST(xGetPropertyReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xGetPropertyReq);
|
||||
if (stuff->delete) {
|
||||
UpdateCurrentTime();
|
||||
access_mode |= DixSetPropAccess;
|
||||
win_mode |= DixSetPropAccess;
|
||||
prop_mode |= DixDestroyAccess;
|
||||
}
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, win_mode);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -481,30 +479,14 @@ ProcGetProperty(ClientPtr client)
|
|||
return(BadAtom);
|
||||
}
|
||||
|
||||
pProp = wUserProps (pWin);
|
||||
prevProp = (PropertyPtr)NULL;
|
||||
while (pProp)
|
||||
{
|
||||
if (pProp->propertyName == stuff->property)
|
||||
break;
|
||||
prevProp = pProp;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
if (!pProp)
|
||||
|
||||
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
|
||||
if (rc == BadMatch)
|
||||
return NullPropertyReply(client, None, 0, &reply);
|
||||
|
||||
access_mode = DixReadAccess;
|
||||
if (stuff->delete)
|
||||
access_mode |= DixDestroyAccess;
|
||||
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode);
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->property;
|
||||
else if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* If the request type and actual type don't match. Return the
|
||||
property information, but not the data. */
|
||||
|
@ -560,15 +542,20 @@ ProcGetProperty(ClientPtr client)
|
|||
(char *)pProp->data + ind);
|
||||
}
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
{ /* delete the Property */
|
||||
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
|
||||
{
|
||||
if (!(pWin->optional->userProps = pProp->next))
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
/* Delete the Property */
|
||||
if (pWin->optional->userProps == pProp) {
|
||||
/* Takes care of head */
|
||||
if (!(pWin->optional->userProps = pProp->next))
|
||||
CheckWindowOptionalNeed (pWin);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
/* Need to traverse to find the previous element */
|
||||
prevProp = pWin->optional->userProps;
|
||||
while (prevProp->next != pProp)
|
||||
prevProp = prevProp->next;
|
||||
prevProp->next = pProp->next;
|
||||
}
|
||||
|
||||
dixFreePrivates(pProp->devPrivates);
|
||||
xfree(pProp->data);
|
||||
xfree(pProp);
|
||||
|
@ -583,7 +570,7 @@ ProcListProperties(ClientPtr client)
|
|||
xListPropertiesReply xlpr;
|
||||
int rc, numProps = 0;
|
||||
WindowPtr pWin;
|
||||
PropertyPtr pProp;
|
||||
PropertyPtr pProp, realProp;
|
||||
REQUEST(xResourceReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xResourceReq);
|
||||
|
@ -591,34 +578,34 @@ ProcListProperties(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
pProp = wUserProps (pWin);
|
||||
while (pProp)
|
||||
{
|
||||
pProp = pProp->next;
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||
numProps++;
|
||||
|
||||
if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
|
||||
return BadAlloc;
|
||||
|
||||
numProps = 0;
|
||||
temppAtoms = pAtoms;
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
|
||||
realProp = pProp;
|
||||
rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
|
||||
if (rc == Success && realProp == pProp) {
|
||||
*temppAtoms++ = pProp->propertyName;
|
||||
numProps++;
|
||||
}
|
||||
}
|
||||
if (numProps)
|
||||
if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
|
||||
return(BadAlloc);
|
||||
|
||||
xlpr.type = X_Reply;
|
||||
xlpr.nProperties = numProps;
|
||||
xlpr.length = (numProps * sizeof(Atom)) >> 2;
|
||||
xlpr.sequenceNumber = client->sequence;
|
||||
pProp = wUserProps (pWin);
|
||||
temppAtoms = pAtoms;
|
||||
while (pProp)
|
||||
{
|
||||
*temppAtoms++ = pProp->propertyName;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
|
||||
if (numProps)
|
||||
{
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
|
||||
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
|
||||
xfree(pAtoms);
|
||||
}
|
||||
xfree(pAtoms);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
|
|
|
@ -173,12 +173,11 @@ xf86CreateRootWindow(WindowPtr pWin)
|
|||
Atom prop;
|
||||
|
||||
prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
|
||||
err = ChangeWindowProperty(pWin,
|
||||
prop, pProp->type,
|
||||
pProp->format, PropModeReplace,
|
||||
pProp->size, pProp->data,
|
||||
FALSE
|
||||
);
|
||||
err = dixChangeWindowProperty(serverClient, pWin,
|
||||
prop, pProp->type,
|
||||
pProp->format, PropModeReplace,
|
||||
pProp->size, pProp->data,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Look at err */
|
||||
|
|
|
@ -193,6 +193,7 @@ _X_HIDDEN void *dixLookupTab[] = {
|
|||
SYMFUNC(XineramaGetCursorScreen)
|
||||
#endif
|
||||
/* property.c */
|
||||
SYMFUNC(dixLookupProperty)
|
||||
SYMFUNC(ChangeWindowProperty)
|
||||
SYMFUNC(dixChangeWindowProperty)
|
||||
/* extension.c */
|
||||
|
|
|
@ -115,7 +115,7 @@ GetPropString(
|
|||
if(atom != BAD_RESOURCE)
|
||||
{
|
||||
WindowPtr pPropWin;
|
||||
int n;
|
||||
int rc, n;
|
||||
|
||||
/*
|
||||
* The atom has been defined, but it might only exist as a
|
||||
|
@ -124,15 +124,12 @@ GetPropString(
|
|||
for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
|
||||
pPropWin = pPropWin->parent)
|
||||
{
|
||||
for(pProp = (PropertyPtr)(wUserProps(pPropWin));
|
||||
pProp != (PropertyPtr)NULL;
|
||||
pProp = pProp->next)
|
||||
{
|
||||
if (pProp->propertyName == atom)
|
||||
break;
|
||||
}
|
||||
if(pProp != (PropertyPtr)NULL)
|
||||
break;
|
||||
rc = dixLookupProperty(&pProp, pPropWin, atom,
|
||||
serverClient, DixReadAccess);
|
||||
if (rc == Success)
|
||||
break;
|
||||
else
|
||||
pProp = NULL;
|
||||
}
|
||||
if(pProp == (PropertyPtr)NULL)
|
||||
return (char *)NULL;
|
||||
|
|
|
@ -128,9 +128,9 @@ PclCreateWindow(
|
|||
{
|
||||
propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
|
||||
TRUE);
|
||||
ChangeWindowProperty(pWin, propName, XA_STRING, 8,
|
||||
PropModeReplace, strlen(propVal),
|
||||
(pointer)propVal, FALSE);
|
||||
dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
|
||||
8, PropModeReplace, strlen(propVal),
|
||||
(pointer)propVal, FALSE);
|
||||
xfree(propVal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ GetPropString(
|
|||
if(atom != BAD_RESOURCE)
|
||||
{
|
||||
WindowPtr pPropWin;
|
||||
int n;
|
||||
int rc, n;
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -186,15 +186,12 @@ GetPropString(
|
|||
for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
|
||||
pPropWin = pPropWin->parent)
|
||||
{
|
||||
for(pProp = (PropertyPtr)(wUserProps(pPropWin));
|
||||
pProp != (PropertyPtr)NULL;
|
||||
pProp = pProp->next)
|
||||
{
|
||||
if (pProp->propertyName == atom)
|
||||
break;
|
||||
}
|
||||
if(pProp != (PropertyPtr)NULL)
|
||||
break;
|
||||
rc = dixLookupProperty(&pProp, pPropWin, atom,
|
||||
serverClient, DixReadAccess);
|
||||
if (rc == Success)
|
||||
break;
|
||||
else
|
||||
pProp = NULL;
|
||||
}
|
||||
if(pProp == (PropertyPtr)NULL)
|
||||
return (char *)NULL;
|
||||
|
|
|
@ -154,9 +154,9 @@ PsCreateWindow(WindowPtr pWin)
|
|||
{
|
||||
propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
|
||||
TRUE);
|
||||
ChangeWindowProperty(pWin, propName, XA_STRING, 8,
|
||||
PropModeReplace, strlen(propVal),
|
||||
(pointer)propVal, FALSE);
|
||||
dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
|
||||
8, PropModeReplace, strlen(propVal),
|
||||
(pointer)propVal, FALSE);
|
||||
xfree(propVal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,8 +154,8 @@ AppleWMSetScreenOrigin(
|
|||
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
|
||||
+ darwinMainScreenY);
|
||||
|
||||
ChangeWindowProperty(pWin, xa_native_screen_origin(), XA_INTEGER,
|
||||
32, PropModeReplace, 2, data, TRUE);
|
||||
dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
|
||||
XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
|
||||
}
|
||||
|
||||
/* Window managers can set the _APPLE_NO_ORDER_IN property on windows
|
||||
|
@ -169,15 +169,11 @@ AppleWMDoReorderWindow(
|
|||
{
|
||||
Atom atom;
|
||||
PropertyPtr prop;
|
||||
int rc;
|
||||
|
||||
atom = xa_apple_no_order_in();
|
||||
for (prop = wUserProps(pWin); prop != NULL; prop = prop->next)
|
||||
{
|
||||
if (prop->propertyName == atom && prop->type == atom)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess);
|
||||
return (rc == Success) && (prop->type == atom);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,18 +54,16 @@ extern int NumCurrentSelections;
|
|||
// Returns NULL if there is no cut text or there is not enough memory.
|
||||
static char * QuartzReadCutBuffer(void)
|
||||
{
|
||||
int i;
|
||||
int rc, i;
|
||||
char *text = NULL;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
PropertyPtr pProp;
|
||||
|
||||
pProp = wUserProps (WindowTable[pScreen->myNum]);
|
||||
while (pProp && pProp->propertyName != XA_CUT_BUFFER0) {
|
||||
pProp = pProp->next;
|
||||
}
|
||||
if (! pProp) continue;
|
||||
rc = dixLookupProperty(&pProp, WindowTable[pScreen->myNum],
|
||||
XA_CUT_BUFFER0, serverClient, DixReadAccess);
|
||||
if (rc != Success) continue;
|
||||
if (pProp->type != XA_STRING) continue;
|
||||
if (pProp->format != 8) continue;
|
||||
|
||||
|
@ -114,9 +112,9 @@ void QuartzReadPasteboard(void)
|
|||
ScreenPtr pScreen = screenInfo.screens[scrn];
|
||||
// Set the cut buffers on each screen
|
||||
// fixme really on each screen?
|
||||
ChangeWindowProperty(WindowTable[pScreen->myNum], XA_CUT_BUFFER0,
|
||||
XA_STRING, 8, PropModeReplace,
|
||||
strlen(text), (pointer)text, TRUE);
|
||||
dixChangeWindowProperty(serverClient, WindowTable[pScreen->myNum],
|
||||
XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
|
||||
strlen(text), (pointer)text, TRUE);
|
||||
}
|
||||
|
||||
// Undo any current X selection (similar to code in dispatch.c)
|
||||
|
|
|
@ -90,8 +90,8 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
|
|||
/* FIXME: move this to AppleWM extension */
|
||||
|
||||
data = native_id;
|
||||
ChangeWindowProperty(pFrame->win, xa_native_window_id(),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
|
||||
dixChangeWindowProperty(serverClient, pFrame->win, xa_native_window_id(),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1087,6 +1087,6 @@ winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame)
|
|||
/* FIXME: move this to WindowsWM extension */
|
||||
|
||||
lData = (long) pRLWinPriv->hWnd;
|
||||
ChangeWindowProperty (pFrame->win, AtmWindowsWmNativeHwnd (),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
|
||||
dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,13 @@ SOFTWARE.
|
|||
|
||||
typedef struct _Property *PropertyPtr;
|
||||
|
||||
extern int dixLookupProperty(
|
||||
PropertyPtr * /*result*/,
|
||||
WindowPtr /*pWin*/,
|
||||
Atom /*proprty*/,
|
||||
ClientPtr /*pClient*/,
|
||||
Mask /*access_mode*/);
|
||||
|
||||
extern int dixChangeWindowProperty(
|
||||
ClientPtr /*pClient*/,
|
||||
WindowPtr /*pWin*/,
|
||||
|
|
|
@ -181,8 +181,8 @@ set_screen_origin (WindowPtr pWin)
|
|||
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
|
||||
+ darwinMainScreenY);
|
||||
|
||||
ChangeWindowProperty (pWin, xa_native_screen_origin (), XA_INTEGER,
|
||||
32, PropModeReplace, 2, data, TRUE);
|
||||
dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
|
||||
XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -221,8 +221,8 @@ char * pval;
|
|||
ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
|
||||
out,len);
|
||||
}
|
||||
ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
|
||||
len,pval,True);
|
||||
dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8,
|
||||
PropModeReplace, len, pval, True);
|
||||
xfree(pval);
|
||||
return True;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user