Commit graph

21652 commits

Author SHA1 Message Date
David Herrmann 8d87d4a989 busctl: make sure --address connects as bus-client
There is really no reason to use `busctl` to connect to legacy private
bus endpoints. Fix this and make sure `busctl --address=unix:path=/foo`
works!
2015-07-31 20:00:21 +02:00
Lennart Poettering cad6982291 CODING_STYLE: say that "for (;;)" is better than "while (1)" 2015-07-31 20:00:07 +02:00
Daniel Mack e76398868a test-socket-util: add test for in_addr_is_null() 2015-07-31 19:58:29 +02:00
Daniel Mack ff9265d089 test-util: add more tests
Add tests for safe_ato[iu]16() and some more unbase32hexmem() torture.
2015-07-31 19:58:29 +02:00
Daniel Mack da8ba7219a test: add test for static lists
Test af-list and arphdr-list.
2015-07-31 19:58:27 +02:00
David Herrmann 97b11eedff tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
        free(foobar);
        foobar = NULL;
to this:
        foobar = mfree(foobar);
2015-07-31 19:56:38 +02:00
Daniel Mack c474a4ecfa Merge pull request #811 from namhyung/busctl-misc-v2
busctl: Misc cleanups and a fix (v2)
2015-07-31 19:40:57 +02:00
Daniel Mack 6ba32d1c2f Merge pull request #810 from mamikk/bitmap-fixes-v2
Bitmap fixes v2
2015-07-31 19:21:51 +02:00
Namhyung Kim cbfa6a4131 busctl: fix assertion failure on --size option
Using --size option triggers an assert failure below because
parse_size() requires the second argument, base, being either 1000 or
1024.  As it's for a packet size, it'd be better using IEC binary
suffix (base 1024) IMHO.

  $ busctl --size 2048
  Assertion 'base == 1000 || base == 1024' failed at src/basic/util.c:2222,
  function parse_size(). Aborting.
  Aborted (core dumped)
2015-08-01 02:20:47 +09:00
Namhyung Kim d28ebe27f2 busctl: add missing description of --size option
The size option was to specify maximum captured patch length but was
missing its description in the command line help.  Add it.
2015-08-01 02:20:37 +09:00
Namhyung Kim c030a850ba busctl: add and use strcmp_ptr()
In member_compare_func(), it compares interface, type and name of
members.  But as it can contain NULL pointer, it needs to check them
before calling strcmp().  So make it as a separate strcmp_ptr
function (named after streq_ptr) so that it can be used by others.

Also let streq_ptr() to use it in order to make the code simpler.
2015-08-01 02:16:24 +09:00
Marcel Holtmann 3d5ff087ce hwdb: Update database of Bluetooth company identifiers 2015-07-31 19:12:24 +02:00
Martin Mikkelsen 951c3eefac bitmap: make bitmap_clear free the bitmap array
Given two bitmaps and the following code:

  Bitmap *a = bitmap_new(), *b = bitmap_new();
  bitmap_set(a, 1);
  bitmap_clear(a);
  bitmap_set(a, 0);
  bitmap_set(b, 0);

These two bitmaps should now have the same bits set and they should be
equal but bitmap_equal() will return false in this case because while
bitmap_clear() resets the number of elements in the array it does not
clear the array and bitmap_set() expects the array to be cleared.
GREEDY_REALLOC0 looks at the allocated size and not the actual size so
it does not clear any memory.

Fix this by freeing the allocated memory and resetting the whole Bitmap
to an initial state in bitmap_clear().

This also adds test code for this issue.
2015-07-31 19:08:26 +02:00
Martin Mikkelsen d5fa819958 bitmap: fix bitmap_equal on bitmaps with unset bits
Given two bitmaps and the following code:

Bitmap *a = bitmap_new(), *b = bitmap_new();
bitmap_set(a, 0);
bitmap_unset(a, 0);

These two bitmaps should now have the same bits set and they should be
equal but bitmap_equal() will return false in this case because the
bitmaps array in a is larger because of the bit which was previously
set.

Fix this by comparing only the bits which exists in both bitmaps and
then check that the rest of the bits (if any) is all zero.

This also adds test code for this issue.
2015-07-31 18:57:13 +02:00
David Herrmann b2a0ac5e5b bus-proxy: allow empty arguments to UpdateActivationEnvironment()
There is no reason to prevent empty argument lists on
UpdateActivationEnvironment(). Make sure we don't fail, but still skip
the call to pid1.
2015-07-31 18:56:38 +02:00
David Herrmann 10fa421cd2 NEWS: update
Add new functionality and behavior changes to NEWS for the imminent bugfix
release 224.
2015-07-31 18:21:19 +02:00
David Herrmann 11811e856b build: bump version to 224
Prepare for bug-fix release and bump versions.
2015-07-31 18:13:57 +02:00
Kay Sievers 1e40e358ee hwdb: update 2015-07-31 18:08:55 +02:00
Lennart Poettering aba8a9d1d2 Merge pull request #806 from dvdhrm/proxy-cookie
bus-proxy: fix cookie namespacing
2015-07-31 17:56:02 +02:00
David Herrmann 10189fd6be logind: release VT-positions when closing sessions
Make sure we release VT-positions when a session is closed. Otherwise,
lingering sessions will occupy VTs and prevent next logins from
succeeding.

