- Fix a bug in automatic port generation for abstract sockets. Fixes fast
user switching, among other things.
This commit is contained in:
parent
5fcb62d3f1
commit
7eb9aaec7f
@ -6,7 +6,7 @@
|
|||||||
Summary: X.Org X11 developmental X transport library
|
Summary: X.Org X11 developmental X transport library
|
||||||
Name: xorg-x11-xtrans-devel
|
Name: xorg-x11-xtrans-devel
|
||||||
Version: 1.0.3
|
Version: 1.0.3
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
License: MIT/X11
|
License: MIT/X11
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://www.x.org
|
URL: http://www.x.org
|
||||||
@ -59,6 +59,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_datadir}/aclocal/xtrans.m4
|
%{_datadir}/aclocal/xtrans.m4
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 20 2007 Adam Jackson <ajax@redhat.com> 1.0.3-4
|
||||||
|
- Fix a bug in automatic port generation for abstract sockets. Fixes fast
|
||||||
|
user switching, among other things.
|
||||||
|
|
||||||
* Fri Aug 24 2007 Adam Jackson <ajax@redhat.com> 1.0.3-3
|
* Fri Aug 24 2007 Adam Jackson <ajax@redhat.com> 1.0.3-3
|
||||||
- Abstract sockets for PF_UNIX.
|
- Abstract sockets for PF_UNIX.
|
||||||
|
|
||||||
|
@ -1,21 +1,6 @@
|
|||||||
diff -up xtrans-1.0.3/Xtransint.h.abstract xtrans-1.0.3/Xtransint.h
|
|
||||||
--- xtrans-1.0.3/Xtransint.h.abstract 2006-12-06 11:08:53.000000000 -0500
|
|
||||||
+++ xtrans-1.0.3/Xtransint.h 2007-08-24 10:28:25.000000000 -0400
|
|
||||||
@@ -374,9 +374,10 @@ typedef struct _Xtransport_table {
|
|
||||||
#define TRANS_DISABLED (1<<2) /* Don't open this one */
|
|
||||||
#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */
|
|
||||||
#define TRANS_NOUNLINK (1<<4) /* Dont unlink transport endpoints */
|
|
||||||
+#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */
|
|
||||||
|
|
||||||
/* Flags to preserve when setting others */
|
|
||||||
-#define TRANS_KEEPFLAGS (TRANS_NOUNLINK)
|
|
||||||
+#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* readv() and writev() don't exist or don't work correctly on some
|
|
||||||
diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
||||||
--- xtrans-1.0.3/Xtranssock.c.abstract 2006-12-06 11:08:53.000000000 -0500
|
--- xtrans-1.0.3/Xtranssock.c.abstract 2006-12-06 11:08:53.000000000 -0500
|
||||||
+++ xtrans-1.0.3/Xtranssock.c 2007-08-24 16:05:10.000000000 -0400
|
+++ xtrans-1.0.3/Xtranssock.c 2007-09-20 15:28:00.000000000 -0400
|
||||||
@@ -163,6 +163,10 @@ static int IBMsockInit = 0;
|
@@ -163,6 +163,10 @@ static int IBMsockInit = 0;
|
||||||
#define SocketInitOnce() /**/
|
#define SocketInitOnce() /**/
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +55,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
int oldUmask;
|
int oldUmask;
|
||||||
int status;
|
int status;
|
||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
+ char tmpport[64];
|
+ char tmpport[108];
|
||||||
+
|
+
|
||||||
+ int abstract = 0;
|
+ int abstract = 0;
|
||||||
+#ifdef HAVE_ABSTRACT_SOCKETS
|
+#ifdef HAVE_ABSTRACT_SOCKETS
|
||||||
@ -79,7 +64,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
|
|
||||||
PRMSG (2, "SocketUNIXCreateListener(%s)\n",
|
PRMSG (2, "SocketUNIXCreateListener(%s)\n",
|
||||||
port ? port : "NULL", 0, 0);
|
port ? port : "NULL", 0, 0);
|
||||||
@@ -1096,16 +1111,17 @@ TRANS(SocketUNIXCreateListener) (XtransC
|
@@ -1096,16 +1111,16 @@ TRANS(SocketUNIXCreateListener) (XtransC
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -92,9 +77,10 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
- return TRANS_CREATE_LISTENER_FAILED;
|
- return TRANS_CREATE_LISTENER_FAILED;
|
||||||
- }
|
- }
|
||||||
- } else {
|
- } else {
|
||||||
|
- snprintf (sockname.sun_path, sizeof(sockname.sun_path),
|
||||||
|
- "%s%ld", UNIX_PATH, (long)getpid());
|
||||||
+ if (!(port && *port)) {
|
+ if (!(port && *port)) {
|
||||||
snprintf (sockname.sun_path, sizeof(sockname.sun_path),
|
+ snprintf (tmpport, sizeof(tmpport), "%s%ld", UNIX_PATH, (long)getpid());
|
||||||
"%s%ld", UNIX_PATH, (long)getpid());
|
|
||||||
+ port = tmpport;
|
+ port = tmpport;
|
||||||
+ }
|
+ }
|
||||||
+ if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
|
+ if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
|
||||||
@ -103,7 +89,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx)
|
#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx)
|
||||||
@@ -1118,7 +1134,12 @@ TRANS(SocketUNIXCreateListener) (XtransC
|
@@ -1118,7 +1133,12 @@ TRANS(SocketUNIXCreateListener) (XtransC
|
||||||
namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path);
|
namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -117,7 +103,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
|
|
||||||
if ((status = TRANS(SocketCreateListener) (ciptr,
|
if ((status = TRANS(SocketCreateListener) (ciptr,
|
||||||
(struct sockaddr *) &sockname, namelen, flags)) < 0)
|
(struct sockaddr *) &sockname, namelen, flags)) < 0)
|
||||||
@@ -1148,6 +1169,9 @@ TRANS(SocketUNIXCreateListener) (XtransC
|
@@ -1148,6 +1168,9 @@ TRANS(SocketUNIXCreateListener) (XtransC
|
||||||
return TRANS_CREATE_LISTENER_FAILED;
|
return TRANS_CREATE_LISTENER_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +113,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
ciptr->family = sockname.sun_family;
|
ciptr->family = sockname.sun_family;
|
||||||
ciptr->addrlen = namelen;
|
ciptr->addrlen = namelen;
|
||||||
memcpy (ciptr->addr, &sockname, ciptr->addrlen);
|
memcpy (ciptr->addr, &sockname, ciptr->addrlen);
|
||||||
@@ -1170,16 +1194,22 @@ TRANS(SocketUNIXResetListener) (XtransCo
|
@@ -1170,16 +1193,22 @@ TRANS(SocketUNIXResetListener) (XtransCo
|
||||||
struct stat statb;
|
struct stat statb;
|
||||||
int status = TRANS_RESET_NOOP;
|
int status = TRANS_RESET_NOOP;
|
||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
@ -153,7 +139,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
{
|
{
|
||||||
int oldUmask = umask (0);
|
int oldUmask = umask (0);
|
||||||
|
|
||||||
@@ -1361,6 +1391,10 @@ TRANS(SocketUNIXAccept) (XtransConnInfo
|
@@ -1361,6 +1390,10 @@ TRANS(SocketUNIXAccept) (XtransConnInfo
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +150,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
|
|
||||||
newciptr->addrlen = ciptr->addrlen;
|
newciptr->addrlen = ciptr->addrlen;
|
||||||
memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen);
|
memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen);
|
||||||
@@ -1959,6 +1993,10 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
@@ -1959,6 +1992,10 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
||||||
int old_namelen;
|
int old_namelen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -175,7 +161,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
|
|
||||||
PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
|
PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
|
||||||
|
|
||||||
@@ -1996,7 +2034,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
@@ -1996,7 +2033,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
||||||
|
|
||||||
sockname.sun_family = AF_UNIX;
|
sockname.sun_family = AF_UNIX;
|
||||||
|
|
||||||
@ -184,7 +170,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
|
PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
|
||||||
return TRANS_CONNECT_FAILED;
|
return TRANS_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
@@ -2017,7 +2055,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
@@ -2017,7 +2054,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
||||||
* This is gross, but it was in Xlib
|
* This is gross, but it was in Xlib
|
||||||
*/
|
*/
|
||||||
old_sockname.sun_family = AF_UNIX;
|
old_sockname.sun_family = AF_UNIX;
|
||||||
@ -193,7 +179,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
|
PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
|
||||||
return TRANS_CONNECT_FAILED;
|
return TRANS_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
@@ -2025,6 +2063,17 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
@@ -2025,6 +2062,17 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
||||||
offsetof(struct sockaddr_un, sun_path);
|
offsetof(struct sockaddr_un, sun_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -211,7 +197,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Do the connect()
|
* Do the connect()
|
||||||
@@ -2062,12 +2111,19 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
@@ -2062,12 +2110,19 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
||||||
* should try again.
|
* should try again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -236,7 +222,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
PRMSG (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
|
PRMSG (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
|
||||||
EGET(),0, 0);
|
EGET(),0, 0);
|
||||||
|
|
||||||
@@ -2090,12 +2146,15 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
@@ -2090,12 +2145,15 @@ TRANS(SocketUNIXConnect) (XtransConnInfo
|
||||||
return TRANS_CONNECT_FAILED;
|
return TRANS_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +239,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2235,7 +2294,6 @@ TRANS(SocketINETClose) (XtransConnInfo c
|
@@ -2235,7 +2293,6 @@ TRANS(SocketINETClose) (XtransConnInfo c
|
||||||
#ifdef UNIXCONN
|
#ifdef UNIXCONN
|
||||||
static int
|
static int
|
||||||
TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
|
TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
|
||||||
@ -261,7 +247,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If this is the server side, then once the socket is closed,
|
* If this is the server side, then once the socket is closed,
|
||||||
@@ -2254,7 +2312,8 @@ TRANS(SocketUNIXClose) (XtransConnInfo c
|
@@ -2254,7 +2311,8 @@ TRANS(SocketUNIXClose) (XtransConnInfo c
|
||||||
&& sockname->sun_family == AF_UNIX
|
&& sockname->sun_family == AF_UNIX
|
||||||
&& sockname->sun_path[0])
|
&& sockname->sun_path[0])
|
||||||
{
|
{
|
||||||
@ -271,7 +257,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
unlink (sockname->sun_path);
|
unlink (sockname->sun_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2421,7 +2480,11 @@ Xtransport TRANS(SocketINET6Funcs) =
|
@@ -2421,7 +2479,11 @@ Xtransport TRANS(SocketINET6Funcs) =
|
||||||
Xtransport TRANS(SocketLocalFuncs) = {
|
Xtransport TRANS(SocketLocalFuncs) = {
|
||||||
/* Socket Interface */
|
/* Socket Interface */
|
||||||
"local",
|
"local",
|
||||||
@ -283,7 +269,7 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
#ifdef TRANS_CLIENT
|
#ifdef TRANS_CLIENT
|
||||||
TRANS(SocketOpenCOTSClient),
|
TRANS(SocketOpenCOTSClient),
|
||||||
#endif /* TRANS_CLIENT */
|
#endif /* TRANS_CLIENT */
|
||||||
@@ -2467,7 +2530,7 @@ static char* unix_nolisten[] = { "local"
|
@@ -2467,7 +2529,7 @@ static char* unix_nolisten[] = { "local"
|
||||||
Xtransport TRANS(SocketUNIXFuncs) = {
|
Xtransport TRANS(SocketUNIXFuncs) = {
|
||||||
/* Socket Interface */
|
/* Socket Interface */
|
||||||
"unix",
|
"unix",
|
||||||
@ -292,3 +278,18 @@ diff -up xtrans-1.0.3/Xtranssock.c.abstract xtrans-1.0.3/Xtranssock.c
|
|||||||
TRANS_ALIAS,
|
TRANS_ALIAS,
|
||||||
#else
|
#else
|
||||||
0,
|
0,
|
||||||
|
diff -up xtrans-1.0.3/Xtransint.h.abstract xtrans-1.0.3/Xtransint.h
|
||||||
|
--- xtrans-1.0.3/Xtransint.h.abstract 2006-12-06 11:08:53.000000000 -0500
|
||||||
|
+++ xtrans-1.0.3/Xtransint.h 2007-09-20 15:22:59.000000000 -0400
|
||||||
|
@@ -374,9 +374,10 @@ typedef struct _Xtransport_table {
|
||||||
|
#define TRANS_DISABLED (1<<2) /* Don't open this one */
|
||||||
|
#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */
|
||||||
|
#define TRANS_NOUNLINK (1<<4) /* Dont unlink transport endpoints */
|
||||||
|
+#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */
|
||||||
|
|
||||||
|
/* Flags to preserve when setting others */
|
||||||
|
-#define TRANS_KEEPFLAGS (TRANS_NOUNLINK)
|
||||||
|
+#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* readv() and writev() don't exist or don't work correctly on some
|
||||||
|
Loading…
Reference in New Issue
Block a user