summaryrefslogtreecommitdiff
path: root/Xtranssock.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove client-side abstract socket supportDemi Marie Obenour2023-03-191-30/+3
| | | | | | | | | | CVE-2020-25697 and the Flatpak documentation show that clients using abstract sockets without mutual authentication is unsafe. TRANS_ABSTRACT remains supported, but it is now a no-op on the client side. Abstract sockets are still supported for servers, as the X server authenticates the client via other methods. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
* Remove "All rights reserved" from Oracle copyright noticesAlan Coopersmith2023-03-191-1/+1
| | | | | | Oracle no longer includes this term in our copyright & license notices. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* move is_numeric to Xtranssock.c and only define for TCPCONN or TRANS_REOPENKeith Packard2022-08-201-0/+14
| | | | | | Don't define this function unless it is actually going to be used. Signed-off-by: Keith Packard <keithp@keithp.com>
* Automatically disable inet6 transport if ipv6 is disabled on machineRay Strode2022-05-101-4/+11
| | | | | | | | | | | | | | | | | | | | | If a machine is booted with ipv6.disable=1, trying to bind to an AF_INET6 socket will fail with AFNOSUPPORT. The tcp transport automatically falls back to ipv4 in this case, but the more specific inet6 transport just fails. This failure leads to MakeAllCOTSServerListeners returning a partial success. Unfortunately, the X server can't really contiue with partial successes from this function if -displayfd is in use, since that would, in other cases, potentially lead to the -displayfd electing a display number that is potentially partially in use by a rogue program. This commit addresses the issue by automatically disabling transports when they fail with AFNOSUPPORT, leading them to get ignored, rather than proceeding and ultimately returning from MakeAllCOTSServerListerns with partial=TRUE.
* Delete SCO supportAdam Jackson2019-09-301-4/+4
| | | | Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* unifdef USG and NCRAdam Jackson2019-09-301-1/+1
| | | | Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* avoid -Wformat errors from clangRin Okuyama2018-03-241-1/+1
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=99882 Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Update strlcpy macro check to also check HAVE_STRLCPYJeremy Huddleston Sequoia2016-09-101-1/+1
| | | | | | | | xorg-server moved from HAS_STRLCPY to HAVE_STRLCPY in 2011 cf-xserver: d829a7c5cb42c979b58f3547136df5b05d906423 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* unifdef LBXPROXY_t and TEST_tAdam Jackson2016-05-191-8/+0
| | | | | | | LBX is dead, and TEST_t is unused. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
* Remove CLTS codeAdam Jackson2016-05-191-154/+0
| | | | | | | Never been used, as far as I can tell. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
* Remove support for SysV on x86 platforms other than Solaris & SCOAlan Coopersmith2015-12-031-12/+0
| | | | | | | | | No other x86 SysV platforms have ever been supported in the modular build systems, so we don't need to keep carrying around a bunch of ifdef's for them. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
* Replace 'sun' with '__sun'Richard PALO2015-11-281-1/+1
| | | | | | | | | Globally replace #ifdef and #if defined usage of 'sun' with '__sun' such that strict ISO compiler modes such as -ansi or -std=c99 can be used. Signed-off-by: Richard PALO <richard@NetBSD.org> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add const qualifiers to TRANS(OpenC{L,O}TS{Server,Client}) argsAlan Coopersmith2014-08-241-8/+8
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add const qualifiers to TRANS(Connect) argsAlan Coopersmith2014-08-241-3/+5
| | | | | | | Also required constifying UnixHostReallyLocal, since SocketUNIXConnect passes the host arg through to it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add const qualifiers to TRANS(CreateListener) port argsAlan Coopersmith2014-08-231-2/+3
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add const qualifiers to TRANS(Reopen...) port argsAlan Coopersmith2014-08-231-3/+3
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Increase UNIX socket buffer sizeMark Kettenis2014-03-311-0/+21
| | | | | | | | Some systems provide a really small default buffer size for UNIX sockets. Bump it up to 64k if necessary such that large transfers (such as XGetImage() on a 8-megapixel image) don't take tens of seconds. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Fix alignment issues in FD passing codeMark Kettenis2013-11-211-8/+8
| | | | | | | | | | | 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>
* Remove unused static inlinesMark Kettenis2013-11-211-16/+0
| | | | | Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
* Switch to CMSG_* macros for FD passingKeith Packard2013-11-071-40/+64
| | | | | | | | 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>
* Actually disable all of the FD passing code unless XTRANS_SEND_FDS is setKeith Packard2013-11-071-0/+10
| | | | | | Stick all of the functions relating to FD passing inside Signed-off-by: Keith Packard <keithp@keithp.com>
* Add SEND_FDS version of ReadvKeith Packard2013-11-021-0/+24
| | | | | | | 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>
* Add APIs to send file descriptors through the networkKeith Packard2013-10-311-17/+216
| | | | | | Exposes new TRANS(SendFd)/TRANS(RecvFd) APIs. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add const qualifier to unix_nolistenŁukasz Stelmach2013-07-091-1/+1
| | | | | | | 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>
* Xtranssock.c: avoid buffer overrun in SocketReopenRobert Bragg2011-12-131-6/+8
| | | | | | | | | | | | | | | | | | | 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>
* Remove unnecessary casts on malloc, calloc & free callsAlan Coopersmith2011-12-061-18/+14
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
* Finish conversion to standard C allocation functionsAlan Coopersmith2011-12-051-27/+27
| | | | | | | | | 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>
* Fix some resource & memory leaks in libxtrans.Alan Hourihane2011-12-051-0/+3
| | | | | | 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>
* Convert a bunch of sprintf calls to snprintfAlan Coopersmith2011-10-011-3/+3
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Add const attributes to fix gcc -Wwrite-strings warningsAlan Coopersmith2011-10-011-5/+5
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Fix warning: unused variable 'tmpport' with various configurationsAlan Coopersmith2011-10-011-3/+2
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Add _X_UNUSED attributes to silence unused parameter warningsAlan Coopersmith2011-10-011-1/+1
| | | | | | | | 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>
* Fix unused variable warningsAlan Coopersmith2011-10-011-4/+5
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* Fix printf format string warningsAlan Coopersmith2011-10-011-1/+1
| | | | | | | | 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>
* Convert PRMSG macro to prmsg inline functionAlan Coopersmith2011-10-011-161/+143
| | | | | | | | | | 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>
* Strip trailing whitespaceAlan Coopersmith2011-09-161-59/+59
| | | | | | | 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>
* Sun's copyrights now belong to OracleAlan Coopersmith2010-10-291-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Update Sun license notices to current X.Org standard formAlan Coopersmith2010-01-141-1/+22
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
* Xtranssock: assume that we have getaddrinfo if ipv6 is enabledJulien Cristau2009-10-151-58/+20
| | | | | | | 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>
* Fix ifdef checks for SVR4 to do the right thing on SolarisAlan Coopersmith2009-07-301-3/+3
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
* xfs segfaults in _FontTransSocketReopen when cloning itselfAlan Coopersmith2009-05-181-1/+8
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
* Janitor: Correct make distcheck and compiler warnings.Paulo Cesar Pereira de Andrade2009-01-301-5/+5
| | | | | | | | 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.
* Drastically simplify TRANS_OPEN_MAX.Adam Jackson2008-08-071-1/+3
| | | | If your OS doesn't have sysconf(3), then life is already hard for you.
* Massive ifdef cleanup, dropping a ton of unsupported platform code.Adam Jackson2008-08-071-123/+8
|
* Clear some pointer type mismatch warningsAlan Coopersmith2008-06-241-2/+2
|
* Connection failure for abstract socket is ECONNREFUSED, not ENOENT.Adam Jackson2008-05-121-1/+1
| | | | Apropos of bug #15884.
* Ignore mkdir() errors when creating the abstract socket.Bill Nottingham2008-05-121-1/+1
| | | | Red Hat bug #445303.
* Fix length calculation for the path for abstract unix domain socketsJames Cloos2008-04-251-1/+1
| | | | | | | | | | | | | | 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
* Only call WSAGetLastError() if there has been anColin Harrison2008-04-231-5/+5
| | | | error condition.
* Sun bug #6688467: _X11TransConvertAddress: Unknown family type on 64-bit SPARCAlan Coopersmith2008-04-151-20/+16
| | | | | | | 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>