Note that we already release session-devices when closing a session, so
there cannot be anyone using the VT anymore.
2015-07-31 16:52:29 +02:00
David Herrmann 970ad53dd6 bus-proxy: fix cookie namespacing
If we generate messages from within bus-proxyd, we really must make sure
that we do not clutter the cookie-namespace of our client. The client has
full control over it, so we cannot steal cookies from it. However, we can
re-use the cookie the client used for our request. As long as we only
send a single message, we're fine.
2015-07-31 16:42:38 +02:00
Kay Sievers b506d3141b timesyncd: remove RLIMIT_NPROC
NSS plugins might create additional threads. Remove the limit, we cannot
really make any assumptions here.
2015-07-31 15:33:49 +02:00
Kay Sievers 4b6ac4326a Merge pull request #803 from mixi/master
build-sys: use 'test -f' instead of AC_CHECK_FILE
2015-07-31 15:25:53 +02:00
Daniel Mack e87cedf350 Merge pull request #804 from dvdhrm/proxy-directed2
bus-proxy: make NameAcquired/Lost directed (v2)
2015-07-31 15:04:21 +02:00
Daniel Mack 832089af55 Merge pull request #805 from dvdhrm/proxy-activation
bus-proxy: make StartServiceByName synchronous
2015-07-31 15:03:49 +02:00
David Herrmann 11f254be0c bus-proxy: make StartServiceByName synchronous
The StartServiceByName() call was provided by dbus-daemon to activate a
service without sending a message. On receiption, dbus-daemon schedules
an activation request (different modes are supported) and sends back the
reply once activation is done.

With kdbus, we marked StartServiceByName() as deprecated. There is no
real reason to start services explicitly. Instead, applications should
just *use* the service and rely on it being activated implicitly.
However, we provide compatibility with dbus-daemon and implement
StartServiceByName() on the proxy via a call to
org.freedesktop.DBus.Peer.Ping() on the destination. This will activate
the peer implicitly as part of the no-op Ping() method call (regardless
whether the peer actually implements that call).

Now, the problem is, StartServiceByName() was synchronous on dbus-daemon
but isn't on bus-proxy. Hence, on return, there is no guarantee that
ListNames includes the activated name. As this is required by some
applications, we need to make this synchronous.

This patch makes the proxy track the Ping() method call and send the
reply of StartServiceByName() only once Ping() returned. We do not look
at possible errors of Ping(), as there is no strict requirement for the
peer to implement org.freedesktop.DBus.Peer. Furthermore, any interesting
error should have already been caught by sd_bus_send() before.

Note:
        This race was triggered by gdbus. The gdbus-proxy implementation
        relies on a name to be available after StartServiceByName()
        returns. This is highly fragile and should be dropped by gdbus.
        Even if the call is synchronous, there is no reason whatsoever to
        assume the service did not exit-on-idle before ListNames()
        returns.
        However, this race is much less likely than the startup race, so
        we try to be compatible to dbus-daemon now.
