summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-09-17nss-resolve: remove dead codeThomas Hindoe Paaboel Andersen
ifindex < 0 was already checked before entering the loop Found by coverity. Fixes: CID#1237609
2014-09-17udev: rules - close empty fileTom Gundersen
If the file is found to be empty, we exit early without closing the file first. Found by coverity. Fixes CID #1237759.
2014-09-17libsystemd-network: dhcp-test - assert that malloc0 succeedsTom Gundersen
Otherwise we would get a nullptr dereference later on. Found by coverity. Fixes CID #1237655.
2014-09-17networkd: dhcp4 - fix unchecked return valueTom Gundersen
Found by coverity. CID #1237529 and #1237528.
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-17sysctl: make --prefix allow all kinds of sysctl pathsDavid Herrmann
Currently, we save arguments passed as --prefix directly and compare them later to absolute sysctl file-system paths. That is, you are required to specify arguments to --prefix with leading /proc/sys/. This is kinda uselesss. Furthermore, we replace dots by slashes in the name, which makes it impossible to match on specific sysfs paths that have dots in their name (like netdev names). The intention of this argument is clear, but it never worked as expected. This patch modifies --prefix to accept any kind of sysctl paths. It supports paths prefixed with /proc/sys for compatibility (but drops the erroneous dot->slash conversion), but instead applies normalize_sysctl() which turns any name or path into a proper path. It then appends /proc/sys/ so we can properly use it in matches. Thanks to Jan Synacek <jsynacek@redhat.com> for catching this!
2014-09-16util: remove a unnecessary checkThomas Hindoe Paaboel Andersen
We only break out of the previous loop if fd >= 0 so there is no use in checking it again. Found by coverity. Fixes: CID#1237577
2014-09-16terminal: remove dead code checking O_WRONLYDavid Herrmann
We only reject evdev FDs that are O_WRONLY as they're currently pretty useless. The following check for O_WRONLY is thus never excercised so drop it. Thanks to Thomas Andersen (via coverity)!
2014-09-16test: silence a coverity reportThomas Hindoe Paaboel Andersen
We check the actual contents of the file on the line after but we might as well also check the number of bytes read here. Found by coverity. Fixes: CID#1237521
2014-09-16shared: fix resource leak in config_parse_default_instanceAndreas Henriksson
The recently allocated "printed" is not freed on error path. Found by coverity. Fixes: CID#1237745
2014-09-16sysv-generator: fix resource leakAndreas Henriksson
The "unit" string allocation is not freed on either error or success path. Found by coverity. Fixes: CID#1237755
2014-09-16core: fix resource leak in manager_environment_addAndreas Henriksson
Second error path must free the (potentially) allocated memory in the first code chunk before returning. Found by coverity. Fixes: CID#1237750
2014-09-16missing: memfd_create takes unsigned int flags in final versionCristian Rodríguez
2014-09-16terminal: sd_bus_error_get_errno returns positive errnoThomas Hindoe Paaboel Andersen
The 3 calls to sd_bus_error_get_errno appear to expect a negative return value. This patch negates the returned value so it matches the other error cases in the 3 functions where sd_bus_error_get_errno is used.
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-16bootchart: oom-check correct variableAndreas Henriksson
Coverity warned that we have already dereferenced ps->sample before null-checking it. I suspect that's not really the issue and that the check is checking the wrong variable. Likely the oom-check should be on the just allocated ps->sample->next. Found by coverity. Fixes: CID#1237765
2014-09-16bootchart: use safe_atod() rather than strtod()Tom Gundersen
2014-09-16hostname: add missing EMITS_CHANGE annotationDavid Herrmann
We call into sd-bus to send PropertiesChanged notifications for "Hostname", but forgot to add the annotation to the bus-vtable. Fix that!
2014-09-16libsystemd-network: avoid double-free in error caseAndreas Henriksson
Don't manually free 'n' in error path as it's already tagged _cleanup_free_ and will be freed once it goes out of scope, leading to double-free in this case. Found with coverity. Fixes: CID#1237786
2014-09-16gpt-auto-generator: fix typoLukas Nykryn
2014-09-16udev: rules - add missing whitespace to log messageTom Gundersen
2014-09-16udevd: use safe_ato*() in place of strto*()Tom Gundersen
2014-09-16udev: util - use log_level_from_string()Tom Gundersen
2014-09-16libudev: util - drop util_delete_path()Tom Gundersen
Use rmdir_parents() from src/shared instead.
2014-09-16libudev: drop util_lookup_{user,group}Tom Gundersen
Use shared versions instead. Difference is with overwriting of repeated user/group name, and lack of logging.
2014-09-16udev: apply permissions to static nodes before signallying READYTom Gundersen
Processes expecting static nodes to have the right permissions may order themselves after systemd-udevd.service, make sure that actually guarantees what is expected.
2014-09-16udev: only print after final log level has been determinedTom Gundersen
This delays label_init(), and drops the (duplicate) printing of version information.
2014-09-16udevd: initialize epoll_event structs on allocationTom Gundersen
Also move the rest of event initialization next to the event loop (no functional change).
2014-09-16udev: don't close std{in,out,err}Tom Gundersen
Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted, use the correct log_*() function in the first place.
2014-09-16udev: drop duplicate loggingTom Gundersen
Once upon a time logging during early boot was unreliable, so extra logging messages were sent by udev to stderr. That is no longer a concern, so drop all fprintf() calls from udved.
2014-09-16udev: split out parse_argv()Tom Gundersen
Also rename some global variables to arg_* to make it clearer where they come from.
2014-09-16udev: split out help and modernise a bitTom Gundersen
2014-09-15man: sd_bus_error typo fixThomas Hindoe Paaboel Andersen
2014-09-15terminal: fix missing hashmap_new() conversionsDavid Herrmann
hashmap_new() now takes *_ops instead of individual functions. Fix up any missing invokations of it that haven't been converted already.
2014-09-15remove unneeded error.h includesEmil Renner Berthing
These are the only two places where this glibc-specific header is included. However none of the definitions in it seem to be used, so just remove the includes.
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: minor hashmap_replace optimizationMichal Schmidt
When hashmap_replace detects no such key exists yet, it calls hashmap_put that performs the same check again. Avoid that by splitting the core of hashmap_put into a separate function.
2014-09-15hashmap, set: remove unused functionsMichal Schmidt
The following hashmap_* and set_* functions/macros have never had any users in systemd's history: *_iterate_backwards *_iterate_skip *_last *_FOREACH_BACKWARDS Remove this dead code.
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-15build: colorize gcc only if on ttyMichal Schmidt
Rather than forcing gcc to always produce colorized error messages whether on tty or not, enable automatic colorization by ensuring GCC_COLORS is set to a non-empty string. Doing it this way removes the need for workarounds in ~/.emacs or ~/.vimrc for "M-x compile" or ":make", respectively, to work.
2014-09-14test: fix test of uid-rangeThomas Hindoe Paaboel Andersen
The number of uid's in the range should be tested instead of written directly. The test still passes with the fix checks. Found with Coverity. Fixes: CID#1237714 - 1237722
2014-09-14sd-dhcp: fix test of magic cookieThomas Hindoe Paaboel Andersen
The magic cookie is set in dhcp_message_init. Test the magic cookie value intead of writing the last 3/4 of it directly. Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735
2014-09-13resolved: fall back to hardcoded ifindex when checking if a link is the loopbackTom Gundersen
Reported by Philippe De Swert <philippedeswert@gmail.com>. Coverity CID#1237656
2014-09-13networkd: remove vestigial event sourcesDave Reisner
187fe1db took advantage of floating events, but didn't remove pointers it made superfluous.
2014-09-13core: use correct function to free CalendarSpecDave Reisner
2014-09-13core: fix a potential mem leakThomas Hindoe Paaboel Andersen
Found with Coverity. Fixes: CID#996438
2014-09-13analyze: fix mem leakThomas Hindoe Paaboel Andersen
Found with Coverity. Fixes: CID#1237756
2014-09-13core: smack-setup: Actually allow for succesfully loading CIPSO policyPhilippe De Swert
The line under the last switch statement *loaded_policy = true; would never be executed. As all switch cases return 0. Thus the policy would never be marked as loaded. Found with Coverity. Fixes: CID#1237785
2014-09-11analyze: avoid a null dereferenceThomas Hindoe Paaboel Andersen
If we have an error in the early sd_bus_* calls then unit_times will still be null. Found with coverity. Fixes: CID#996464