summaryrefslogtreecommitdiff
path: root/Xtranssock.c
AgeCommit message (Collapse)Author
2013-11-21Fix alignment issues in FD passing codeMark Kettenis
A char array on the stack is not guaranteed to have more than byte alignment. This means that casting it to a 'struct cmsghdr' and accessing its members may result in unaligned access. This will generate SIGBUS on strict alignment architectures like OpenBSD/sparc64. The solution is to use a union to force proper alignment. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2013-11-21Remove unused static inlinesMark Kettenis
Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2013-11-07Switch to CMSG_* macros for FD passingKeith Packard
This should be portable to non-Linux systems Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-11-07Actually disable all of the FD passing code unless XTRANS_SEND_FDS is setKeith Packard
Stick all of the functions relating to FD passing inside Signed-off-by: Keith Packard <keithp@keithp.com>
2013-11-02Add SEND_FDS version of ReadvKeith Packard
Now that we've found that libFS uses readv, we can test whether this readv implementation works correctly. Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-31Add APIs to send file descriptors through the networkKeith Packard
Exposes new TRANS(SendFd)/TRANS(RecvFd) APIs. Signed-off-by: Keith Packard <keithp@keithp.com>
2013-07-09Add const qualifier to unix_nolistenŁukasz Stelmach
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-12-13Xtranssock.c: avoid buffer overrun in SocketReopenRobert Bragg
This function was constructing an address from a port string allocating a buffer according to the size of the string but then later copying the address according to sizeof(struct sockaddr). This patch ensures that we allocate a struct sockaddr buffer with enough space for the port string to be copied into sa_data[] and uses that combined length to determine how much should be copied at the end of the function. This fixes a crash when using xwayland which uses ListenOnOpenFD() that will call _XSERVTransReopenCOTSServer() with a short port string like ":1". Signed-off-by: Robert Bragg <robert@linux.intel.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-12-06Remove unnecessary casts on malloc, calloc & free callsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2011-12-05Finish conversion to standard C allocation functionsAlan Coopersmith
Commit 4ac40cd5451 started this, by no longer special casing the xserver to include it's former custom allocation functions, this just takes the remaining #defines and pre-substitutes them into the code. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-12-05Fix some resource & memory leaks in libxtrans.Alan Hourihane
Signed-off-by: Alan Hourihane <alanh@vmware.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-10-01Convert a bunch of sprintf calls to snprintfAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-01Add const attributes to fix gcc -Wwrite-strings warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-01Fix warning: unused variable 'tmpport' with various configurationsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-01Add _X_UNUSED attributes to silence unused parameter warningsAlan Coopersmith
Not all the transport variants use all the arguments to every function, but as long as one transport type needs it, they all get the args passed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-01Fix unused variable warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-01Fix printf format string warningsAlan Coopersmith
Now that prmsg lets arguments types actually be checked, fix the warnings found. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-01Convert PRMSG macro to prmsg inline functionAlan Coopersmith
Allows using varargs to have the correct number of arguments passed to get rid of the many gcc warnings about variable printf format strings, and to reduce the duplication from having 5 implementations of the PRMSG macro depending on the debug options defined & output method used. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-16Strip trailing whitespaceAlan Coopersmith
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-10-29Sun's copyrights now belong to OracleAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-01-14Update Sun license notices to current X.Org standard formAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-10-15Xtranssock: assume that we have getaddrinfo if ipv6 is enabledJulien Cristau
If IPv6 is enabled at build time, assume that the C library will have getaddrinfo at runtime. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-07-30Fix ifdef checks for SVR4 to do the right thing on SolarisAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-05-18xfs segfaults in _FontTransSocketReopen when cloning itselfAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-01-30Janitor: Correct make distcheck and compiler warnings.Paulo Cesar Pereira de Andrade
Compiler warnings are spread on other packages, with a warning in the format: /usr/include/X11/Xtrans/Xtranssock.c:548: warning: 'ciptr' may be used uninitialized in this function so the code was slightly changed so that the compiler would not "think" it could be used without initialization.
2008-08-07Drastically simplify TRANS_OPEN_MAX.Adam Jackson
If your OS doesn't have sysconf(3), then life is already hard for you.
2008-08-07Massive ifdef cleanup, dropping a ton of unsupported platform code.Adam Jackson
2008-06-24Clear some pointer type mismatch warningsAlan Coopersmith
2008-05-12Connection failure for abstract socket is ECONNREFUSED, not ENOENT.Adam Jackson
Apropos of bug #15884.
2008-05-12Ignore mkdir() errors when creating the abstract socket.Bill Nottingham
Red Hat bug #445303.
2008-04-25Fix length calculation for the path for abstract unix domain socketsJames Cloos
Since the struct has a fixed-lenght char[] its sizeof() contains trailing NUL octets which results in corrupt abstract sockets. Instead, take the strlen(3) of the path, plus the single NUL octet (which identifies the path as an abstract path rather than a file- system path) plus the offset from the start of the struct to the start of the char array. This fixes: https://bugs.freedesktop.org/show_bug.cgi?id=15677
2008-04-23Only call WSAGetLastError() if there has been anColin Harrison
error condition.
2008-04-15Sun bug #6688467: _X11TransConvertAddress: Unknown family type on 64-bit SPARCAlan Coopersmith
Check for socklen_t definition and if found use it instead of size_t or int for the length argument to getpeername/getsockname/etc. <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6688467>
2008-03-24Bug #10489: Don't retry unix socket connect()s on ENOENT.Loïc Minier
If the socket isn't there, it's not gonna magically appear. Either it's a server socket and you should have just waited for the SIGUSR1 from the server, or it's a stale reference to an ICE socket. However, do retry once, so fallback from abstract to filesystem namespace works. Originally Debian bug #385976.
2008-03-23BSD44SOCKETS is the wrong check for SOCK_MAXADDRLENJulien Cristau
GNU/kFreeBSD defines BSD44SOCKETS, but doesn't have SOCK_MAXADDRLEN. Check for the latter directly.
2008-03-05Add support for the abstract socket namespace under Linux.Adam Jackson
Unlike normal unix sockets, the abstract namespace is not bound to the filesystem. This has some notable advantages; /tmp need not exist, the socket directory need not have magic permissions, etc. xtrans servers will listen on both the normal and abstract socket endpoints; clients will attempt to connect to the abstract socket before connecting to the corresponding filesystem socket. Based on a patch by Bill Crawford.
2008-02-10Fixed #ifdef checks that were using i386 to use __i386__Jeremy Huddleston
""" It's simply obsolete, sloppy, compiler namespace pollution. The compiler is not allowed to predefine symbols that might conflict with ordinary identifiers. For backwards compatibility gcc currently predefines i386 when compiling for x86 32-bit (but not 64-bit), but that will go away. It is also not defined if you specify -ansi when invoking the compiler, because then it is seriously standards compliant. Other compilers shouldn't define it either. Correct code shouldn't rely on it being defined. However __i386__ is safe and proper. """
2007-11-14Fix for incorrect processing of recycled launchd socket on OS XBen Byer
2007-11-14removed cvs tagsBen Byer
2007-09-11libxtrans: fixed a typo in my last commitDodji Seketeli
* Xtranssock.c: (SocketReopen): oops fix a typo in my last commit.
2007-09-11libxtrans: fix linux compilation breakageDodji Seketeli
* Xtranssock.c: (SocketReopen): protect use of BSD4.4 socket with BSD44SOCKETS macro. protect use of strlcnpy with HAVE_STRLCPY macro. That one is defined (or not) by the xserver configure.
2007-09-05changes to support launchd on OS XBen Byer
2006-09-13Bug 728: RUI in _X11TransSocketINETGetAddr in file "Xtranssock.c"Alan Coopersmith
Bug #728: <https://bugs.freedesktop.org/show_bug.cgi?id=728> Patch #3527: <https://bugs.freedesktop.org/attachment.cgi?id=3527> bzero sockaddr structures before passing to kernel to convince memory checkers that they are initialized before use
2006-08-24Use SUN_LEN if it is defined on non-BSD44SOCKETS systemsAlan Coopersmith
2006-08-24Bug 4982: use offsetof for manipulating struct sockaddr_unPetr Salinger
X.Org Bugzilla #4982 <https://bugs.freedesktop.org/show_bug.cgi?id=4982> Patch #5424 <https://bugs.freedesktop.org/attachment.cgi?id=5424>
2006-08-24More sprintf -> snprintf conversionsAlan Coopersmith
2006-05-25No code change. Just fix comment that said SOCKCONN to become TCPCONN.Jeremy C. Reed
(This dates back to 1994 or before.)
2005-11-08See ChangeLog entry 2005-11-07 for details.XORG-6_8_99_903XORG-6_8_99_902Kean Johnson
2005-10-03Bug #3813 <https://bugs.freedesktop.org/show_bug.cgi?id=3813> GNU/kFreeBSDXORG-6_8_99_901Alan Coopersmith
fix for xtrans (Robert Millan)
2005-10-02//bugs.freedesktop.org/show_bug.cgi?id=4256> Patch #3046Alan Coopersmith
<https://bugs.freedesktop.org/attachment.cgi?id=3046> Define MAXHOSTNAMELEN if platform doesn't (Michael Banck)