Compare commits

..

No commits in common. "4b6bc95c013ce43a92209d46fe3b045ccba4a224" and "0306d1598d618c8418bb6b960a526cbdf3aede61" have entirely different histories.

7 changed files with 30 additions and 37 deletions

View File

@ -38,7 +38,6 @@ BuildPackages=
libcap-devel libcap-devel
libcurl-devel libcurl-devel
libfdisk-devel libfdisk-devel
libfido2-devel
libgcrypt-devel libgcrypt-devel
libidn2-devel libidn2-devel
libmicrohttpd-devel libmicrohttpd-devel

View File

@ -230,7 +230,6 @@ 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_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('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
conf.set_quoted('ROOTPREFIX', rootprefixdir) conf.set_quoted('ROOTPREFIX', rootprefixdir)
conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed')) conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup')) conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))

View File

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */ /* SPDX-License-Identifier: LGPL-2.1+ */
#include <errno.h> #include <errno.h>
#include <pthread.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -20,6 +19,7 @@
#include "strv.h" #include "strv.h"
#if ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
#include <pthread.h>
#include "list.h" #include "list.h"
#endif #endif
@ -189,6 +189,7 @@ assert_cc(DIRECT_BUCKETS(struct set_entry) < (1 << 3));
* a handful of directly stored entries in a hashmap. When a hashmap * a handful of directly stored entries in a hashmap. When a hashmap
* outgrows direct storage, it gets its own key for indirect storage. */ * outgrows direct storage, it gets its own key for indirect storage. */
static uint8_t shared_hash_key[HASH_KEY_SIZE]; static uint8_t shared_hash_key[HASH_KEY_SIZE];
static bool shared_hash_key_initialized;
/* Fields that all hashmap/set types must have */ /* Fields that all hashmap/set types must have */
struct HashmapBase { struct HashmapBase {
@ -763,10 +764,6 @@ static void reset_direct_storage(HashmapBase *h) {
memset(p, DIB_RAW_INIT, sizeof(dib_raw_t) * hi->n_direct_buckets); 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) { static struct HashmapBase* hashmap_base_new(const struct hash_ops *hash_ops, enum HashmapType type HASHMAP_DEBUG_PARAMS) {
HashmapBase *h; HashmapBase *h;
const struct hashmap_type_info *hi = &hashmap_type_info[type]; const struct hashmap_type_info *hi = &hashmap_type_info[type];
@ -789,8 +786,10 @@ static struct HashmapBase* hashmap_base_new(const struct hash_ops *hash_ops, enu
reset_direct_storage(h); reset_direct_storage(h);
static pthread_once_t once = PTHREAD_ONCE_INIT; if (!shared_hash_key_initialized) {
assert_se(pthread_once(&once, shared_hash_key_initialize) == 0); random_bytes(shared_hash_key, sizeof(shared_hash_key));
shared_hash_key_initialized= true;
}
#if ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
h->debug.func = func; h->debug.func = func;

View File

@ -1061,15 +1061,13 @@ static void socket_apply_socket_options(Socket *s, SocketPort *p, int fd) {
if (s->receive_buffer > 0) { if (s->receive_buffer > 0) {
r = fd_set_rcvbuf(fd, s->receive_buffer, false); r = fd_set_rcvbuf(fd, s->receive_buffer, false);
if (r < 0) if (r < 0)
log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r, log_unit_warning_errno(UNIT(s), r, "SO_RCVBUF/SO_RCVBUFFORCE failed: %m");
"SO_RCVBUF/SO_RCVBUFFORCE failed: %m");
} }
if (s->send_buffer > 0) { if (s->send_buffer > 0) {
r = fd_set_sndbuf(fd, s->send_buffer, false); r = fd_set_sndbuf(fd, s->send_buffer, false);
if (r < 0) if (r < 0)
log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r, log_unit_warning_errno(UNIT(s), r, "SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
"SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
} }
if (s->mark >= 0) { if (s->mark >= 0) {

View File

@ -11,7 +11,7 @@
# considered deprecated (though there is no plan to remove them). New names # considered deprecated (though there is no plan to remove them). New names
# shall have underscores. # shall have underscores.
prefix=/usr prefix=@prefix@
root_prefix=@rootprefix_noslash@ root_prefix=@rootprefix_noslash@
rootprefix=${root_prefix} rootprefix=${root_prefix}
sysconf_dir=@sysconfdir@ sysconf_dir=@sysconfdir@
@ -26,10 +26,10 @@ systemdsystemunitdir=${systemd_system_unit_dir}
systemd_system_preset_dir=${rootprefix}/lib/systemd/system-preset systemd_system_preset_dir=${rootprefix}/lib/systemd/system-preset
systemdsystempresetdir=${systemd_system_preset_dir} systemdsystempresetdir=${systemd_system_preset_dir}
systemd_user_unit_dir=/usr/lib/systemd/user systemd_user_unit_dir=${prefix}/lib/systemd/user
systemduserunitdir=${systemd_user_unit_dir} systemduserunitdir=${systemd_user_unit_dir}
systemd_user_preset_dir=/usr/lib/systemd/user-preset systemd_user_preset_dir=${prefix}/lib/systemd/user-preset
systemduserpresetdir=${systemd_user_preset_dir} systemduserpresetdir=${systemd_user_preset_dir}
systemd_system_conf_dir=${sysconfdir}/systemd/system 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 systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators
systemdsystemgeneratordir=${systemd_system_generator_dir} systemdsystemgeneratordir=${systemd_system_generator_dir}
systemd_user_generator_dir=/usr/lib/systemd/user-generators systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
systemdusergeneratordir=${systemd_user_generator_dir} 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} 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 systemd_shutdown_dir=${root_prefix}/lib/systemd/system-shutdown
systemdshutdowndir=${systemd_shutdown_dir} systemdshutdowndir=${systemd_shutdown_dir}
tmpfiles_dir=/usr/lib/tmpfiles.d tmpfiles_dir=${prefix}/lib/tmpfiles.d
tmpfilesdir=${tmpfiles_dir} tmpfilesdir=${tmpfiles_dir}
sysusers_dir=${rootprefix}/lib/sysusers.d sysusers_dir=${rootprefix}/lib/sysusers.d
@ -77,7 +77,7 @@ binfmtdir=${binfmt_dir}
modules_load_dir=${rootprefix}/lib/modules-load.d modules_load_dir=${rootprefix}/lib/modules-load.d
modulesloaddir=${modules_load_dir} modulesloaddir=${modules_load_dir}
catalog_dir=/usr/lib/systemd/catalog catalog_dir=${prefix}/lib/systemd/catalog
catalogdir=${catalog_dir} catalogdir=${catalog_dir}
system_uid_max=@systemuidmax@ system_uid_max=@systemuidmax@

View File

@ -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); return from_user_dir("XDG_DESKTOP_DIR", buffer, ret);
case SD_PATH_SYSTEMD_UTIL: case SD_PATH_SYSTEMD_UTIL:
*ret = ROOTPREFIX_NOSLASH "/lib/systemd"; *ret = ROOTPREFIX "/lib/systemd";
return 0; return 0;
case SD_PATH_SYSTEMD_SYSTEM_UNIT: case SD_PATH_SYSTEMD_SYSTEM_UNIT:
@ -329,7 +329,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
return 0; return 0;
case SD_PATH_SYSTEMD_SYSTEM_PRESET: case SD_PATH_SYSTEMD_SYSTEM_PRESET:
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-preset"; *ret = ROOTPREFIX "/lib/systemd/system-preset";
return 0; return 0;
case SD_PATH_SYSTEMD_USER_UNIT: case SD_PATH_SYSTEMD_USER_UNIT:
@ -337,7 +337,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
return 0; return 0;
case SD_PATH_SYSTEMD_USER_PRESET: case SD_PATH_SYSTEMD_USER_PRESET:
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/user-preset"; *ret = ROOTPREFIX "/lib/systemd/user-preset";
return 0; return 0;
case SD_PATH_SYSTEMD_SYSTEM_CONF: case SD_PATH_SYSTEMD_SYSTEM_CONF:
@ -357,31 +357,33 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
return 0; return 0;
case SD_PATH_SYSTEMD_SLEEP: case SD_PATH_SYSTEMD_SLEEP:
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-sleep"; *ret = ROOTPREFIX "/lib/systemd/system-sleep";
return 0; return 0;
case SD_PATH_SYSTEMD_SHUTDOWN: case SD_PATH_SYSTEMD_SHUTDOWN:
*ret = ROOTPREFIX_NOSLASH "/lib/systemd/system-shutdown"; *ret = ROOTPREFIX "/lib/systemd/system-shutdown";
return 0; 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: case SD_PATH_TMPFILES:
*ret = "/usr/lib/tmpfiles.d"; *ret = "/usr/lib/tmpfiles.d";
return 0; return 0;
case SD_PATH_SYSUSERS: case SD_PATH_SYSUSERS:
*ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d"; *ret = ROOTPREFIX "/lib/sysusers.d";
return 0; return 0;
case SD_PATH_SYSCTL: case SD_PATH_SYSCTL:
*ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d"; *ret = ROOTPREFIX "/lib/sysctl.d";
return 0; return 0;
case SD_PATH_BINFMT: case SD_PATH_BINFMT:
*ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d"; *ret = ROOTPREFIX "/lib/binfmt.d";
return 0; return 0;
case SD_PATH_MODULES_LOAD: case SD_PATH_MODULES_LOAD:
*ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d"; *ret = ROOTPREFIX "/lib/modules-load.d";
return 0; return 0;
case SD_PATH_CATALOG: case SD_PATH_CATALOG:

View File

@ -6,15 +6,13 @@
#include <unistd.h> #include <unistd.h>
#include "acl-util.h" #include "acl-util.h"
#include "errno-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "format-util.h" #include "format-util.h"
#include "string-util.h" #include "string-util.h"
#include "tests.h"
#include "tmpfile-util.h" #include "tmpfile-util.h"
#include "user-util.h" #include "user-util.h"
static int test_add_acls_for_user(void) { static void test_add_acls_for_user(void) {
char fn[] = "/tmp/test-empty.XXXXXX"; char fn[] = "/tmp/test-empty.XXXXXX";
_cleanup_close_ int fd = -1; _cleanup_close_ int fd = -1;
char *cmd; char *cmd;
@ -44,9 +42,6 @@ static int test_add_acls_for_user(void) {
uid = getuid(); uid = getuid();
r = fd_add_uid_acl_permission(fd, uid, ACL_READ); 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); log_info_errno(r, "fd_add_uid_acl_permission(%i, "UID_FMT", ACL_READ): %m", fd, uid);
assert_se(r >= 0); assert_se(r >= 0);
@ -67,10 +62,11 @@ static int test_add_acls_for_user(void) {
cmd = strjoina("getfacl -p ", fn); cmd = strjoina("getfacl -p ", fn);
assert_se(system(cmd) == 0); assert_se(system(cmd) == 0);
(void) unlink(fn); unlink(fn);
return 0;
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
return test_add_acls_for_user(); test_add_acls_for_user();
return 0;
} }