summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAge
* machine: validate machine names using machine_name_is_valid() instead of ↵Lennart Poettering2014-10-22
| | | | | | | string_is_safe() After all, we know have this as generic validator, so let's be correct and use it wherver applicable.
* resolved: simplify detection of packets from the loopback deviceLennart Poettering2014-10-22
| | | | | | | We can simplify our code quite a bit if we explicitly check for the ifindex being 1 on Linux as a loopback check. Apparently, this is hardcoded on Linux on the kernel, and effectively exported to userspace via rtnl and such, hence we should be able to rely on it.
* 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
* shared: remove unused functionsRonny Chevalier2014-10-21
| | | | | - mkdir_p_prefix: It has never been used - mkdir_parents_prefix_label: Unused since 1434ae6fd49f8377b0ddbd4c675736e0d3226ea6
* util: avoid duplication of TIME_T_MAXRonny Chevalier2014-10-21
|
* systemd: continue switch-root even if umount failsZbigniew Jędrzejewski-Szmek2014-10-17
| | | | | Leaving the old root around seems better than aborting the switch.
* environment: append unit_id to error messages regarding EnvironmentFileLukas Nykryn2014-10-17
|
* missing: remove fanotifyZbigniew Jędrzejewski-Szmek2014-10-17
| | | | It was only used in readahead.
* selinux: fix potential double free crash in child processMichal Sekletar2014-10-15
| | | | | | | | Before returning from function we should reset ret to NULL, thus cleanup function is nop. Also context_str() returns pointer to a string containing context but not a copy, hence we must make copy it explicitly.
* util: avoid double close of fdThomas Hindoe Paaboel Andersen2014-10-09
| | | | | | | | | | We could end with a double close if we close the fd loop and flush_fd fails. That would make us goto fail and there we close the fd once again. This patch sets the fd to the return value for safe_close: -1 A fd with negative value will be ignored by the next call to safe_close. CID#996223
* time: functions named "internal" really shouldn't be exportedLennart Poettering2014-10-08
| | | | | Also, let's try to make function names descriptive, instead of using bools for flags.
* systemctl: add add-wants and add-requires verbsLukas Nykryn2014-10-08
|
* unit: move UnitDependency to unit-nameLukas Nykryn2014-10-08
|
* core: don't allow enabling if unit is maskedJan Synacek2014-10-07
|
* build-sys: use linux/memfd.h if availableZbigniew Jędrzejewski-Szmek2014-10-05
| | | | | | | | | | | linux/memfd.h was added linux 3.17, so it might not be widely available for a while. Also, check if memfd_create is defined, for the HAVE_LINUX_MEMFD_H check to have a chance of succeeding. Also, collapse all ifdefs for memfd-related stuff, because they were all added together so there's no need to check separately.
* ask-password: Add --echo to enable echoing the user inputDavid Sommerseth2014-10-05
| | | | | | | | | | | | | | | | Programs such as OpenVPN may use ask-password for not only retrieving passwords, but also usernames. Masking usernames with * seems just silly. v2 - Don't mess with termios flags, instead print the input instead of an asterix. Resolves issues with backspace and TAB input. v3 - Renamed 'do_echo' variables and argument to 'echo'. Also modified the ask_password_{tty,agent,auto} API instead of additional wrapper functions. [zj: undo changes to ask_password_auto, since no callers were using the new argument.]
* pty: optimize read loopDavid Herrmann2014-10-03
| | | | | | | | | As it turns out, I can actually send data to the pty faster than the terminal can read. Therefore, make sure we read as much data as possible but bail out early enough to not cause starvation. Kernel TTY buffers are 4k, so reduce the overall buffer size, but read more than once if possible (up to 8 times sounds reasonable).
* fileio-label: return error when writing failsZbigniew Jędrzejewski-Szmek2014-10-03
| | | | The status of actually writing the file was totally ignored.
* journalctl: make --utc work everywhereJan Synacek2014-10-03
| | | | | | The --utc option was introduced by commit 9fd290443f5f99fca0dcd4216b1de70f7d3b8db1. Howerver, the implementation was incomplete.
* virt: detect that we are running inside the docker containerMichal Sekletar2014-10-02
|
* Fix order and document user unit dirsZbigniew Jędrzejewski-Szmek2014-10-02
| | | | Fixup for 718880ba0d 'add a transient user unit directory'.
* Rename user_runtime to user_runtime_dirZbigniew Jędrzejewski-Szmek2014-10-02
| | | | | This makes this function name similar to user_config_home() and makes it match the name of the environment variable.
* add a transient user unit directorySteven Allen2014-10-02
| | | | | | | | | This patch adds a transient user unit directory under `$XDG_RUNTIME_DIR/systemd/user/` and stores transient user-instance units (such as those created by `systemd-run --user`) under there instead of putting them in $XDG_CONFIG_HOME/systemd/user/. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=67331
* journalctl: add --utc optionJan Synacek2014-10-02
| | | | Introduce option to display time in UTC.
* barrier: fix up constructor error handlingDavid Herrmann2014-10-02
| | | | | | | | | We cannot rely on "errno" to be non-zero on failure, if we perform multiple glibc calls. That is, if the first eventfd() call fails, but the second succeeds, we cleanup the barrier but return 0. Fix this by always testing the return value immediately. This should also fix all the coverity warnings.
* Remove repeated includesThomas Hindoe Paaboel Andersen2014-10-01
| | | | | | In pty.c there was both an include of our pty.h and the system installed pty.h. The latter contains only two functions openpty and forkpty. We use neither so I assume it was a typo and removed it. We still compile and pass all tests.
* shared: util - use nicer idiom to silence CoverityZbigniew Jędrzejewski-Szmek2014-10-01
| | | | Change the other spot too.
* shared: util - use nicer idiom to silence CoverityTom Gundersen2014-09-30
| | | | Suggested by Zbigniew.
* util: silence coverityTom Gundersen2014-09-29
| | | | Make it clear in the code that ignoring a failed safe_ato?() is intentional.
* Do not format USEC_INFINITY as NULLZbigniew Jędrzejewski-Szmek2014-09-29
| | | | | | | | | | | systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This does not look right. Since USEC_INFINITY is one of the valid values, format_timespan() could return NULL, and we should wrap every use of it in strna() or similar. But most callers didn't do that, and it seems more robust to return a string ("infinity") that makes sense most of the time, even if in some places the result will not be grammatically correct.
* make utmp/wtmp support configurableEmil Renner Berthing2014-09-26
| | | | | | This adds --disable-utmp option to configure. If it is used, all utmp-related functionality, including querying runlevel support, is removed.
* shared: path-util - try to make PATH_FORECH_PREFIX look less wrongTom Gundersen2014-09-25
| | | | | | | | | | We replace the idiom "X && !(*foo = 0)" with "X && ((*foo = 0), true)". This is not a functional change, but should hopefully make it less likely that people and static analyzers believe there is a typo here (i.e., to make it clear that the intention was not "X && *foo != 0"). Thanks to David Herrmann for the suggestion.
* localectl: print warning when there are options given on kernel cmdlineMichal Sekletar2014-09-25
|
* fileio: make parse_env_file() return number of parsed itemsMichal Sekletar2014-09-25
| | | | | | | | | | This commit introduces possibility to call parse_env_file_internal() and hand over extra argument where we will accumulate how many items were successfully parsed and pushed by callback. We make use of this in parse_env_file() and return number of parsed items on success instead of always returning zero. As a side-effect this commit should fix bug that locale settings in /etc/locale.conf are not overriden by options passed via kernel command line.
* Fix warning about unused variable with !SELINUXZbigniew Jędrzejewski-Szmek2014-09-23
| | | | | | src/shared/label.c:255:15: warning: unused variable 'l' [-Wunused-variable] char *l = NULL; ^
* util: avoid non-portable __WORDSIZEEmil Renner Berthing2014-09-22
| | | | | | | | Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified by any spec. Use explicit size comparisons if we're not interested in the WORDSIZE, anyway. (David: adjust commit message to explain why we do this)
* exit-status.c: bring EXIT_BUS_ENDPOINT label in line with othersZbigniew Jędrzejewski-Szmek2014-09-22
|
* util: add alloca_align()David Herrmann2014-09-22
| | | | | | | | | | The alloca_align() helper is the alloca() equivalent of posix_memalign(). As there is no such function provided by glibc, we simply account for additional memory and return a pointer offset into the allocated memory to grant the alignment. Furthermore, alloca0_align() is added, which simply clears the allocated memory.
* socket: introduce SELinuxContextFromNet optionMichal Sekletar2014-09-19
| | | | | | | | | | This makes possible to spawn service instances triggered by socket with MLS/MCS SELinux labels which are created based on information provided by connected peer. Implementation of label_get_child_mls_label derived from xinetd. Reviewed-by: Paul Moore <pmoore@redhat.com>
* shared: wtmp-utmp - don't clear store_wtmp in utmp_put_dead_process()Tom Gundersen2014-09-19
| | | | | Also modernize a few other things and add comments to explain CID #1237503 and CID #1237504.
* shared/sparse-endian.h: add missing byteswap.h includeEmil Renner Berthing2014-09-19
|
* shared/label.h: add missing stdio.h includeEmil Renner Berthing2014-09-19
|
* pty: include linux/ioctl.h for TIOCSIGDavid Herrmann2014-09-19
| | | | | | TIOCSIG is linux specific, so include the linux ioctl header to make sure it's defined. We currently rely on some rather non-obvious recursive includes. Make sure its always defined regardless of the system headers.
* shared: conf-parser - don't leak memory on error in DEFINE_CONFIG_PARSE_ENUMVTom Gundersen2014-09-18
| | | | Found by Coverity. Fixes CID #1237746.
* shared: conf-parserTom Gundersen2014-09-17
| | | | | | Check memory allocation. Found by Coverity. Fixes CID #1237644.
* util: remove a unnecessary checkThomas Hindoe Paaboel Andersen2014-09-16
| | | | | | | 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
* shared: fix resource leak in config_parse_default_instanceAndreas Henriksson2014-09-16
| | | | | | The recently allocated "printed" is not freed on error path. Found by coverity. Fixes: CID#1237745
* missing: memfd_create takes unsigned int flags in final versionCristian Rodríguez2014-09-16
|
* hashmap: minor hashmap_replace optimizationMichal Schmidt2014-09-15
| | | | | | 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.