summaryrefslogtreecommitdiff
path: root/os
AgeCommit message (Collapse)AuthorFilesLines
2012-01-13os: prettify backtrace outputPeter Hutterer1-2/+6
Changes to output: * "Backtrace:" now appears on a separate line _with_ a timestamp * A blank line is inserted after the last backtrace line Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
2012-01-12Revert "os: Repack ConnectionOutput for LP64"Keith Packard1-1/+1
This reverts commit d5f724544afd2949cebfcf4f0b4510ec0c701bec. ABI change pended for 1.13
2012-01-12Revert "dix: Pull client-is-local flag up to the ClientRec"Keith Packard3-2/+10
This reverts commit 49d38b75c8f3276cfce33ffe6b8c4fbeb1081b96. ABI change pended for 1.13
2012-01-12Revert "dix: Extend initial connection handshake for forwarding proxies"Keith Packard1-5/+5
This reverts commit 78fa121f4097d29458e5453c13473595df06e26e. ABI change pended for 1.13
2012-01-12Revert "os: Hide the Connection{In,Out}put implementation details"Keith Packard3-21/+18
This reverts commit 48e7a2ef574c8b38c4f8f07b45f54c8bfd02552b. ABI change pended for 1.13
2012-01-09Add OpenBSD support to DetermineClientCmd()Matthieu Herrb1-1/+42
Uses kvm_getargv() from libkvm. Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-01-09Merge commit '777bf90abeac37087a3d0538b847742523d5acf2'Keith Packard4-37/+32
2012-01-09Merge remote-tracking branch 'kibi/master'Keith Packard1-1/+5
2012-01-06os: Minor header cleanupAdam Jackson3-4/+4
Move some constants near their only users, and remove some getdtablesize() logic that's second-guessing configure. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06os: Hide the Connection{In,Out}put implementation detailsAdam Jackson3-18/+21
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06dix: Extend initial connection handshake for forwarding proxiesAdam Jackson1-5/+5
Forwarding proxies like sshd will appear to be local, even though they aren't really. This leads to weird behaviour for extensions that truly require running under the same OS services as the client, like MIT-SHM and DRI2. Add two new legal values for the initial connection's byteOrder field, 'r' and 'R'. These act like 'l' and 'B' respectively, but have the side effect of forcing the client to be treated as non-local. Forwarding proxies should attempt to munge the first packet of the connection accordingly; older servers will reject connections thusly munged, so the proxy should fall back to passthrough if the munged connection attempt fails. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06dix: Pull client-is-local flag up to the ClientRecAdam Jackson3-10/+2
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06os: Repack ConnectionOutput for LP64Adam Jackson1-1/+1
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-12-31os: don't ignore failure from dladdrJulien Cristau1-1/+5
If dladdr returns 0, don't go and use the returned Dl_info, it may contain garbage. X.Org bug#44315 <https://bugs.freedesktop.org/show_bug.cgi?id=44315> Reported-and-tested-by: Cyril Brulebois <kibi@debian.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Cyril Brulebois <kibi@debian.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-12-27Add Solaris support to DetermineClientCmdAlan Coopersmith1-10/+59
Uses /proc/pid/psinfo to read command & partial arguments. Moves cmdsize & argsize variables into non-Solaris #else clause to avoid unused variable warnings. Fixes format mismatch errors when building with DEBUG defined on a 64-bit platform (where Mask is defined as CARD32). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-12xdmcp.c: fix three small const warningsAlan Coopersmith1-3/+3
xdmcp.c:63:36: warning: initialization discards qualifiers from pointer target type xdmcp.c: In function 'XdmcpRegisterConnection': xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type xdmcp.c: In function 'get_mcast_options': xdmcp.c:1596:21: warning: initialization discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12LockServer: store path to LOCKDIR literal string in a const char *Alan Coopersmith1-3/+1
And instead of initializing to NULL, then resetting to LOCKDIR almost immediately (before ever using the NULL value), skip directly to setting it to LOCKDIR. tmppath variable is only used as input for generating the path name via calls to strlen, sprintf, etc. Fixes gcc warning of: utils.c: In function 'LockServer': utils.c:259:11: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12WriteToClient: preserve constness of buf while extracting length valueAlan Coopersmith1-1/+1
Fixes gcc warning: io.c: In function 'WriteToClient': io.c:826:6: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12OsInit: store "/dev/null" in a const char *Alan Coopersmith1-1/+1
It's only passed as the input side of a strcpy and as the filename to fopen, so doesn't need to be non-const. Fixes gcc warning: osinit.c: In function 'OsInit': osinit.c:154:28: warning: initialization discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12Constify the reason string throughout the authorization check frameworkAlan Coopersmith6-8/+8
Almost all of the places the string is assigned point to a literal string constant, so use const char * for those, and const char ** for function calls that return it via an argument. Fortunately the top level function, ClientAuthorized, which returns the string as its return value is called from only one place, ProcEstablishConnection. ProcEstablishConnection stores either that return value or a string literal in char *reason. It only uses reason as an argument to SendConnSetup. SendConnSetup passes the reason argument to strlen & WriteToClient, both of which already have const qualifiers on their args. Thus added const to the reason variable in ProcEstablishConnection and the reason argument to SendConnSetup. Fixes gcc warnings: dispatch.c: In function 'ProcEstablishConnection': dispatch.c:3711:9: warning: assignment discards qualifiers from pointer target type auth.c: In function 'CheckAuthorization': auth.c:218:14: warning: assignment discards qualifiers from pointer target type auth.c:220:20: warning: assignment discards qualifiers from pointer target type connection.c: In function 'ClientAuthorized': connection.c:683:3: warning: return discards qualifiers from pointer target type mitauth.c: In function 'MitCheckCookie': mitauth.c:88:13: warning: assignment discards qualifiers from pointer target type xdmauth.c:259:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:270:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:277:11: warning: assignment discards qualifiers from pointer target type xdmauth.c:293:15: warning: assignment discards qualifiers from pointer target type xdmauth.c:313:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:322:11: warning: assignment discards qualifiers from pointer target type rpcauth.c: In function 'SecureRPCCheck': rpcauth.c:136:10: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12Constify string for authorization protocol namesAlan Coopersmith1-2/+2
gcc was warning from storing string constants in a char *name field: auth.c:64:1: warning: initialization discards qualifiers from pointer target type auth.c:72:1: warning: initialization discards qualifiers from pointer target type auth.c:81:1: warning: initialization discards qualifiers from pointer target type Making the field const requires changing AuthorizationFromID to take a const char ** pointer for the name argument which it sets to point to the matching name entry. Changing that argument requires changing its sole caller in the security extension to pass the address of a const char * variable to it, which it can do, since the only thing it does with the returned name is to pass it back to the RemoveAuthorization function that already expects a const char *name. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12os/access.c: replace acmp & acopy macros with memcmp & memcpy callsAlan Coopersmith1-16/+14
No need to cast to char * now that all supported platforms use C89-standard void * argument types, so just drop the casts from acmp & acopy macros, which clears the gcc warnings for places const pointers were cast non-const: access.c: In function 'DefineSelf': access.c:786:3: warning: cast discards qualifiers from pointer target type access.c:795:6: warning: cast discards qualifiers from pointer target type access.c: In function 'NewHost': access.c:1293:9: warning: cast discards qualifiers from pointer target type access.c:1298:6: warning: cast discards qualifiers from pointer target type access.c:1309:5: warning: cast discards qualifiers from pointer target type Without the casts, acmp & acopy are just a funny way to write memcmp & memmove, so drop the macros and inline the calls, taking care to swap the first two arguments to memmove since it had swapped them. Since all the calls to memmove end up being to non-overlapping memory (mostly copying from an existing pointer to a newly allocated one), replace those with memcpy. And finally, don't actually call memcpy to copy 0 bytes from one place to another, since that's just a waste of a perfectly good function call. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-05Move to autoconf standard function name checks & definesAlan Coopersmith7-40/+24
Replace multiple methods of checking for functions with AC_CHECK_FUNCS Replace multiple methods of selecting fallback funcs with AC_REPLACE_FUNCS Replace HAS_* and NEED_* #defines with autogenerated HAVE_* Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2011-11-23Mark arguments to fopen/popen/system wrappers as const char *Alan Coopersmith1-3/+3
Silencing more gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert a bunch of sprintf to snprintf callsAlan Coopersmith5-10/+11
This batch is the straightforward set - others are more complex and need more analysis to determine right size to pass. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23LogVMessageVerb: Fix const mismatch warningAlan Coopersmith1-1/+1
"log.c", line 382: warning: assignment type mismatch: pointer to char "=" pointer to const char Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23AuthAudit: clean up string handling callsAlan Coopersmith1-6/+5
The extra "out" pointer to redirect writes to the array isn't needed since the removal of LBX (commit a9ed5a87902a), and eliminating it allows more logical use of sizeof(addr) in length-checked strlcpy & snprintf calls to write to it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert DetermineClientCmd to use strdup instead of malloc+strncpyAlan Coopersmith1-7/+1
*cmdname is initialized to NULL earlier in the function, so it's okay to overwrite it with NULL if strdup fails, don't need that extra check. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert strncpy/strncat to strlcpy/strlcatAlan Coopersmith1-4/+2
As long as we're carrying around a compatibility copy in os/strl*.c, might as well use them. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert some malloc + strncpy pairs into strndup callsAlan Coopersmith1-3/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Add fallback implementation of strndup()Alan Coopersmith2-0/+53
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Linux test code fixed by: Keith Packard <keithp@keithp.com>
2011-11-23Remove a couple Error() instances left behind by 09dbfcb0ad7b6c8Alan Coopersmith1-2/+2
Two instances found in the SIOCGIFCONF code for listing network interfaces. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-18record: Prevent out of bounds access when recording a reply.Rami Ylimäki1-0/+1
Any pad bytes in replies are written to the client from a zeroed array. However, record extension tries to incorrectly access the pad bytes from the end of reply data. Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2011-10-18Merge remote-tracking branch 'herrb/master'Keith Packard1-2/+2
2011-10-18Fix CVE-2011-4029: File permission change vulnerability.Matthieu Herrb1-1/+1
Use fchmod() to change permissions of the lock file instead of chmod(), thus avoid the race that can be exploited to set a symbolic link to any file or directory in the system. Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-10-18Fix CVE-2011-4028: File disclosure vulnerability.Matthieu Herrb1-1/+1
use O_NOFOLLOW to open the existing lock file, so symbolic links aren't followed, thus avoid revealing if it point to an existing file. Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-10-11os: Remove Error()Jeremy Huddleston3-18/+6
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-03Merge remote-tracking branch 'alanc/master'Keith Packard1-0/+1
2011-09-26Merge remote-tracking branch 'whot/next'Keith Packard2-48/+123
2011-09-23dix and os: gitignore dix.O and os.OGaetan Nadon1-0/+1
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-21Use internal temp variable for swap macrosMatt Turner2-7/+5
Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-08-22config: add udev/systemd multi-seat supportLennart Poettering1-0/+10
Add support for multi-seat-aware input device hotplugging. This implements the multi-seat scheme explained here: http://www.freedesktop.org/wiki/Software/systemd/multiseat This introduces a new X server switch "-seat" which allows configuration of the seat to enumerate hotplugging devices on. If specified the value of this parameter will also be exported as root window property Xorg_Seat. To properly support input hotplugging devices need to be tagged in udev according to the seat they are on. Untagged devices are assumed to be on the default seat "seat0". If no "-seat" parameter is passed only devices on "seat0" are used. This means that the new scheme is perfectly compatible with existing setups which have no tagged input devices. Note that the -seat switch takes a completely generic identifier, and that it has no effect on non-Linux systems. In fact, on other OSes a completely different identifier scheme for seats could be used but still be exposed with the Xorg_Seat and -seat. I tried to follow the coding style of the surrounding code blocks if there was any one could follow. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22os/log: Add LogVHdrMessageVerb and friendsDaniel Kurtz1-0/+55
LogVHdrMessageVerb allows a custom header to be inserted in a log message, between the Log system's MessageType string, and a formatted variable message body. The custom header can itself be a formatted variable string. These functions can be used, for example, by driver abstraction layers to format specific driver messages in a standard format, but do it in a way that is efficient, obeys the log-layers verbosity settings, and is safe to use in signal handlers (because they don't call malloc), even for types besides X_NONE. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22os/log: Pull LogMessageTypeVerbString out of LogVMessageVerbDaniel Kurtz1-48/+58
Also, optimize how the type and format strings are combined. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Guillem Jover <guillem@hadrons.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-27Terminate the log with one last message.Peter Hutterer1-2/+4
Instead of just closing the log when everything is done, put one more message in stating that we're actually terminating. Users or scripts that look at the Xorg.log will then know that a) the server has terminated properly and b) why the server terminated (to some degree, given that most real-world errors will be caused by AbortServer()). Acked-by: Gaetan Nadon <memsize@videotron.ca> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Tested-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-06-23Don't use empty source filesDan Nicholson2-7/+1
When an empty _SOURCES variable is declared, automake will recognize that only linking is needed. Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Tested-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-05XQuartz: Make a copy of args for our crash reporter vsnprintfJeremy Huddleston1-1/+6
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-04-25os: Silence warnings when building with clangJeremy Huddleston3-1/+10
access.c:1492:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses] if ((host->family == FamilyServerInterpreted)) { ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ access.c:1492:20: note: use '=' to turn this equality comparison into an assignment if ((host->family == FamilyServerInterpreted)) { ^~ = access.c:1492:20: note: remove extraneous parentheses around the comparison to silence this warning if ((host->family == FamilyServerInterpreted)) { ~ ^ ~ In file included from xstrans.c:8: In file included from /usr/X11/include/X11/Xtrans/transport.c:62: /usr/X11/include/X11/Xtrans/Xtranssock.c:262:5: error: implicit declaration of function 'ErrorF' is invalid in C99 [-Werror,-Wimplicit-function-declaration] PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0); ^ log.c:180:29: error: format string is not a string literal [-Werror,-Wformat-nonliteral] if (asprintf(&logFileName, fname, display) == -1) ^~~~~ log.c:190:26: error: format string is not a string literal [-Werror,-Wformat-nonliteral] if ((asprintf(&suffix, backup, display) == -1) || ^~~~~~ log.c:382:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral] LogVWrite(verb, tmpBuf, args); ^~~~~~ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-04-07os: fix use after free in EstablishNewConnectionsTiago Vignatti1-4/+3
In the case of failure on AllocNewConnection, new_trans_conn cannot be dereferenced because it's already freed. Swapping the order of this logic fix the changes introduced in 04956b80431169e0ae713a3e6ba4cdc157ce3a66. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> CC: Jeremy Huddleston <jeremyhu@freedesktop.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-04-04os: fix memory and fd leaks in PopenTiago Vignatti1-0/+3
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>