Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xauth/dist merge xauth 1.1.



details:   https://anonhg.NetBSD.org/xsrc/rev/710f5a15a829
branches:  trunk
changeset: 10353:710f5a15a829
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jul 15 06:01:53 2019 +0000

description:
merge xauth 1.1.

diffstat:

 external/mit/xauth/dist/README    |  71 ---------------------------------
 external/mit/xauth/dist/process.c |  82 ++++++++++++++++++++++++++------------
 2 files changed, 55 insertions(+), 98 deletions(-)

diffs (225 lines):

diff -r b14f118207df -r 710f5a15a829 external/mit/xauth/dist/README
--- a/external/mit/xauth/dist/README    Mon Jul 15 06:01:32 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-
-    I. OVERVIEW
-
-The xauth program is used to edit and display the authorization
-information used in connecting to the X server.
-The underlying "Authorization Protocol for X" is described in the
-README file of the libXau module of X11.
-
-    II. BUILDING
-
-Use "./autogen.sh" to configure the package and "make" to compile it.
-A black box check for the correctness of the package can be initiated
-by "make check" (make sure to install "cmdtest" from
-http://liw.fi/cmdtest/). The installation is done by "make install".
-
-   III. COMMUNICATION
-
-All questions regarding this software should be directed at the
-Xorg mailing list:
-
-        http://lists.freedesktop.org/mailman/listinfo/xorg
-
-Please submit bug reports to the Xorg bugzilla:
-
-        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
-
-The master development code repository can be found at:
-
-        git://anongit.freedesktop.org/git/xorg/app/xauth
-
-        http://cgit.freedesktop.org/xorg/app/xauth
-
-For patch submission instructions, see:
-
-       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
-
-For more information on the git code manager, see:
-
-        http://wiki.x.org/wiki/GitPage
-
-
-   IV. RELEASING
-
-This section describes how to release a new version of xauth to the
-public. A detailed description of this process can be found at
-http://www.x.org/wiki/Development/Documentation/ReleaseHOWTO with a
-few clarification below.
-
-Remember, that the last commit _must_ include the version string in
-its diff (not the commit message). This is typically done by
-incrementing the version string in configure.ac.
-
-For releasing under Fedora make sure, that
-/usr/share/util-macros/INSTALL exists. If not, then please create that
-file.
-
-To release a new version of xauth, please follow this steps:
-
- * git clone ssh://git.freedesktop.org/git/xorg/app/xauth
- * cd xauth ; ./autogen.sh ; make ; make check
- * follow ReleaseHowto inside this directory.
-
-Ignore these errors shown during release.sh:
-
-   /bin/sh: ../.changelog.tmp: Permission denied
-   git directory not found: installing possibly empty changelog.
-
-   cp: cannot create regular file '../.INSTALL.tmp': Permission denied
-   util-macros "pkgdatadir" from xorg-macros.pc not found: installing possibly empty INSTALL.
-
-[eof]
diff -r b14f118207df -r 710f5a15a829 external/mit/xauth/dist/process.c
--- a/external/mit/xauth/dist/process.c Mon Jul 15 06:01:32 2019 +0000
+++ b/external/mit/xauth/dist/process.c Mon Jul 15 06:01:53 2019 +0000
@@ -890,19 +890,11 @@
                         "%s:  unable to write authority file %s\n",
                         ProgramName, temp_name);
            } else {
-               (void) unlink (xauth_filename);
-#if defined(WIN32) || defined(__UNIXOS2__)
-               if (rename(temp_name, xauth_filename) == -1)
-#else
-               /* Attempt to rename() if link() fails, since this may be on a FS that does not support hard links */
-               if (link (temp_name, xauth_filename) == -1 && rename(temp_name, xauth_filename) == -1)
-#endif
-               {
+               if (rename(temp_name, xauth_filename) == -1) {
                    fprintf (stderr,
-                    "%s:  unable to link authority file %s, use %s\n",
+                    "%s:  unable to rename authority file %s, use %s\n",
                             ProgramName, xauth_filename, temp_name);
-               } else {
-                   (void) unlink (temp_name);
+                    unlink(temp_name);
                }
            }
        }