2015-07-31 13:56:39 +02:00
Johannes Nixdorf 182247ea92 build-sys: use 'test -f' instead of AC_CHECK_FILE
AC_CHECK_FILE fails when cross-compiling. It is intended to be used to
check for files that are used at runtime during build time (e.g.
/etc/passwd, /dev/*) [1]. For files which are only used at build time
'test -f' is sufficient.

[1]: https://lists.gnu.org/archive/html/autoconf/2000-10/msg00018.html
2015-07-31 13:38:49 +02:00
David Herrmann a87d2ed1ce bus-proxy: don't filter directed signals
NameAcquired and NameLost are directed signals. Never ever filter them on
dbus1. On dbus1, filters *exclusively* apply to broadcasts! Hence, we
must always forward directed signals unconditionally!
2015-07-31 13:28:23 +02:00
David Herrmann e3c57a86f6 bus-proxy: fix NameAcquired and NameLost to be directed
The NameAcquired and NameLost signals are _directed_ signals. Make sure
we properly set the destination correctly, and verify it in our
proxy-test.
2015-07-31 13:28:21 +02:00
David Herrmann 0810bc568a basic: fix error/memleak in socket-util
Probably a typo, checking 'ret' instead of the return value 'p'. This
might cause the function to return failure, even though it succeeded.
Furthermore, it might leak resources.
2015-07-31 11:52:21 +02:00
Daniel Mack 6189e043d4 Merge pull request #799 from andreaskem/hwdb-pull
hwdb: DPI info for Logitech G402 mouse
2015-07-31 10:51:32 +02:00
Andreas Kempf 3407fcd575 hwdb: Add mouse DPI info for Logitech G402.
DPI information was taken from the device's setup guide.

Additional (shortened) information from udevadm info:

P: .../usb2/2-1/2-1:1.0/0003:046D:C07E.0002/input/input6/event2
N: input/event2
S: input/by-id/usb-Logitech_Gaming_Mouse_G402_6D93117D5049-event-mouse
S: input/by-path/pci-0000:00:12.0-usb-0:1:1.0-event-mouse
...
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_INPUT_MOUSE=1
E: ID_MODEL=Gaming_Mouse_G402
E: ID_MODEL_ENC=Gaming\x20Mouse\x20G402
E: ID_MODEL_ID=c07e
E: ID_PATH=pci-0000:00:12.0-usb-0:1:1.0
E: ID_PATH_TAG=pci-0000_00_12_0-usb-0_1_1_0
E: ID_REVISION=9002
E: ID_SERIAL=Logitech_Gaming_Mouse_G402_6D93117D5049
E: ID_SERIAL_SHORT=6D93117D5049
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030102:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Logitech
E: ID_VENDOR_ENC=Logitech
E: ID_VENDOR_ID=046d
E: LIBINPUT_DEVICE_GROUP=3/46d/c07e/111:usb-0000:00:12.0-1
E: MAJOR=13
E: MINOR=66
E: SUBSYSTEM=input
...
2015-07-31 10:34:27 +02:00
Andreas Kempf 8601a85cb4 hwdb: Update info for potential contributors.
Update the location of the bug tracker and mention that pull requests
are preferred.
2015-07-31 10:34:27 +02:00
Kay Sievers 540536ffd1 systemd-boot: sort /EFI/Linux/*.efi files 2015-07-30 18:28:02 +02:00
Daniel Mack 8e542fcdc4 unit-name: fix memory leak
Fix a memory leak introduced by 2fc09a9c. 's' is used twice in this
function, and if free_and_strdup() fails, the pointer is left untouched.
2015-07-30 15:51:50 +02:00
Daniel Mack ed070f131f Merge pull request #787 from dvdhrm/bus-list
sd-bus: fix parsing of KDBUS_CMD_LIST
2015-07-30 15:35:52 +02:00
David Herrmann 89c240e3a5 sd-bus: fix parsing of KDBUS_CMD_LIST
We *must not* assume that an entry returned by KDBUS_CMD_LIST only
carries a single KDBUS_ITEM_OWNED_NAME. Similarly, we already parse
multiple such items for message-metadata, so make sure we support the
same on KDBUS_CMD_LIST.

By relying on the kernel to return all names separately, we limit the
kernel API significantly. Stop this and let the kernel decide how to
return its data.
2015-07-30 14:12:09 +02:00
Daniel Mack 87d0ac4350 Merge pull request #784 from eworm-de/typo
man: fix typo in man systemd-machine-id-commit
2015-07-30 13:22:50 +02:00
David Herrmann 9e24850718 Merge pull request #785 from zonque/free-and-strdup
tree-wide: use free_and_strdup()
2015-07-30 13:22:15 +02:00
Daniel Mack 2fc09a9cdd tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent,
open-coded versions.
2015-07-30 13:09:01 +02:00
Christian Hesse 47c453f6a6 man: fix typo in man systemd-machine-id-commit 2015-07-30 10:24:16 +02:00
Daniel Mack 5f17089ac1 Merge pull request #783 from whot/hwdb-updates
Hwdb updates
2015-07-30 09:30:49 +02:00
Peter Hutterer 47b84eac21 hwdb: add min/max/resolution override for Appletouch one-button touchpads
Macbook2,1, late 2006 model.

https://bugzilla.redhat.com/show_bug.cgi?id=1246651
2015-07-30 16:17:19 +10:00
Peter Hutterer 5b7246d09d hwdb: add resolution values for Asus K52JT touchpad
https://bugs.freedesktop.org/show_bug.cgi?id=91364
2015-07-30 16:17:16 +10:00
Daniel Mack 65c85ef511 Merge pull request #779 from poettering/fflush-and-check
tree-wide: port everything over to fflush_and_check()
2015-07-29 20:43:54 +02:00
Tom Gundersen 1051d049a8 Merge pull request #764 from ssahani/vxlan1
networkd: Add VXLAN Netlink attributes
2015-07-29 20:40:17 +02:00
Daniel Mack c2570b3de2 Merge branch 'master' of github.com:systemd/systemd 2015-07-29 20:31:15 +02:00
Lennart Poettering dacd6cee76 tree-wide: port everything over to fflush_and_check()
Some places invoked fflush() directly with their own manual error
checking, let's unify all that by using fflush_and_check().

This also unifies the general error paths of fflush()+rename() file
writers.
2015-07-29 20:31:07 +02:00
Daniel Mack 7fc309b3a8 Merge branch 'pr/761' 2015-07-29 20:31:02 +02:00
Tom Gundersen be0c13707d networkd-wait-online: only consider interfaces given on the commandline
If some interfaces are given on the commandline, ignore all others.
2015-07-29 20:30:50 +02:00