summaryrefslogtreecommitdiff
path: root/src/libsystemd
AgeCommit message (Collapse)Author
2014-10-05bus: add assert to check that we're not freeing a static structureZbigniew Jędrzejewski-Szmek
CID #996315.
2014-10-03sd-id128: do stricter checking of random boot idZbigniew Jędrzejewski-Szmek
If we are bothering to check whether the kernel is not feeding us bad data, we might as well do it properly. CID #1237692.
2014-10-03sd-bus: split out cleanup into separate functionZbigniew Jędrzejewski-Szmek
m is always non-null at this point. This function is too long anyway.
2014-10-03sd-event: check the value of received signalZbigniew Jędrzejewski-Szmek
Appease coverity report #1237775. Also rename ss to n, to make it visually different from ss.
2014-10-02kdbus: don't clobber return values, use strjoin() instead of asprintf(), ↵Lennart Poettering
keep function invocations and variable declarations separate
2014-10-02kdbus: make sure we never invoke free() on an uninitialized pointer on OOMLennart Poettering
2014-10-02sd-bus: sync kdbus.h (ABI break!)Daniel Mack
struct kdbus_cmd_match got a flags field, which systemd currently makes no use of.
2014-10-02sd-bus: sync kdbus.h (ABI break)Daniel Mack
struct kdbus_cmd_conn_info takes a list of items now instead of a string. Fix the only user in SD of that ioctl.
2014-10-02sd-bus: use terms from the D-Bus Specification a bit moreSimon McVittie
D-Bus' type hierarchy as described in the spec is: \- basic \- fixed type (u, i, etc.) \- string-like type (s, o, g) \- container Someone seems to have referred to basic types as "simple types" at some point, but that term isn't defined in the D-Bus Specification, and seems redundant. So far I haven't renamed functions that use "trivial" in their names to mean "fixed type", to avoid confusion about whether a struct of constant length, like (iu), is a fixed type. The answer is that it is fixed-length, but is not a "fixed type", so I can see that something like bus_type_is_fixed() might be ambiguous.
2014-10-02PORTING-DBUS1: we use :1.%llu not :0.%llu for D-Bus unique bus namesSimon McVittie
2014-09-29bus: use 2M as maximum message size in benchmarkDavid Herrmann
The kdbus limit is 2M and we removed the bus-owner override. Therefore, use at most 2M as message size.
2014-09-29bus: sync kdbus.h (ABI break!)David Herrmann
2014-09-28sd-bus: clean up string length calculationDaniel Mack
Move the +1 calculus onto the definition of the variable, just to make the code a little easier to read. No functional change.
2014-09-23bus: remove unused checkThomas Hindoe Paaboel Andersen
strerror_r does not return null here and even if it did we would have problems already at the preceding strlen call. Found by coverity. Fixes: CID#1237770
2014-09-23sd-bus: sync kdbus.hDaniel Mack
2014-09-23sd-bus: sync kdbus.h (API break)Daniel Mack
Just a rename of two struct members to make the header file c++ compatible.
2014-09-22sd-bus: sync kdbus.h (API+ABI break)Daniel Mack
The kdbus logic name registry logic was changed to transport the actual name to acquire, release or report in a kdbus item. This brings the name API a little more in line with other calls, and allows for later augmentation. Follow that change on the systemd side.
2014-09-22login: add public sd_session_get_desktop() APIDavid Herrmann
The desktop brand is stored as DESKTOP variable for sessions. It can be set arbitrarily by the session owner and identifies the desktop environment that is running on that session.
2014-09-22bus: align kdbus ioctl parameters to 8byteDavid Herrmann
All kdbus ioctl arguments must be 8byte aligned. Make sure we use alloca_align() and _alignas_(8) in all situations where gcc doesn't guarantee 8-byte alignment. Note that objects on the stack are always 8byte aligned as we put _alignas_(8) into the structure definition in kdbus.h.
2014-09-18sd-rtnl: rtnl-message: remove unneeded linux includesEmil Renner Berthing
2014-09-18bus: fix bus_print_property() to use "int" for booleansDavid Herrmann
We always use "int" if we retrieve boolean values from sd-bus, as "bool" is only a single byte, but full int on va-args. Thanks to Werner Fink for the report!
2014-09-18sd-bus: sync kdbus.hDaniel Mack
(no API/ABI break this time)
2014-09-18Fix resource leak (coverity CID 1237760)Cristian Rodríguez
2014-09-17bus: fix error leak in bus_node_exists()David Herrmann
If we call into user callbacks, we must always propagate possible errors. Fix bus_node_exists() to do that and adjust the callers (which already partially propagated the error). Also speed up that function by first checking for registered enumerators and/or object-managers.
2014-09-17bus: never respond to GetManagedObjects() on sub-pathsDavid Herrmann
The dbus-spec clearly specifies that GetManagedObjects() should only work on the root-path of an object-tree. But on that path, it works regardless whether there are any objects available or not. We could, technically, define all sub-paths as a root-path of its own sub-tree. However, if we do that, we enter undefined territory: Imagine only a fallback vtable is registered. We want GetManagedObjects() to *NOT* fail with UNKNOWN_METHOD if it is called on a valid sub-tree of the fallback. On the other hand, we don't want it to work on arbitrary sub-tree. Something like: /path/to/fallback/foobar/foobar/foobar/invalid/foobar should not work. However, there is no way to know which paths on a fallback are valid without looking at there registered objects. If no objects are registered, we have no way to figure it out. Therefore, we now try to follow the dbus spec by only returning valid data on registered root-paths. We treat each path as root which was registered an object-manager on via add_object_manager(). So applications can now directly control which paths to place an object-manager on. We also fix the introspection to not return object-manager interfaces on non-root paths. Also fixes some dead-code paths initially reported by Philippe De Swert.
2014-09-16sd-bus: sd_bus_message_get_errno should only return positive errnoThomas Hindoe Paaboel Andersen
sd_bus_message_get_errno can currently return either a number of different poitive errno values (from bus-error-mapping), or a negative EINVAL if passed null as parameter. The check for null parameter was introduced in 40ca29a1370379d43e44c0ed425eecc7218dcbca at the same as the function was renamed from bus_message_to_errno and made public API. Before becoming public the function used to return only negative values. It is weird to have a function return both positive and negative errno and it generally looks like a mistake. The function is guarded by the --enable-kdbus flags so I wonder if we still have time to fix it up? It does not have any documentation yet. However, except for a few details it is just a convenient way to call sd_bus_error_get_errno which is documented to return only positive errno. This patch makes it return only positive errno and fixes up the two calls to the function that tried to cope with both positive and negative values.
2014-09-15sd-bus: use proper ITERATOR_FIRST abstractionMichal Schmidt
Do not assume hashmap iterators are pointers. They may be structs in an alternative hashmap implementation.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-09-11bus: unref buscreds on failurePhilippe De Swert
Actually unref the buscreds when we are not going to return a pointer to them. As when bus_creds_add_more fails we immediately return the error code otherwise and leak the new buscreds. Found with coverity. Fixes: CID#1237761
2014-09-11bus: avoid using m->kdbus after freeing itPhilippe De Swert
m->kdbus could be freed before it is released. Changing the order fixes the issue. Found with Coverity. Fixes: CID#1237798
2014-09-09udev: net_setup_link - open ethtool and rtnl connections lazilyTom Gundersen
2014-09-09udev: event - keep one rtnl per worker, rather than per eventTom Gundersen
Creating the rtnl context is cheap, but freeing it may not be, due to synchronous close(). Also drop some excessive logging. We now log about the changing ifname exactly once.
2014-09-08sd-network: add _get_network_file apiTom Gundersen
2014-09-08bus: add code to create custom endpoints and set their policyDaniel Mack
Custom endpoints are alternative connection points to a bus, allowing specific policy to be uploaded. Add two functions to bus-kernel. One to create such endpoints, and another one for setting a policy for them.
2014-09-08bus: factor out bus policy itemsDaniel Mack
In order to re-use the policy definitions, factor them out into their own files.
2014-09-01sd-rtnl: don't assign to unused variableTom Gundersen
Reported by Thomas H.P. Andersen <phomes@gmail.com>.
2014-08-30Fix a few more typosRuben Kerkhof
2014-08-29Fix a few typos in log messagesRuben Kerkhof
2014-08-28sd-event: simplify sd_event_source_set_name()David Herrmann
free_and_strdup() does exactly the same as sd_event_source_set_name(), use it!
2014-08-28sd-event: name event sources used in librariesTom Gundersen
This should help in debugging failing event sources.
2014-08-28sd-event: use event source name rather than address in debug messagesTom Gundersen
2014-08-28sd-event: allow naming event sourcesTom Gundersen
2014-08-28sd-rtnl: log if kernel buffer is overrun as we currently can't handle that caseTom Gundersen
2014-08-28bus: don't skip interfaces in bus_message_map_properties_changed()David Herrmann
Skipping interfaces randomly without the caller specifying it is nasty. Avoid this and let the caller do that themselves.
2014-08-28bus: fix use-after-free in slot-releaseDavid Herrmann
We must not access slot->floating after we possible dropped the last reference to it. Fix all callback-invocations to first check slot->floating and possible disconnect the slot, then release the last reference.
2014-08-27bus: split bus_map_all_properties into multiple helpersDavid Herrmann
The bus_map_all_properties() helper calls org.freedesktop.DBus.Properties.GetAll() on a given target and parses the result according to a given property-table. This simplifies dealing with DBus.Properties significantly. However, the function is blocking and thus not really useful in many situations. This patch extracts the core of this function and adds two new helpers which directly take dbus-messages as arguments. This way, you can issue asynchronous requests and parse the result via these helpers: bus_message_map_all_properties(): This is the same as bus_map_all_properties() but takes the result message from a GetAll() request as argument. You can thus issue an asynchronous GetAll() request and then use this helper once you got the result. bus_message_map_properties_changed(): This function takes a signal-message that was retrieved via a PropertiesChanged signal and then parses it like if you retrieved it via GetAll(). Furthermore, this function returns the number of matched properties that got invalidated by the PropertiesChanged signal, but didn't carry the new value. This way, the caller can issue a new GetAll() request and then parse the result. The old function bus_map_all_properties() is functionally unchanged, but now uses bus_message_map_all_properties() internally.
2014-08-26sd-bus: don't include internal header memfd.h in public header sd-bus.hHristo Venev
https://bugs.freedesktop.org/show_bug.cgi?id=83097
2014-08-26sd-bus: remove unused call bus_kernel_create_monitor()Lennart Poettering
Noticed by Djalal Harouni
2014-08-26sd-event: sd_event_prepare - stay in PREPARED if sd_event_wait() indicates ↵Tom Gundersen
that no sources are pending
2014-08-25sd-event: split run into prepare/wait/dispatchTom Gundersen
This will allow sd-event to be integrated into an external event loop, which in turn will allow (say) glib-based applications to use our various libraries, without manually integrating each of them (bus, rtnl, dhcp, ...). The external event-loop should integrate sd-event int he following way: Every iteration must start with a call to sd_event_prepare(), which will return 0 if no event sources are ready to be processed, a positive value if they are and a negative value on error. sd_event_prepare() may only be called following sd_event_dispatch(); a call to sd_event_wait() indicating that no sources are ready to be dispatched; or a failed call to sd_event_dispatch() or sd_event_wait(). A successful call to sd_event_prepare() indicating that no event sources are ready to be dispatched must be followed by a call to sd_event_wait(), which will return 0 if it timed out without event sources being ready to be processed, a negative value on error and a positive value otherwise. sd_event_wait() may only be called following a successful call to sd_event_prepare() indicating that no event sources are ready to be dispatched. If sd_event_wait() indicates that some events sources are ready to be dispatched, it must be followed by a call to sd_event_dispatch(). This is the only time sd_event_dispatch() may be called.