> Whatever mail client you used totally corrupted the patch.   I was able to
> seemingly repair it by stripping ^M and then undoing line wraps, but git still
> hit a bunch of whitespace errors that had to be corrected.

Sorry about that, switching to mutt and a different address. Let's see if I got
the headers right, wrt not breaking the thread.

> Please don't add spaces to the end of lines, it makes git unhappy and
> introduces hard to spot diff mismatches in future patches.

Fixed.

> You can drop the "if (host)" and "if (rest)" [...]

Done.

> Also, this seems to be the only case in which you free those instead of
> letting them leak - why aren't you freeing them in the rest of the function?

Right, the comment in parse_displayname() threw me off:

    char *host = NULL;                  /* must free if set and error return */
    char *rest = NULL;                  /* must free if set and error return */

> Please be consistent in indent levels - don't use 4 space indents for if and
> else, then add 8 for the return clauses inside.

I really have no idea what you mean by that.

        Stefan
-- 
It's a very *__UN*lucky week in which to be took dead.
                -- Churchy La Femme
>From 1c84f163fd3dcdcb8b1193cc2debe08addf38551 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20V=C3=B6lkel?= <[email protected]>
Date: Wed, 8 Aug 2012 14:13:08 +0200
Subject: [PATCH] improve to handle FamilyWild necessary for GDM/XDMCP/SSH #43425

---
 process.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 65 insertions(+), 7 deletions(-)

diff --git a/process.c b/process.c
index 283b4a1..03ea366 100644
--- a/process.c
+++ b/process.c
@@ -462,6 +462,9 @@ read_auth_entries(FILE *fp, Bool numeric, AuthList **headp, AuthList **tailp)
     return n;
 }
 
+/**
+ * Parse the given displayname and build a corresponding AuthList.
+ */
 static Bool
 get_displayname_auth(const char *displayname, AuthList **authl)
 {
@@ -991,6 +994,9 @@ dump_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
 	    fwrite (auth->address, sizeof (char), auth->address_length, fp);
 	    fprintf (fp, "/unix");
 	    break;
+	  case FamilyWild:
+	    fwrite (auth->address, sizeof (char), auth->address_length, fp);
+	    break;
 	  case FamilyInternet:
 #if defined(IPv6) && defined(AF_INET6)
 	  case FamilyInternet6:
@@ -1073,6 +1079,49 @@ match_auth_dpy(register Xauth *a, register Xauth *b)
 	     memcmp(a->number, b->number, a->number_length) == 0) ? 1 : 0);
 }
 
+static int
+match_authwild_dpy(register Xauth *a, const char *displayname)
+{
+    int family;
+    char *host = NULL, *rest = NULL;
+    int dpynum, scrnum;
+    char dpynumbuf[40];			/* want to hold largest display num */
+
+    if ( a->family != FamilyWild )
+	return False;
+
+    if (!parse_displayname (displayname,
+			    &family, &host, &dpynum, &scrnum, &rest)) {
+	free(host);
+	free(rest);
+
+	return False;
+    }
+
+    dpynumbuf[0] = '\0';
+    sprintf (dpynumbuf, "%d", dpynum);
+
+    if (a->address_length != strlen(host) || a->number_length != strlen(dpynumbuf)) {
+	free(host);
+	free(rest);
+
+	return False;
+    }
+
+    if (memcmp(a->address, host, a->address_length) == 0 &&
+        memcmp(a->number, dpynumbuf, a->number_length) == 0) {
+	free(host);
+	free(rest);
+
+	return True;
+    } else {
+	free(host);
+	free(rest);
+
+	return False;
+   }
+}
+
 /* return non-zero iff display and authorization type are the same */
 
 static int
@@ -1236,13 +1285,22 @@ iterdpy (const char *inputfilename, int lineno, int start,
 	    /* l may be freed by remove_entry below. so save its contents */
 	    next = l->next;
 	    tmp_auth = copyAuth(l->auth);
-	    for (proto = proto_head; proto; proto = proto->next) {
-		if (match_auth_dpy (proto->auth, tmp_auth)) {
-		    matched = True;
-		    if (yfunc) {
-			status = (*yfunc) (inputfilename, lineno,
-					   tmp_auth, data);
-			if (status < 0) break;
+
+	    if ( match_authwild_dpy(tmp_auth, displayname) ) {
+	        matched = True;
+		if (yfunc) {
+		    status = (*yfunc) (inputfilename, lineno,
+				       tmp_auth, data);
+		}
+	    } else {
+	        for (proto = proto_head; proto; proto = proto->next) {
+		    if (match_auth_dpy (proto->auth, tmp_auth)) {
+		        matched = True;
+		        if (yfunc) {
+			    status = (*yfunc) (inputfilename, lineno,
+					       tmp_auth, data);
+			    if (status < 0) break;
+			}
 		    }
 		}
 	    }
-- 
1.7.2.5

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to