@@ -1008,7 +1000,7 @@
                fprintf (fp, "%s", dpyname);
                break;
            }
-           /* else fall through to default */
+           /* else fall through */
          default:
            fprintf (fp, "#%04x#", auth->family);
            fprintfhex (fp, auth->address_length, auth->address);
@@ -1057,16 +1049,22 @@
 
 
 static int
-eq_auth(Xauth *a, Xauth *b)
+eq_auth_dpy_and_name(Xauth *a, Xauth *b)
 {
     return((a->family == b->family &&
            a->address_length == b->address_length &&
            a->number_length == b->number_length &&
            a->name_length == b->name_length &&
-           a->data_length == b->data_length &&
            memcmp(a->address, b->address, a->address_length) == 0 &&
            memcmp(a->number, b->number, a->number_length) == 0 &&
-           memcmp(a->name, b->name, a->name_length) == 0 &&
+           memcmp(a->name, b->name, a->name_length) == 0) ? 1 : 0);
+}
+
+static int
+eq_auth(Xauth *a, Xauth *b)
+{
+    return((eq_auth_dpy_and_name(a, b) &&
+           a->data_length == b->data_length &&
            memcmp(a->data, b->data, a->data_length) == 0) ? 1 : 0);
 }
 
@@ -1100,17 +1098,6 @@
     return 1;
 }
 
-/* return non-zero iff display and authorization type are the same */
-
-static int
-match_auth(register Xauth *a, register Xauth *b)
-{
-    return ((match_auth_dpy(a, b)
-            && a->name_length == b->name_length
-            && memcmp(a->name, b->name, a->name_length) == 0) ? 1 : 0);
-}
-
-
 static int
 merge_entries(AuthList **firstp, AuthList *second, int *nnewp, int *nreplp)
 {
@@ -1144,7 +1131,7 @@
 
        a = first;
        for (;;) {
-           if (match_auth (a->auth, b->auth)) {  /* found a duplicate */
+           if (eq_auth_dpy_and_name (a->auth, b->auth)) {  /* found a duplicate */
                AuthList tmp;           /* swap it in for old one */
                tmp = *a;
                *a = *b;
@@ -1175,6 +1162,45 @@
 
 }
 
+static void
+sort_entries(AuthList **firstp)
+{
+    /* Insert sort, in each pass it removes auth records of certain */
+    /* cathegory from the given list and inserts them into the sorted list. */
+
+    AuthList *sorted = NULL, *sorted_tail = NULL;
+    AuthList *prev, *iter, *next;
+
+    #define SORT_OUT(EXPRESSION) { \
+       prev = NULL; \
+       for (iter = *firstp; iter; iter = next) { \
+           next = iter->next; \
+           if (EXPRESSION) { \
+               if (prev) \
+                   prev->next = next; \
+               else \
+                   *firstp = next; \
+               if (sorted_tail == NULL) { \
+                   sorted = sorted_tail = iter; \
+               } else { \
+                   sorted_tail->next = iter; \
+                   sorted_tail = iter; \
+               } \
+               iter->next = NULL; \
+           } else { \
+               prev = iter; \
+           } \
+       } \
+    }
+
+    SORT_OUT(iter->auth->family != FamilyWild && iter->auth->number_length != 0);
+    SORT_OUT(iter->auth->family != FamilyWild && iter->auth->number_length == 0);
+    SORT_OUT(iter->auth->family == FamilyWild && iter->auth->number_length != 0);
+    SORT_OUT(iter->auth->family == FamilyWild && iter->auth->number_length == 0);
+
+    *firstp = sorted;
+}
+
 static Xauth *
 copyAuth(Xauth *auth)
 {
@@ -1513,6 +1539,7 @@
          printf ("%d entries read in:  %d new, %d replacement%s\n",
                  nentries, nnew, nrepl, nrepl != 1 ? "s" : "");
        if (nentries > 0) xauth_modified = True;
+       sort_entries(&xauth_head);
     }
 
     return 0;
@@ -1661,6 +1688,7 @@
        fprintf (stderr, "unable to merge in added record\n");
        return 1;
     }
+    sort_entries(&xauth_head);
 
     xauth_modified = True;
     return 0;



Home | Main Index | Thread Index | Old Index