Compare commits
7 Commits
0306d1598d
...
4b6bc95c01
Author | SHA1 | Date |
---|---|---|
Zbigniew Jędrzejewski-Szmek | 4b6bc95c01 | |
Lennart Poettering | ae0b700a85 | |
Lennart Poettering | 35b4e3c1bc | |
Lennart Poettering | e742ec6abc | |
Lennart Poettering | 95f7ab2fe6 | |
Lennart Poettering | 6e65df89c3 | |
Lennart Poettering | b612c26ceb |
|
@ -38,6 +38,7 @@ BuildPackages=
|
|||
libcap-devel
|
||||
libcurl-devel
|
||||
libfdisk-devel
|
||||
libfido2-devel
|
||||
libgcrypt-devel
|
||||
libidn2-devel
|
||||
libmicrohttpd-devel
|
||||
|
|
|
@ -230,6 +230,7 @@ conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbin
|
|||
conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
|
||||
conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
|
||||
conf.set_quoted('ROOTPREFIX', rootprefixdir)
|
||||
conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
|
||||
conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
|
||||
conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
|
||||
conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include "strv.h"
|
||||
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
#include <pthread.h>
|
||||
#include "list.h"
|
||||
#endif
|
||||
|
||||
|
@ -189,7 +189,6 @@ assert_cc(DIRECT_BUCKETS(struct set_entry) < (1 << 3));
|
|||
* a handful of directly stored entries in a hashmap. When a hashmap
|
||||
* outgrows direct storage, it gets its own key for indirect storage. */
|
||||
static uint8_t shared_hash_key[HASH_KEY_SIZE];
|
||||
static bool shared_hash_key_initialized;
|
||||
|
||||
/* Fields that all hashmap/set types must have */
|
||||
struct HashmapBase {
|
||||
|
@ -764,6 +763,10 @@ static void reset_direct_storage(HashmapBase *h) {
|
|||
memset(p, DIB_RAW_INIT, sizeof(dib_raw_t) * hi->n_direct_buckets);
|
||||
}
|
||||
|
||||
static void shared_hash_key_initialize(void) {
|
||||
random_bytes(shared_hash_key, sizeof(shared_hash_key));
|
||||
}
|
||||
|
||||
static struct HashmapBase* hashmap_base_new(const struct hash_ops *hash_ops, enum HashmapType type HASHMAP_DEBUG_PARAMS) {
|
||||
HashmapBase *h;
|
||||
const struct hashmap_type_info *hi = &hashmap_type_info[type];
|
||||
|
@ -786,10 +789,8 @@ static struct HashmapBase* hashmap_base_new(const struct hash_ops *hash_ops, enu
|
|||
|
||||
reset_direct_storage(h);
|
||||
|
||||
if (!shared_hash_key_initialized) {
|
||||
random_bytes(shared_hash_key, sizeof(shared_hash_key));
|
||||
shared_hash_key_initialized= true;
|
||||
}
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
assert_se(pthread_once(&once, shared_hash_key_initialize) == 0);
|
||||
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
h->debug.func = func;
|
||||
|
|
|
@ -1061,13 +1061,15 @@ static void socket_apply_socket_options(Socket *s, SocketPort *p, int fd) {
|
|||
if (s->receive_buffer > 0) {
|
||||
r = fd_set_rcvbuf(fd, s->receive_buffer, false);
|
||||
if (r < 0)
|
||||
log_unit_warning_errno(UNIT(s), r, "SO_RCVBUF/SO_RCVBUFFORCE failed: %m");
|
||||
log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"SO_RCVBUF/SO_RCVBUFFORCE failed: %m");
|
||||
}
|
||||
|
||||
if (s->send_buffer > 0) {
|
||||
r = fd_set_sndbuf(fd, s->send_buffer, false);
|
||||
if (r < 0)
|
||||
log_unit_warning_errno(UNIT(s), r, "SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
|
||||
log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
|
||||
}
|
||||
|
||||
if (s->mark >= 0) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# considered deprecated (though there is no plan to remove them). New names
|
||||
# shall have underscores.
|
||||
|
||||
prefix=@prefix@
|
||||
prefix=/usr
|
||||
root_prefix=@rootprefix_noslash@
|
||||
rootprefix=${root_prefix}
|
||||
sysconf_dir=@sysconfdir@
|
||||
|
@ -26,10 +26,10 @@ systemdsystemunitdir=${systemd_system_unit_dir}
|
|||
systemd_system_preset_dir=${rootprefix}/lib/systemd/system-preset
|
||||
systemdsystempresetdir=${systemd_system_preset_dir}
|
||||
|
||||
systemd_user_unit_dir=${prefix}/lib/systemd/user
|
||||
systemd_user_unit_dir=/usr/lib/systemd/user
|
||||
systemduserunitdir=${systemd_user_unit_dir}
|
||||
|
||||
systemd_user_preset_dir=${prefix}/lib/systemd/user-preset
|
||||
systemd_user_preset_dir=/usr/lib/systemd/user-preset
|
||||
systemduserpresetdir=${systemd_user_preset_dir}
|
||||
|
||||
systemd_system_conf_dir=${sysconfdir}/systemd/system
|
||||
|
@ -47,7 +47,7 @@ systemduserunitpath=${systemd_user_unit_path}
|
|||
systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators
|
||||
systemdsystemgeneratordir=${systemd_system_generator_dir}
|
||||
|
||||
systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
|
||||
systemd_user_generator_dir=/usr/lib/systemd/user-generators
|
||||
systemdusergeneratordir=${systemd_user_generator_dir}
|
||||
|
||||
systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemd_system_generator_dir}
|
||||
|
@ -62,7 +62,7 @@ systemdsleepdir=${systemd_sleep_dir}
|
|||
systemd_shutdown_dir=${root_prefix}/lib/systemd/system-shutdown
|
||||
systemdshutdowndir=${systemd_shutdown_dir}
|
||||
|
||||
tmpfiles_dir=${prefix}/lib/tmpfiles.d
|
||||
tmpfiles_dir=/usr/lib/tmpfiles.d
|
||||
tmpfilesdir=${tmpfiles_dir}
|
||||
|
||||
sysusers_dir=${rootprefix}/lib/sysusers.d
|
||||
|
@ -77,7 +77,7 @@ binfmtdir=${binfmt_dir}
|
|||
modules_load_dir=${rootprefix}/lib/modules-load.d
|
||||
modulesloaddir=${modules_load_dir}
|
||||
|
||||
catalog_dir=${prefix}/lib/systemd/catalog
|
||||
catalog_dir=/usr/lib/systemd/catalog
|
||||
catalogdir=${catalog_dir}
|
||||
|
||||
system_uid_max=@systemuidmax@
|
||||
|
|
|
@ -321,7 +321,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
|
|||
return from_user_dir("XDG_DESKTOP_DIR", buffer, ret);
|
||||
|
||||
case SD_PATH_SYSTEMD_UTIL:
|
||||
*ret = ROOTPREFIX "/lib/systemd";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/systemd";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_UNIT:
|
||||
|
@ -329,7 +329,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
|
|||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_PRESET:
|
||||
*ret = ROOTPREFIX "/lib/systemd/system-preset";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-preset";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_USER_UNIT:
|
||||
|
@ -337,7 +337,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
|
|||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_USER_PRESET:
|
||||
*ret = ROOTPREFIX "/lib/systemd/user-preset";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/user-preset";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_CONF:
|
||||
|
@ -357,33 +357,31 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
|
|||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SLEEP:
|
||||
*ret = ROOTPREFIX "/lib/systemd/system-sleep";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-sleep";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SHUTDOWN:
|
||||
*ret = ROOTPREFIX "/lib/systemd/system-shutdown";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-shutdown";
|
||||
return 0;
|
||||
|
||||
/* FIXME: systemd.pc uses ${prefix}, but CONF_PATHS_NULSTR doesn't.
|
||||
* Should ${prefix} use in systemd.pc be removed? */
|
||||
case SD_PATH_TMPFILES:
|
||||
*ret = "/usr/lib/tmpfiles.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSUSERS:
|
||||
*ret = ROOTPREFIX "/lib/sysusers.d";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSCTL:
|
||||
*ret = ROOTPREFIX "/lib/sysctl.d";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_BINFMT:
|
||||
*ret = ROOTPREFIX "/lib/binfmt.d";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_MODULES_LOAD:
|
||||
*ret = ROOTPREFIX "/lib/modules-load.d";
|
||||
*ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_CATALOG:
|
||||
|
|
|
@ -6,13 +6,15 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "acl-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
|
||||
static void test_add_acls_for_user(void) {
|
||||
static int test_add_acls_for_user(void) {
|
||||
char fn[] = "/tmp/test-empty.XXXXXX";
|
||||
_cleanup_close_ int fd = -1;
|
||||
char *cmd;
|
||||
|
@ -42,6 +44,9 @@ static void test_add_acls_for_user(void) {
|
|||
uid = getuid();
|
||||
|
||||
r = fd_add_uid_acl_permission(fd, uid, ACL_READ);
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return log_tests_skipped("no ACL support on /tmp");
|
||||
|
||||
log_info_errno(r, "fd_add_uid_acl_permission(%i, "UID_FMT", ACL_READ): %m", fd, uid);
|
||||
assert_se(r >= 0);
|
||||
|
||||
|
@ -62,11 +67,10 @@ static void test_add_acls_for_user(void) {
|
|||
cmd = strjoina("getfacl -p ", fn);
|
||||
assert_se(system(cmd) == 0);
|
||||
|
||||
unlink(fn);
|
||||
(void) unlink(fn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
test_add_acls_for_user();
|
||||
|
||||
return 0;
|
||||
return test_add_acls_for_user();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue