[PATCH] randr: stop clients from deleting immutable output properties

Luc Verhaegen libv at skynet.be
Wed Aug 10 04:06:33 PDT 2011


Immutable in randr means that clients are not able to alter the
property itself, they are only allowed to alter the property value.
This logically means that the property then should not be deleted
by the client either.

Signed-off-by: Luc Verhaegen <libv at codethink.co.uk>
Reviewed-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
---
 randr/rrproperty.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 61e7bb4..22fcf33 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -552,19 +552,38 @@ ProcRRDeleteOutputProperty (ClientPtr client)
 {
     REQUEST(xRRDeleteOutputPropertyReq);
     RROutputPtr	output;
-              
+    RRPropertyRec *prop, **prev;
+
     REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
     UpdateCurrentTime();
     VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
-    
+
     if (!ValidAtom(stuff->property))
     {
 	client->errorValue = stuff->property;
 	return BadAtom;
     }
 
+    for (prev = &output->properties; (prop = *prev); prev = &(prop->next))
+	if (prop->propertyName == stuff->property)
+	    break;
+
+    if (!prop)
+    {
+	client->errorValue = stuff->property;
+	return BadMatch;
+    }
+
+    if (prop->immutable)
+    {
+	client->errorValue = stuff->property;
+	return BadAccess;
+    }
+
+    *prev = prop->next;
+
+    RRDeleteProperty(output, prop);
 
-    RRDeleteOutputProperty(output, stuff->property);
     return Success;
 }
 
-- 
1.7.0.4



More information about the xorg-devel mailing list