summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-bus/bus-socket.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2016-02-231-1/+1
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* Merge pull request #2589 from keszybz/resolve-tool-2Lennart Poettering2016-02-131-3/+3
|\ | | | | Better support of OPENPGPKEY, CAA, TLSA packets and tests
| * Add memcpy_safeZbigniew Jędrzejewski-Szmek2016-02-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO/IEC 9899:1999 §7.21.1/2 says: Where an argument declared as size_t n specifies the length of the array for a function, n can have the value zero on a call to that function. Unless explicitly stated otherwise in the description of a particular function in this subclause, pointer arguments on such a call shall still have valid values, as described in 7.1.4. In base64_append_width memcpy was called as memcpy(x, NULL, 0). GCC 4.9 started making use of this and assumes This worked fine under -O0, but does something strange under -O3. This patch fixes a bug in base64_append_width(), fixes a possible bug in journal_file_append_entry_internal(), and makes use of the new function to simplify the code in other places.
* | tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
|/ | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* selinux: split up mac_selinux_have() from mac_selinux_use()Lennart Poettering2015-11-271-1/+1
| | | | | | | | | | | | | Let's distuingish the cases where our code takes an active role in selinux management, or just passively reports whatever selinux properties are set. mac_selinux_have() now checks whether selinux is around for the passive stuff, and mac_selinux_use() for the active stuff. The latter checks the former, plus also checks UID == 0, under the assumption that only when we run priviliged selinux management really makes sense. Fixes: #1941
* sd-bus: don't try to acquire connection selinux label unless selinux is ↵Lennart Poettering2015-11-111-3/+6
| | | | | | | | | | actually enabled Otherwise we might end up mistaking a SMACK label for an selinux label. Also, fixes unexpect debug messages: http://lists.freedesktop.org/archives/systemd-devel/2015-November/034913.html
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out printf() helpers to stdio-util.hLennart Poettering2015-10-271-1/+2
|
* util-lib: split out hex/dec/oct encoding/decoding into its own fileLennart Poettering2015-10-271-0/+1
|
* util-lib: split out user/group/uid/gid calls into user-util.[ch]Lennart Poettering2015-10-261-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-1/+2
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-8/+9
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* sd-bus: correct size calculation in DBus fd receiveMichal Schmidt2015-09-161-1/+1
| | | | | | | The size of the allocated array for received file descriptors was incorrectly calculated. This did not matter when a single file descriptor was received, but for more descriptors the allocation was insufficient.
* basic: util - fix errorhandling in unhexmem()Tom Gundersen2015-07-121-8/+12
| | | | | | | | | | | | | | We were ignoring failures from unhexchar, which meant that invalid hex characters were being turned into garbage rather than the string rejected. Fix this by making unhexmem return an error code, also change the API slightly, to return the size of the returned memory, reflecting the fact that the memory is a binary blob,and not a string. For convenience, still append a trailing NULL byte to the returned memory (not included in the returned size), allowing callers to treat it as a string without doing a second copy.
* util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering2015-06-101-6/+10
| | | | | It's only marginally shorter then the usual for() loop, but certainly more readable.
* Merge pull request #85 from keszybz/selinux-contextZbigniew Jędrzejewski-Szmek2015-06-101-68/+19
|\
| * sd-bus: store selinux context at connection timeZbigniew Jędrzejewski-Szmek2015-06-101-0/+7
| | | | | | | | | | | | | | | | | | | | This appears to be the right time to do it for SOCK_STREAM unix sockets. Also: condition bus_get_owner_creds_dbus1 was reversed. Split it out to a separate variable for clarity and fix. https://bugzilla.redhat.com/show_bug.cgi?id=1224211
| * sd-bus: do not use per-datagram auxiliary informationZbigniew Jędrzejewski-Szmek2015-06-101-68/+12
| | | | | | | | | | | | | | | | | | | | | | | | SELinux information cannot be retrieved this way, since we are using stream unix sockets and SCM_SECURITY does not work for them. SCM_CREDENTIALS use dropped to be consistent. We also should get this information at connection time. https://bugzilla.redhat.com/show_bug.cgi?id=1224211 "SCM_SECURITY was only added for datagram sockets."
* | sd-bus: remove ucred parameter from bus_message_from_header() since we don't ↵Lennart Poettering2015-06-101-1/+0
| | | | | | | | use it anymore
* | tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering2015-06-101-1/+2
|/ | | | | | | | | | mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
* util: split out signal-util.[ch] from util.[ch]Lennart Poettering2015-05-291-1/+2
| | | | No functional changes.
* bus-socket: simplify initalization of struct msghdrZbigniew Jędrzejewski-Szmek2015-05-201-12/+8
|
* util: introduce memmem_safe() and make use of itLennart Poettering2015-05-141-1/+1
| | | | | | | | GNU memmem() requires a nonnull first parameter. Let's introduce memmem_safe() that removes this restriction for zero-length parameters, and make use of it where appropriate. http://lists.freedesktop.org/archives/systemd-devel/2015-May/031705.html
* sd-bus: don't inherit connection creds into message creds when we have a ↵Lennart Poettering2015-04-231-2/+2
| | | | | | | direct connection It's never a good idea, let's just not do it, not even on dierct connections.
* core: explicitly specify credentials for direct connections, tooLennart Poettering2015-04-231-1/+1
| | | | | | So far we authenticate direct connections primarily at connection time, but let's also do this for each method individually, by attaching the creds we need for that right away.
* shared: add formats-util.hRonny Chevalier2015-04-101-0/+1
|
* Use space after a silencing (void)Zbigniew Jędrzejewski-Szmek2015-03-141-2/+2
| | | | | We were using a space more often than not, and this way is codified in CODING_STYLE.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-3/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen2015-02-121-1/+1
| | | | | | include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
* Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek2015-02-011-5/+3
| | | | | | | | | | If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
* bus-socket: fix CID#996290 Unchecked return valueSusant Sahani2014-11-171-2/+2
|
* Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek2014-05-151-1/+1
| | | | No functional change expected :)
* util: replace close_pipe() with new safe_close_pair()Lennart Poettering2014-03-241-1/+1
| | | | | | safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s...
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-181-2/+2
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* Use strlen even for constant stringsJosh Triplett2014-03-161-2/+2
| | | | | | | | | | | GCC optimizes strlen("string constant") to a constant, even with -O0. Thus, replace patterns like sizeof("string constant")-1 with strlen("string constant") where possible, for clarity. In particular, for expressions intended to add up the lengths of components going into a string, this often makes it clearer that the expression counts the trailing '\0' exactly once, by putting the +1 for the '\0' at the end of the expression, rather than hidden in a sizeof in the middle of the expression.
* libsystemd: split up into subdirsTom Gundersen2014-01-211-0/+1105
We still only produce on .so, but let's keep the sources separate to make things a bit less messy.