summaryrefslogtreecommitdiff
path: root/src/shared/strv.c
Commit message (Collapse)AuthorAge
* resolve: fix NULL deref on strv comparisonDavid Herrmann2014-11-27
| | | | | | | | 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!
* strv: rework strv_split_quoted() to use unquote_first_word()Lennart Poettering2014-11-10
| | | | This should make the unquoting scheme a bit less naive.
* strv: use realloc_multiply() to check for multiplication overflowMichal Schmidt2014-10-21
| | | | This could overflow on 32bit, where size_t is the same as unsigned.
* strv: add an additional overflow check when enlarging strv()sLennart Poettering2014-10-21
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=76745
* service,strv: introduce strv_find_startswith() and make use of itLennart Poettering2014-08-21
| | | | | | | Unlike strv_find_prefix() the new call will return a pointer to the suffix of the item we found, instead of the whole item. This is more closer inline with what startswith() does, and allows us to simplify a couple of invocations.
* Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | $ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* path: add new "systemd-path" utility for querying paths described in ↵Lennart Poettering2014-07-02
| | | | | | | | file-hierarchy(7) This new tool is based on "sd-path", a new (so far unexported) API for libsystemd, that can hopefully grow into a workable API covering /opt and more one day.
* systemd-run: make sure --nice=, --uid=, --gid=, --setenv= also work in ↵Lennart Poettering2014-03-05
| | | | --scope mode
* Introduce strv_consume which takes ownershipZbigniew Jędrzejewski-Szmek2014-03-04
| | | | This mirrors set_consume and makes the common use a bit nicer.
* strv: multiple cleanupsSimon Peeters2014-01-05
| | | | | | | | | | - turn strv_merge into strv_extend_strv. appending strv b to the end of strv a instead of creating a new strv - strv_append: remove in favor of strv_extend and strv_push. - strv_remove: write slightly more elegant - strv_remove_prefix: remove unused function - strv_overlap: use strv_contains - strv_printf: STRV_FOREACH handles NULL correctly
* bus: include unique and well known names in credentials objectLennart Poettering2013-11-30
|
* local: fix memory leak when putting together locale settingsLennart Poettering2013-10-01
| | | | | | | | | Also, we need to use proper strv_env_xyz() calls when putting together the environment array, since otherwise settings won't be properly overriden. And let's get rid of strv_appendf(), is overkill and there was only one user.
* systemd-run: properly escape argumentsZbigniew Jędrzejewski-Szmek2013-09-09
| | | | | | | Spaces, quotes, and such, were not properly escaped. We should write them like we read them. https://bugs.freedesktop.org/show_bug.cgi?id=67971
* rework systemd's own process environment handling/passingKay Sievers2013-07-26
| | | | | | | | | | | | | Stop importing non-sensical kernel-exported variables. All parameters in the kernel command line are exported to the initial environment of PID1, but suppressed if they are recognized by kernel built-in code. The EFI booted kernel will add further kernel-internal things which do not belong into userspace. The passed original environ data of the process is not touched and preserved across re-execution, to allow external reading of /proc/self/environ for process properties like container*=.
* bus: implement 'unixexec:' protocolLennart Poettering2013-03-25
|
* journalctl: give a nice hint about group membership based on ACLs of ↵Lennart Poettering2013-03-22
| | | | | | | | | | | | /var/log/journal If we notice that we unprivileged and not in any of the groups which have access to /var/log/journal, print a nice message about which groups do. This checks and prints all groups that are in the default ACL for /var/log/journal, which is not necessarily correct for all journal files, but pretty close.
* shared: inline trivial auto-cleanup functionsMichal Schmidt2013-03-08
|
* shared: remove pointless checks in auto-cleanup functionsMichal Schmidt2013-03-08
| | | | | | | | | | | | | | | The argument given to the __attribute__((cleanup)) functions is the address of the variable that's going out of scope. It cannot be NULL. The "if (!s)" check in set_freep() is pointless. Perhaps "if (!*s)" was intented. But that's pointless too, because set_free()/set_free_free() are OK to call with a NULL argument (just like free()). Setting "*s = NULL" is pointless, because the variable that s points to is about to go out of scope. The same holds for strv_freep().
* unit: rework resource management APILennart Poettering2013-02-27
| | | | | | | | | This introduces a new static list of known attributes and their special semantics. This means that cgroup attribute values can now be automatically translated from user to kernel notation for command line set settings, too. This also adds proper support for multi-line attributes.
* binfmt,tmpfiles,modules-load,sysctl: rework the various early-boot services ↵Lennart Poettering2013-02-11
| | | | | | | | | | | | | | | | | | | that work on .d/ directories This unifies much of the logic behind them: - All four will now ofllow the rule that the earlier file and earlier assignment in the .d/ directories wins. Before, sysctl was the only outlier, where the later setting always won. - All four now support getopt() and --help on the command line. - All four can now handle specification of configuration file names on the command line to apply. The tools will automatically find them, and apply them. Previously only tmpfiles could do that. This is useful for %post scripts in RPMs and suchlike. - This fixes various error path issues in conf_files_list()
* env: considerably beef up environment cleaning logicLennart Poettering2013-02-11
| | | | | | | | | | | | | Now, actually check if the environment variable names and values used are valid, before accepting them. With this in place are at some places more rigid than POSIX, and less rigid at others. For example, this code allows lower-case environment variables (which POSIX suggests not to use), but it will not allow non-UTF8 variable values. All in all this should be a good middle ground of what to allow and what not to allow as environment variables. (This also splits out all environment related calls into env-util.[ch])
* strv: add strv_printThomas Hindoe Paaboel Andersen2013-02-07
| | | | Clearer, and spares the temp variable.
* strv: make strv_extend() smarterLennart Poettering2013-01-18
|
* unit: instead of directly loading drop-in configuration snippets use ↵Lennart Poettering2013-01-11
| | | | | | | conf_files_list_strv() This has the benefit of allowing the usual overriding/masking knowledge everybody loves so much.
* strv: cleanup error path loopsLennart Poettering2012-10-30
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=858799
* set: introduce strv_sort()Lennart Poettering2012-10-19
|
* timedatectl: introduce new command line client for timedatedLennart Poettering2012-10-17
| | | | | | Much like logind has a client in loginctl, and journald in journalctl introduce timedatectl, to change the system time (incl. RTC), timezones and related settings.
* manager: rework generator logicLennart Poettering2012-05-23
| | | | | | | | | | | | | | | | | | | | Previously generated units were always placed at the end of the search path. With this change there will be three unit dirs instead of one, to place generated entries at the beginning, in the middle and at the end of the search path: beginning: for units that need to override all configuration, regardless of user or vendor. Example use: system-update-generator uses this to temporarily redirect default.target. middle: for units that need to override vendor configuration, but not vendor configuration. Example use: /etc/fstab should override vendor supplied configuration (think /tmp), but should not override native user configuration. end: does not override anything but is available as well. Possible usage might be to convert D-Bus bus service files to native units but allowing vendor supplied native units to win.
* relicense to LGPLv2.1 (with exceptions)Lennart Poettering2012-04-12
| | | | | | | | | | | | | | We finally got the OK from all contributors with non-trivial commits to relicense systemd from GPL2+ to LGPL2.1+. Some udev bits continue to be GPL2+ for now, but we are looking into relicensing them too, to allow free copy/paste of all code within systemd. The bits that used to be MIT continue to be MIT. The big benefit of the relicensing is that closed source code may now link against libsystemd-login.so and friends.
* main: drop container/initrd env vars from inherited setLennart Poettering2012-04-11
| | | | | Leave the env vars used in the container/initrd logic set for PID1, but don't inherit them to any children.
* util: move all to shared/ and split external dependencies in separate ↵Kay Sievers2012-04-10
internal libraries Before: $ ldd /lib/systemd/systemd-timestamp linux-vdso.so.1 => (0x00007fffb05ff000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f90aac57000) libcap.so.2 => /lib64/libcap.so.2 (0x00007f90aaa53000) librt.so.1 => /lib64/librt.so.1 (0x00007f90aa84a000) libc.so.6 => /lib64/libc.so.6 (0x00007f90aa494000) /lib64/ld-linux-x86-64.so.2 (0x00007f90aae90000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f90aa290000) libattr.so.1 => /lib64/libattr.so.1 (0x00007f90aa08a000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f90a9e6e000) After: $ ldd systemd-timestamp linux-vdso.so.1 => (0x00007fff3cbff000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5eaa1c3000) librt.so.1 => /lib64/librt.so.1 (0x00007f5ea9fbb000) libc.so.6 => /lib64/libc.so.6 (0x00007f5ea9c04000) /lib64/ld-linux-x86-64.so.2 (0x00007f5eaa3fc000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f5ea9a00000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5ea97e4000)