summaryrefslogtreecommitdiffstats
path: root/coccinelle/errno-check.cocci (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-05-28path-util: introduce path_is_safe()Yu Watanabe3-22/+40
The function is similar to path_is_valid(), but it refuses paths which contain ".." component.
2021-05-28path-util: use path_find_first_component() in path_is_valid()Yu Watanabe1-12/+5
2021-05-28path-util: introduce path_find_first_component()Yu Watanabe3-0/+170
The function may be useful to iterate on each path component.
2021-05-28path-util: fix off by one issue to detect slash at the end in path_extend()Yu Watanabe2-3/+9
2021-05-28test/networkd-test: in bridge test, wait for online after restart ↵Dan Streetman1-0/+9
systemd-networkd without waiting for online, there is a race condition between systemd-networkd actually setting the new values and the test checking those values This also sets the link down before restarting systemd-networkd, to avoid the wait for online being a no-op
2021-05-27meson: Correctly validate that prefix is a child of rootprefixPeter Kjellerstedt1-1/+1
In commit d895e10a a test was introduced to validate that prefix is a child of rootprefix. However, it only works when rootprefix is "/". Since the test is ignored when rootprefix is equal to prefix, this is only noticed if specifying both -Drootprefix= and -Dprefix=, e.g.: $ meson foo -Drootprefix=/foo -Dprefix=/foo/bar meson.build:111:8: ERROR: Problem encountered: Prefix is not below root prefix (now rootprefix=/foo prefix=/foo/bar)
2021-05-27tree-wide: make use of path_extend() at many placesLennart Poettering6-65/+44
This is not a comprehensive port, but mostly some low-hanging fruit.
2021-05-27path-util: add path_extend(), inspired by strextend(), but using path_join()Lennart Poettering3-21/+60
2021-05-27network: ndisc: update log messageYu Watanabe1-2/+2
2021-05-27network: ndisc: always honor valid timeYu Watanabe1-20/+18
See draft-ietf-6man-slaac-renum-02, section 4.2. https://datatracker.ietf.org/doc/html/draft-ietf-6man-slaac-renum#section-4.2 Replaces #15260.
2021-05-27test-network: add a testcase for DHCP static leaseborna-blazevic3-0/+37
2021-05-27network: dhcp-server: introduce [DHCPServerStaticLease] sectionborna-blazevic10-1/+312
2021-05-27sd-dhcp-server: support static address to DHCPv4 offerborna-blazevic3-53/+184
2021-05-27man: fix tag typeChristian Hesse1-1/+1
This is an option, not a command.
2021-05-26hash-func: change value type of string_hash_ops_free_free to void*Lennart Poettering1-1/+1
The generic string_hash_ops_free_free hash operations vtable currently assumes the data pointer is of type char*. There's really no reason to assume that though, we regularly store non-string data as value in a hashmap. Hence, to accomodate for that, use void* as pointer for the value (and keep char* for the key, as that's what string_hash_ops_free_free is for, after all).
2021-05-26udevadm: make use of the new uuid-enabled triggering for "udevadm trigger"Lennart Poettering4-23/+108
This adds two things: - A new switch --uuid is added to "udevadm trigger". If specified a random UUID is associated with the synthettic uevent and it is printed to stdout. It may then be used manually to match up uevents as they propagate through the system. - The UUID logic is now implicitly enabled if "udevadm trigger --settle" is used, in order to wait for precisely the uevents we actually trigger. Fallback support is kept for pre-4.13 kernels (where the requests for trigger uevents with uuids results in EINVAL).
2021-05-26sd-device: add API for triggering synthetic uevents with UUIDLennart Poettering3-0/+70
Since kernel 4.13 the kerne allows passing a UUID to generated uevents. Optionally do so via a new sd_device_trigger_with_uuid() call, and add sd_device_get_trigger_uuid() as helper to retrieve the UUID from a uevent we receive. This is useful for tracking uevents through the udev system, and waiting for specific triggers. (Note that the 4.13 patch allows passing arbitrary meta-info into the uevent as well. This does not add an API for that, because I am not convinced it makes sense — as it conflicts with our general rule that events are "stateless" if you so will — and it complicates the interface quite a bit). This replaces #13881 in a way, which added a similar infra, but which stalled, and whose synchronous settling APIs are somewhat problematic and probably not material to merge.
2021-05-26man: document that it is guaranteed that generated ID128 are never all-zero ↵Lennart Poettering2-8/+13
or all-one This is the case because the ID128 we generate are all marked as v4 UUID which requires that some bits are zero and others are one. Let's document this so that people can rely on SD_ID128_NULL being a special value for "uninitialized" that is always distinguishable from generated UUIDs.
2021-05-26update TODOLennart Poettering1-2/+0
2021-05-26Mount all fs nosuid when NoNewPrivileges=yesTopi Miettinen4-3/+39
When `NoNewPrivileges=yes`, the service shouldn't have a need for any setuid/setgid programs, so in case there will be a new mount namespace anyway, mount the file systems with MS_NOSUID.
2021-05-26man: fix list of escaped characters in unit namesLennart Poettering1-4/+5
The code works differently than the docs, and the code is right here. Fix the doc hence. See VALID_CHARS in unit-name.c for details about allowed chars in unit names, but keep in mind that "-" and "\" are special, since generated by the escaping logic: they are OK to show up in unit names, but need to be escaped when converting foreign strings to unit names to make sure things remain reversible. Fixes: #19623
2021-05-26core: support specifier expansion in DefaultEnvironment= and ManagerEnvironment=Lennart Poettering2-9/+56
Strictly speaking adding this is a compatibility break, given that previously % weren't special. But I'd argue that was simply a bug, as for the much more prominent Environment= service setting we always resolved specifiers, and DEfaultEnvironment= is explicitly listed as being the default for that. Hence, let's fix that. Replaces: #16787
2021-05-26repart: resolve $TMP specifiers tooLennart Poettering2-11/+10
This might be useful for CopyFiles=, to reference some subdir of $TMP in a generic way. This allows us to use the new common system_and_tmp_specifier_table[].
2021-05-26sysusers: add a generic specifier table for common casesLennart Poettering3-12/+14
This moves the definition of the specifier table consisting only of system and /tmp specifiers into generic code so that we can share it. This patch only adds one user of it for now. Follow-up patches will add more.
2021-05-26hexdecoct: make return parameters of unbase64mem() and unhexmem() optionalLennart Poettering1-8/+8
Inspired by: #19059
2021-05-26test-network: refuse RA if not necessaryYu Watanabe8-0/+13
2021-05-26test-network: wait for that the link is in configuring state at the beginningYu Watanabe1-1/+1
2021-05-26man: document udevadm info output prefixesLennart Poettering1-0/+39
Fixes: #19663
2021-05-26man: try to clarify that nss-mymachines does not provide name resolution ↵Lennart Poettering1-0/+9
outside its own scope Fixes: #18229
2021-05-26man: explicit say for priority/weight values whether more is more or lessLennart Poettering2-26/+34
Fixes: #17523
2021-05-26networkctl: politely refuse being called from a different netns than the ↵Lennart Poettering1-0/+43
networkd instance we talk to Otherwise things get very confusing since we mix up netens data from our client side and from the data we retrieve from networkd. In the long run we should teach networkctl some switch to operate safely on other netns, and in that case also determine the right networkd instance for that namespace. Fixes: #19236
2021-05-26networkd: add bus property exposing network namepace ID we run inLennart Poettering1-0/+29
This is useful for clients to determine whether they are running in the same network namespace as networkd. Note that access to /proc/$PID/ns/ is restricted and only permitted to equally privileged programs. This new bus property is primarily a way to work around this, so that unprivileged clients can determine the networkd netns, too.
2021-05-26README: drop reference to KinvolkLennart Poettering1-5/+0
Kinvolk got bought by Microsoft recently, I doubt they'd even be open for engineering services like this, hence let's drop the free advertisement.
2021-05-26core/service: do not set zero error to log_unit_debug_errno()Yu Watanabe1-1/+1
Fixes #19725.
2021-05-26dns-domain: fix build failure with libidnYu Watanabe1-3/+3
Follow-up for 319a4f4bc46b230fc660321e99aaac1bc449deea. Fixes #19723.
2021-05-26load-fragment: validate paths properlyLennart Poettering1-1/+1
The comment suggests we validate paths here, but we actually didn't, we only validated filenames. Let' fix that. (Note this still lets any kind of paths through, including those with ".." and stuff, this is not a normalization check after all)
2021-05-25test: add simple test for PCR list parsingLennart Poettering2-0/+36
2021-05-25tpm2-util: accept empty string for empty PCR listLennart Poettering1-0/+7
2021-05-25tpm2: support "+" as separator for TPM PCR listsLennart Poettering5-12/+15
Previously, we supported only "," as separator. This adds support for "+" and makes it the documented choice. This is to make specifying PCRs in crypttab easier, since commas are already used there for separating volume options, and needless escaping sucks. "," continues to be supported, but in order to keep things minimal not documented. Fixe: #19205
2021-05-25core: watch paths with symlinks in .path unitsLennart Poettering1-20/+42
When watching paths that contain symlinks in some element we so far always only watched the inode they are pointing to, not the symlink inode itself. Let's fix that and always watch both. We do this by simply installing the inotify watch once with and once without IN_DONT_FOLLOW. For non-symlink inodes this just overrides the same watch twice (where the second one replaces the first), which is has no effect effectively. For symlinks it means we'll watch both source and destination. Fixes: #17727
2021-05-25core: optimize loop in path_spec_fd_event()Lennart Poettering1-7/+7
Let's avoid the whole loop if it can never match
2021-05-25core: log about all errors in path_spec_watch()Lennart Poettering1-2/+4
So far we logged about most, but not all errors. Adding log to all errors.
2021-05-25core: align path inotify mask table a bitLennart Poettering1-4/+4
2021-05-25man: documet that loginctl {terminate|kill}-{session|user} take the empty ↵Lennart Poettering1-13/+13
string, optionally Fixes: #19711
2021-05-25loginctl: kill calling user when invoked with empty stringLennart Poettering1-6/+18
A suggested by: #19711
2021-05-25test: add test for OnSuccess= + Uphold= + PropagatesStopTo= + BindsTo=Lennart Poettering13-0/+156
2021-05-25test-engine: ensure atom bits are properly packedLennart Poettering1-0/+17
Let's make sure all atoms are actually used, and no holes are left.
2021-05-25core: reorder where we add units to queues in unit_notify()Lennart Poettering1-22/+30
This moves all calls that shall do deferred work on detecting whether to start/stop the unit or dependent units after a unit state change to the end of the function, to make things easier to read. So far, these calls were spread all over the function, and conditionalized needlessly on MANAGER_RELOADING(). This is unnecessary, since the queues are not dispatched while reloading anyway, and immediately before acting on a queued unit we'll check if the suggested operation really makes sense. The only conditionalizaiton we leave in is on checking the new unit state itself, since we have that in a local variable anyway.
2021-05-25core: change BoundBy= dependency handling to be processed by a deferred work ↵Lennart Poettering6-46/+116
queue So far StopWhenUnneeded= handling and UpheldBy= handling was already processed by a queue that is dispatched in a deferred mode of operation instead of instantly. This changes BoundBy= handling to be processed the same way. This should ensure that all *event*-to-job propagation is done directly from unit_notify(), while all *state*-to-job propagation is done from a deferred work queue, quite systematically. The work queue is submitted to by unit_notify() too. Key really is the difference between event and state: some jobs shall be queued one-time on events (think: OnFailure= + OnSuccess= and similar), others shall be queued continuously when a specific state is in effect (think: UpheldBy=). The latter cases are usually effect of the combination of states of a few units (e.g. StopWhenUnneeded= checks wether any of the Wants=/Requires=/… deps are still up before acting), and hence it makes sense to trigger them to be run after an individual unit's state changed, but process them on a queue that runs whenever there's nothing else to do that ensures the decision on them is only taken after all jobs/queued IO events are dispatched, and things settled, so that it makes sense to come to a combined conclusion. If we'd dispatch this work immediately inside of unit_notify() we'd always act instantly, even though another event from another unit that is already queued might make the work unnecessary or invalid. This is mostly a commit to make things philosophically clean. It does not add features, but it should make corner cases more robust.
2021-05-25core: make unneeded check a bit tighterLennart Poettering1-1/+1
Let's not consider a unit unneeded while it is reloading. Uneeded should be a pretty weak concept: if there's any doubt that something bit be needed, then assume it is.