Commit graph

18144 commits

Author SHA1 Message Date
Lennart Poettering 3acc1dafd1 sd-bus: add new call sd_bus_get_scope() for querying whether one is connected to a system or a user bus 2014-11-28 16:17:33 +01:00
Lennart Poettering 52cfc0379a sd-bus: rework credential query logic
Also, make the call to free kdbus slices generic and use it everywhere
2014-11-28 16:17:33 +01:00
Michal Schmidt 279d3c9cea treewide: more log_*_errno() conversions 2014-11-28 14:45:55 +01:00
Michal Schmidt ff49bc3212 treewide: drop unnecessary trailing \n in log_*() calls 2014-11-28 14:26:31 +01:00
Michal Schmidt c95f97a20f core: two more log_unit_*_errno() conversions 2014-11-28 13:54:40 +01:00
Michal Schmidt 31938a8560 core: convert log_unit_*() to log_unit_*_errno()
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_unit_(debug|info|notice|warning|error|emergency)\(([^"]+), "(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_unit_\1_errno(\2, \5, "\3%m"\4);/'
2014-11-28 13:29:21 +01:00
Michal Schmidt b2dc4e44c5 core: add log_unit_*_errno() macros 2014-11-28 13:29:21 +01:00
Michal Schmidt da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt 0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
Michal Schmidt b4d23205f2 shared: fix log_emergency_errno macro
It was not passing the error argument.
2014-11-28 11:54:25 +01:00
Lennart Poettering e8bbb7c7e9 update TODO 2014-11-28 03:29:52 +01:00
Lennart Poettering 1214b53c8e kdbus: when running in a container, don't complain that we cannot write to /sys 2014-11-28 03:16:56 +01:00
Lennart Poettering bf371116f6 log: change log_xyz_errno() calls to always return the negative error
This enables us to write things like this:

    int open_some_file(void) {

            fd = open("/dev/foobar", O_RDWR|O_CLOEXEC);
            if (fd < 0)
                    return log_error_errno(errno, "Failed to reboot: %m");

            return fd;
    }

Which is function that returns -errno on failure, as well as printing an
error message, all in one line.
2014-11-28 03:16:56 +01:00
Lennart Poettering 95066a9061 log: make socket address structs static const 2014-11-28 03:16:56 +01:00
Lennart Poettering 6357ac664c log: also set errno to the passed error code before processing format string in log_struct()
That way the caller may use %m to print the specified error.
2014-11-28 03:16:56 +01:00
Lennart Poettering 387eba0084 core: only override kdbus attach mask when running as PID 1 2014-11-28 02:26:05 +01:00
Lennart Poettering 412c18f10c sd-bus: the attach_mask kernel module parameter is 64bit now, hence initialize it as such 2014-11-28 02:25:45 +01:00
Lennart Poettering 8f16f51d93 log: allow negative errno values
sd_bus_error_set_errno() allows negative errors too, hence, be equally
nice.
2014-11-28 02:18:46 +01:00
Lennart Poettering e2cc6eca73 log: fix order of log_unit_struct() to match other logging calls
Also, while we are at it, introduce some syntactic sugar for creating
ERRNO= and MESSAGE= structured logging fields.
2014-11-28 02:18:46 +01:00
Lennart Poettering 6c861f0aef networkd: update logging macros for parameter order, and errno, to match rest of the code 2014-11-28 02:18:46 +01:00
Lennart Poettering bca3e263cf update TODO 2014-11-28 02:18:46 +01:00
Lennart Poettering ac3ab439f0 networkd: remove duplicate macro definitions 2014-11-28 02:17:50 +01:00
David Herrmann 622ac87c12 Update TODO
kdbus eavesdropping was fixed!
2014-11-28 01:03:54 +01:00
Zbigniew Jędrzejewski-Szmek aad0a2c800 sysv-generator: advertise the man page 2014-11-27 17:22:28 -05:00
Zbigniew Jędrzejewski-Szmek f509443af5 man: add systemd-sysv-generator(8)
In principle SysV stuff is only for compatibility, but we are stuck
with it for the forseeable future, so documentation might as well
be provided.

https://bugs.debian.org/771172
2014-11-27 17:22:26 -05:00
Thomas Hindoe Paaboel Andersen b5a1e50495 fix build with --enable-terminal
Broke with 086891e5c1
2014-11-27 23:18:34 +01:00
Lennart Poettering 3da44ef53b kmod-setup: simplify kernel command line parsing 2014-11-27 22:05:24 +01:00
Lennart Poettering 1a29929959 kdbus: set kernel attach mask before creating the first bus 2014-11-27 22:05:24 +01:00
Lennart Poettering 12f1caf40c selinux: log selinux log messages with LOG_AUTH facility 2014-11-27 22:05:24 +01:00
Lennart Poettering 79008bddf6 log: rearrange log function naming
- Rename log_meta() → log_internal(), to follow naming scheme of most
  other log functions that are usually invoked through macros, but never
  directly.

- Rename log_info_object() to log_object_info(), simply because the
  object should be before any other parameters, to follow OO-style
  programming style.
2014-11-27 22:05:24 +01:00
Lennart Poettering e09ca588d2 log: be a bit less wasteful when allocating buffers 2014-11-27 22:05:24 +01:00
Lennart Poettering 086891e5c1 log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers
This change has two benefits:

- The format string %m will now resolve to the specified error (or to
  errno if the specified error is 0. This allows getting rid of a ton of
  strerror() invocations, a function that is not thread-safe.

- The specified error can be passed to the journal in the ERRNO= field.

Now of course, we just need somebody to convert all cases of this:

        log_error("Something happened: %s", strerror(-r));

into thus:

        log_error_errno(-r, "Something happened: %m");
2014-11-27 22:05:23 +01:00
Lennart Poettering fb6d9b77a7 sd-bus: set creds info for "org.freedesktop.DBus.Local" generated messages, too 2014-11-27 22:05:23 +01:00
Lennart Poettering 38ce47e262 sd-bus: when we get the list of well-known names back from kdbus we shouldn't confuse the empty list with unknown information 2014-11-27 22:02:13 +01:00
Lennart Poettering 771b2724c0 sd-bus: deal with whitespace in matches 2014-11-27 22:02:12 +01:00
Lennart Poettering 7d31d92400 sd-bus: unify logic how we patch the message source of driver messages 2014-11-27 22:02:12 +01:00
Lennart Poettering ac653862e0 sd-bus: fake valid well-known-names metadata for faked bus messages 2014-11-27 22:02:12 +01:00
Lennart Poettering 50c4521675 sd-bus: optimize how we generate the well-known-names lists in messages from kdbus 2014-11-27 22:02:12 +01:00
Lennart Poettering 7fa934b0d3 sd-bus: be stricter with mismatches between dbus1 and kdbus message headers 2014-11-27 22:02:12 +01:00
Lennart Poettering 78f9b196ab bus-proxy: beef up policy enforcement
- actually return permission errors to clients

- use the right ucreds field

- fix error paths when we cannot keep track of locally acquired names
  due to OOM

- avoid unnecessary global variables

- log when the policy denies access

- enforce correct policy rule order

- always request all the metadata its we need to make decisions
2014-11-27 22:02:12 +01:00
Lennart Poettering 9398f65093 update TODO 2014-11-27 21:58:19 +01:00
Lennart Poettering 64e96a194d bus-proxy: check passed parameter signature of all driver method calls 2014-11-27 21:58:07 +01:00
Alin Rauta be660c371b networkd: fix kernel rtnl receive buffer overrun error
We got the following error when running systemd on a device  with many ports:

"rtnl: kernel receive buffer overrun
Event source 'rtnl-receive-message' returned error, disabling: No buffer space
available"

I think the kernel socket receive buffer queue should be increased. The default
value is taken from:
"/proc/sys/net/core/rmem_default", but we can overwrite it using SO_RCVBUF
socket option.

This is already done in networkd for other sockets.
For example, the bus socket (sd-bus/bus-socket.c) has a receive queue of 8MB.
In our case, the default is 208KB.

Increasing the buffer receive queue for manager socket to 512KB should be enough
to get rid of the above error.

[tomegun: bump the limit even higher to 8M]
2014-11-27 18:59:47 +01:00
Stanisław Pitucha 0e3434aeb1 resolve: reject empty TXT records
TXT records should have at least one character, so enforce this.

Before 0f84a72 parser SIGSEGV'd on ->txt.strings being NULL, but
even if this is fixed we should reject invalid TXT records.
2014-11-27 11:07:43 -05:00
Stanisław Pitucha 59aa582137 resolve: set error code on failure
Set the error code in case of incorrect name. This prevents continuing
and failing an assert(name) later on.
2014-11-27 16:40:11 +01:00
Stanisław Pitucha c75dbf9bea resolve: fix redirection loops in compressed RR
Loops in RR compression were only detected for the first entry.
Multiple redirections should be allowed, each one checking for an
infinite loop on its own starting point.
Also update the pointer on each redirection to avoid longer loops of
labels and redirections, in names like:
(start) [len=1] "A", [ptr to start]

(David: rename variable to "jump_barrier" and add reference to RFC)
2014-11-27 16:35:56 +01:00
Michal Schmidt c21b92ffe7 core: fix transaction destructiveness check once more
The previous fix e0312f4db "core: fix check for transaction
destructiveness" broke test-engine (noticed by Zbyszek).
Apparently I had a wrong idea of the intended semantics of --fail.

The manpage says the operation should fail if it "conflicts with a
pending job (more specifically: causes an already pending start job to
be reversed into a stop job or vice versa)".

So let's check job_type_is_conflicting, instead of !is_superset.

This makes both test-engine and TEST-03-JOBS pass again.
2014-11-27 16:14:58 +01:00
David Herrmann 0f84a72e3c resolve: fix NULL deref on strv comparison
A strv might be NULL if it is empty. The txt.strings comparison doesn't
take that into account. Introduce strv_equal() to provide a proper helper
for this and fix resolve to use it.

Thanks to Stanisław Pitucha <viraptor@gmail.com> for reporting this!
2014-11-27 16:10:44 +01:00
David Herrmann 342f3005f5 bus: prefix custom endpoints with "$UID-"
The kdbus module will later get a policy that endpoint-names are
restricted to "<uid>-<name>" just like bus-names. Make sure that systemd
is already compatible to that.
2014-11-27 13:49:41 +01:00
Peter Hutterer 0213a26f65 hwdb: add a new db for the DPI/frequency settings of mice
Pointer acceleration for relative input devices (mice, trackballs, etc.)
applies to the deltas of the device. Alas, those deltas have no physical
reference point - a delta of 10 may be caused by a large movement of a
low-dpi mouse or by a minute movement of a high-dpi mouse.
Which makes pointer acceleration a bit useless and high-dpi devices
essentially unusable.

In an ideal world, we could read the DPI from the device directly and work
with that. In the world we actually live in, we need to compile this list
manually. This patch introduces the database, with the usual match formats
and a single property to be set on a device: MOUSE_DPI

That is either a single value for most mice, or a list of values for mice
that can change resolution at runtime. The exact format is detailed in the
hwdb file.

Note that we're explicitly overshooting the requirements we have for
libinput atm. Frequency could be detected in software and we don't
actually use the list of multiple resolutions (because we can't detect
when they change anyway). However, we might as well collect those values
from the get-go, adding/modifying what will eventually amount to hundreds
of entries is a bit cumbersome.

Note: we rely on the input_id builtin to tag us as mouse first, ordering
of the rules is important.

(David: fixed up typos and moved hwdb file into ./hwdb/)
2014-11-27 12:30:08 +01:00