summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-07-30 14:45:21 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2013-08-01 14:51:41 +1000
commit500e844a24962c9e70abb3d614f1973013b2de73 (patch)
treea9ebdbb7ec388848e81004d62c67fb14614c43fc
parente1ab8f239bdc6af17ef6cd0e9c6187c4e2e2f5bc (diff)
Xi: Clamp XIClient maximal version to XIVersion
Do not allow setting client version to an arbitrary value >= XIVersion. Fixes a test error with test/xi2/protocol-xiqueryversion.c, introduced by commit 4360514d1c "Xi: Allow clients to ask for 2.3 and then 2.2 without failing" Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--Xi/xiqueryversion.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c
index 6c7b9c058..c705f788f 100644
--- a/Xi/xiqueryversion.c
+++ b/Xi/xiqueryversion.c
@@ -70,12 +70,21 @@ ProcXIQueryVersion(ClientPtr client)
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+ if (version_compare(XIVersion.major_version, XIVersion.minor_version,
+ stuff->major_version, stuff->minor_version) > 0) {
+ major = stuff->major_version;
+ minor = stuff->minor_version;
+ } else {
+ major = XIVersion.major_version;
+ minor = XIVersion.minor_version;
+ }
+
if (pXIClient->major_version) {
/* Check to see if the client has only ever asked
* for version 2.2 or higher
*/
- if (version_compare(stuff->major_version, stuff->minor_version, 2, 2) >= 0 &&
+ if (version_compare(major, minor, 2, 2) >= 0 &&
version_compare(pXIClient->major_version, pXIClient->minor_version, 2, 2) >= 0)
{
@@ -84,16 +93,14 @@ ProcXIQueryVersion(ClientPtr client)
* version to the client but leave the server internal
* version set to the highest requested value
*/
- major = stuff->major_version;
- minor = stuff->minor_version;
- if (version_compare(stuff->major_version, stuff->minor_version,
+ if (version_compare(major, minor,
pXIClient->major_version, pXIClient->minor_version) > 0)
{
- pXIClient->major_version = stuff->major_version;
- pXIClient->minor_version = stuff->minor_version;
+ pXIClient->major_version = major;
+ pXIClient->minor_version = minor;
}
} else {
- if (version_compare(stuff->major_version, stuff->minor_version,
+ if (version_compare(major, minor,
pXIClient->major_version, pXIClient->minor_version) < 0) {
client->errorValue = stuff->major_version;
@@ -103,16 +110,6 @@ ProcXIQueryVersion(ClientPtr client)
minor = pXIClient->minor_version;
}
} else {
- if (version_compare(XIVersion.major_version, XIVersion.minor_version,
- stuff->major_version, stuff->minor_version) > 0) {
- major = stuff->major_version;
- minor = stuff->minor_version;
- }
- else {
- major = XIVersion.major_version;
- minor = XIVersion.minor_version;
- }
-
pXIClient->major_version = major;
pXIClient->minor_version = minor;
}