/systemd-251/src/test/ |
D | test-user-util.c | 14 static void test_uid_to_name_one(uid_t uid, const char *name) { in test_uid_to_name_one() argument 17 log_info("/* %s("UID_FMT", \"%s\") */", __func__, uid, name); in test_uid_to_name_one() 19 assert_se(t = uid_to_name(uid)); in test_uid_to_name_one() 57 uid_t uid; in TEST() local 59 r = parse_uid("0", &uid); in TEST() 61 assert_se(uid == 0); in TEST() 63 r = parse_uid("1", &uid); in TEST() 65 assert_se(uid == 1); in TEST() 67 r = parse_uid("01", &uid); in TEST() 69 assert_se(uid == 1); in TEST() [all …]
|
D | test-uid-alloc-range.c | 72 uid_t uid = 0; in TEST() local 73 log_info("uid_is_system("UID_FMT") = %s", uid, yes_no(uid_is_system(uid))); in TEST() 75 uid = 999; in TEST() 76 log_info("uid_is_system("UID_FMT") = %s", uid, yes_no(uid_is_system(uid))); in TEST() 78 uid = getuid(); in TEST() 79 log_info("uid_is_system("UID_FMT") = %s", uid, yes_no(uid_is_system(uid))); in TEST()
|
D | test-acl-util.c | 21 uid_t uid; in TEST_RET() local 38 r = get_user_creds(&nobody, &uid, NULL, NULL, NULL, 0); in TEST_RET() 40 uid = 0; in TEST_RET() 42 uid = getuid(); in TEST_RET() 44 r = fd_add_uid_acl_permission(fd, uid, ACL_READ); in TEST_RET() 48 log_info_errno(r, "fd_add_uid_acl_permission(%i, "UID_FMT", ACL_READ): %m", fd, uid); in TEST_RET() 59 r = fd_add_uid_acl_permission(fd, uid, ACL_READ); in TEST_RET()
|
/systemd-251/src/shared/ |
D | clean-ipc.c | 55 uid_t uid, cuid; in clean_sysvipc_shm() local 71 &shmid, &cpid, &lpid, &n_attached, &uid, &gid, &cuid, &cgid) != 8) in clean_sysvipc_shm() 77 if (!match_uid_gid(uid, gid, delete_uid, delete_gid)) in clean_sysvipc_shm() 117 uid_t uid, cuid; in clean_sysvipc_sem() local 133 &semid, &uid, &gid, &cuid, &cgid) != 5) in clean_sysvipc_sem() 136 if (!match_uid_gid(uid, gid, delete_uid, delete_gid)) in clean_sysvipc_sem() 176 uid_t uid, cuid; in clean_sysvipc_msg() local 193 &msgid, &cpid, &lpid, &uid, &gid, &cuid, &cgid) != 7) in clean_sysvipc_msg() 196 if (!match_uid_gid(uid, gid, delete_uid, delete_gid)) in clean_sysvipc_msg() 221 static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gid_t gid, bool rm) { in clean_posix_shm_internal() argument [all …]
|
D | chown-recursive.c | 20 uid_t uid, in chown_one() argument 38 r = fchmod_and_chown(fd, st->st_mode & mask, uid, gid); in chown_one() 48 uid_t uid, in chown_recursive_internal() argument 89 …r = chown_recursive_internal(subdir_fd, &fst, uid, gid, mask); /* takes possession of subdir_fd ev… in chown_recursive_internal() 95 r = chown_one(path_fd, &fst, uid, gid, mask); in chown_recursive_internal() 103 r = chown_one(dirfd(d), st, uid, gid, mask); in chown_recursive_internal() 112 uid_t uid, in path_chown_recursive() argument 123 if (!uid_is_valid(uid) && !gid_is_valid(gid) && FLAGS_SET(mask, 07777)) in path_chown_recursive() 131 if ((!uid_is_valid(uid) || st.st_uid == uid) && in path_chown_recursive() 136 …return chown_recursive_internal(TAKE_FD(fd), &st, uid, gid, mask); /* we donate the fd to the call… in path_chown_recursive() [all …]
|
D | uid-alloc-range.h | 7 bool uid_is_system(uid_t uid); 10 static inline bool uid_is_dynamic(uid_t uid) { in uid_is_dynamic() argument 11 return DYNAMIC_UID_MIN <= uid && uid <= DYNAMIC_UID_MAX; in uid_is_dynamic() 18 static inline bool uid_is_container(uid_t uid) { in uid_is_container() argument 19 return CONTAINER_UID_BASE_MIN <= uid && uid <= CONTAINER_UID_BASE_MAX; in uid_is_container()
|
D | userdb-dropin.c | 16 uid_t uid, in load_user() argument 31 if (FLAGS_SET(flags, USERDB_SUPPRESS_SHADOW) || !path || !(name || uid_is_valid(uid))) in load_user() 54 assert(uid_is_valid(uid)); in load_user() 55 if (asprintf(&j, "%s/" UID_FMT ".user-privileged", d, uid) < 0) in load_user() 93 if (uid_is_valid(uid) && uid != u->uid) in load_user() 134 int dropin_user_record_by_uid(uid_t uid, const char *path, UserDBFlags flags, UserRecord **ret) { in dropin_user_record_by_uid() argument 139 assert(uid_is_valid(uid)); in dropin_user_record_by_uid() 148 xsprintf(buf, UID_FMT ".user", uid); in dropin_user_record_by_uid() 161 return load_user(f, path, NULL, uid, flags, ret); in dropin_user_record_by_uid()
|
D | uid-alloc-range.c | 19 uid_t uid; in parse_alloc_uid() local 22 r = parse_uid(t, &uid); in parse_alloc_uid() 25 if (uid == 0) in parse_alloc_uid() 26 uid = 1; in parse_alloc_uid() 28 *ret_uid = uid; in parse_alloc_uid() 111 bool uid_is_system(uid_t uid) { in uid_is_system() argument 115 return uid <= defs->system_uid_max; in uid_is_system()
|
D | dev-setup.c | 17 int dev_setup(const char *prefix, uid_t uid, gid_t gid) { in dev_setup() argument 52 if (uid != UID_INVALID || gid != GID_INVALID) in dev_setup() 53 if (lchown(n, uid, gid) < 0) in dev_setup() 62 uid_t uid, in make_inaccessible_nodes() argument 113 if (uid != UID_INVALID || gid != GID_INVALID) { in make_inaccessible_nodes() 114 if (lchown(path, uid, gid) < 0) in make_inaccessible_nodes()
|
/systemd-251/src/basic/ |
D | mkdir.c | 22 uid_t uid, gid_t gid, in mkdir_safe_internal() argument 34 r = chmod_and_chown(path, mode, uid, gid); in mkdir_safe_internal() 49 return mkdir_safe_internal(p, mode, uid, gid, in mkdir_safe_internal() 66 if ((uid != UID_INVALID && st.st_uid != uid) || in mkdir_safe_internal() 70 if (uid != UID_INVALID) in mkdir_safe_internal() 71 xsprintf(u, UID_FMT, uid); in mkdir_safe_internal() 86 int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags) { in mkdir_safe() argument 87 return mkdir_safe_internal(path, mode, uid, gid, flags, mkdirat_errno_wrapper); in mkdir_safe() 90 int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, uid_t uid, gid_t gid,… in mkdir_parents_internal() argument 144 … r = mkdir_safe_internal(path, mode, uid, gid, flags | MKDIR_IGNORE_EXISTING, _mkdirat); in mkdir_parents_internal() [all …]
|
D | user-util.c | 30 bool uid_is_valid(uid_t uid) { in uid_is_valid() argument 35 if (uid == (uid_t) UINT32_C(0xFFFFFFFF)) in uid_is_valid() 39 if (uid == (uid_t) UINT32_C(0xFFFF)) in uid_is_valid() 46 uint32_t uid = 0; in parse_uid() local 60 | SAFE_ATO_REFUSE_LEADING_WHITESPACE, &uid); in parse_uid() 64 if (!uid_is_valid(uid)) in parse_uid() 71 *ret = uid; in parse_uid() 117 uid_t uid; in getlogname_malloc() local 121 uid = st.st_uid; in getlogname_malloc() 123 uid = getuid(); in getlogname_malloc() [all …]
|
D | mkdir.h | 14 int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags); 16 int mkdir_parents_safe(const char *prefix, const char *path, mode_t mode, uid_t uid, gid_t gid, Mkd… 18 int mkdir_p_safe(const char *prefix, const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlag… 19 int mkdir_p_root(const char *root, const char *p, uid_t uid, gid_t gid, mode_t m); 23 int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdi… 24 int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, uid_t uid, gid_t gid,… 25 int mkdir_p_internal(const char *prefix, const char *path, mode_t mode, uid_t uid, gid_t gid, Mkdir…
|
/systemd-251/src/machine/ |
D | machined-varlink.c | 13 uid_t uid; member 19 static int build_user_json(const char *user_name, uid_t uid, const char *real_name, JsonVariant **r… in build_user_json() argument 21 assert(uid_is_valid(uid)); in build_user_json() 27 JSON_BUILD_PAIR("uid", JSON_BUILD_UNSIGNED(uid)), in build_user_json() 37 static bool user_match_lookup_parameters(LookupParameters *p, const char *name, uid_t uid) { in user_match_lookup_parameters() argument 43 if (uid_is_valid(p->uid) && uid != p->uid) in user_match_lookup_parameters() 49 static int user_lookup_uid(Manager *m, uid_t uid, char **ret_name, char **ret_real_name) { in user_lookup_uid() argument 56 assert(uid_is_valid(uid)); in user_lookup_uid() 60 if (uid < 0x10000) /* Host UID range */ in user_lookup_uid() 63 r = manager_find_machine_for_uid(m, uid, &machine, &converted_uid); in user_lookup_uid() [all …]
|
/systemd-251/src/login/ |
D | user-runtime-dir.c | 53 uid_t uid, in user_mkdir_runtime_path() argument 62 assert(uid_is_valid(uid)); in user_mkdir_runtime_path() 80 uid, gid, runtime_dir_size, runtime_dir_inodes, in user_mkdir_runtime_path() 98 r = chmod_and_chown(runtime_path, 0700, uid, gid); in user_mkdir_runtime_path() 144 uid_t uid; in do_mount() local 148 r = get_user_creds(&user, &uid, &gid, NULL, NULL, 0); in do_mount() 160 xsprintf(runtime_path, "/run/user/" UID_FMT, uid); in do_mount() 162 log_debug("Will mount %s owned by "UID_FMT":"GID_FMT, runtime_path, uid, gid); in do_mount() 163 … return user_mkdir_runtime_path(runtime_path, uid, gid, runtime_dir_size, runtime_dir_inodes); in do_mount() 168 uid_t uid; in do_umount() local [all …]
|
D | logind-session-dbus.c | 49 return sd_bus_message_append(reply, "(uo)", (uint32_t) s->user->user_record->uid, p); in property_get_user() 174 s->user->user_record->uid, in bus_session_method_terminate() 222 s->user->user_record->uid, in bus_session_method_lock() 240 uid_t uid; in method_set_idle_hint() local 254 r = sd_bus_creds_get_euid(creds, &uid); in method_set_idle_hint() 258 if (uid != 0 && uid != s->user->user_record->uid) in method_set_idle_hint() 273 uid_t uid; in method_set_locked_hint() local 287 r = sd_bus_creds_get_euid(creds, &uid); in method_set_locked_hint() 291 if (uid != 0 && uid != s->user->user_record->uid) in method_set_locked_hint() 330 s->user->user_record->uid, in bus_session_method_kill() [all …]
|
D | loginctl.c | 148 uint32_t uid; in list_sessions() local 150 r = sd_bus_message_read(reply, "(susso)", &id, &uid, &user, &seat, &object); in list_sessions() 175 TABLE_UID, (uid_t) uid, in list_sessions() 218 uint32_t uid; in list_users() local 220 r = sd_bus_message_read(reply, "(uso)", &uid, &user, NULL); in list_users() 227 TABLE_UID, (uid_t) uid, in list_users() 327 uid_t uid; member 347 uid_t uid; member 446 … "(uo)", prop_map_first_of_struct, offsetof(SessionStatusInfo, uid) }, in print_session_status_info() 468 printf("%s (%"PRIu32")\n", i.name, i.uid); in print_session_status_info() [all …]
|
D | logind-inhibit.c | 47 .uid = UID_INVALID, in inhibitor_new() 111 i->uid, in inhibitor_save() 181 i->pid, i->uid, in inhibitor_start() 199 i->pid, i->uid, in inhibitor_stop() 213 …_cleanup_free_ char *what = NULL, *uid = NULL, *pid = NULL, *who = NULL, *why = NULL, *mode = NULL; in inhibitor_load() local 222 "UID", &uid, in inhibitor_load() 239 if (uid) { in inhibitor_load() 240 r = parse_uid(uid, &i->uid); in inhibitor_load() 242 log_debug_errno(r, "Failed to parse UID of inhibitor: %s", uid); in inhibitor_load() 402 uid_t uid, in manager_is_inhibited() argument [all …]
|
/systemd-251/src/core/ |
D | core-varlink.c | 13 uid_t uid; member 24 static int build_user_json(const char *user_name, uid_t uid, JsonVariant **ret) { in build_user_json() argument 26 assert(uid_is_valid(uid)); in build_user_json() 32 JSON_BUILD_PAIR("uid", JSON_BUILD_UNSIGNED(uid)), in build_user_json() 33 JSON_BUILD_PAIR("gid", JSON_BUILD_UNSIGNED(uid)), in build_user_json() 42 static bool user_match_lookup_parameters(LookupParameters *p, const char *name, uid_t uid) { in user_match_lookup_parameters() argument 48 if (uid_is_valid(p->uid) && uid != p->uid) in user_match_lookup_parameters() 252 …N_VARIANT_UNSIGNED, json_dispatch_uid_gid, offsetof(LookupParameters, uid), 0 }, in vl_method_get_user_record() 260 .uid = UID_INVALID, in vl_method_get_user_record() 263 uid_t found_uid = UID_INVALID, uid; in vl_method_get_user_record() local [all …]
|
D | dynamic-user.c | 140 static int make_uid_symlinks(uid_t uid, const char *name, bool b) { in make_uid_symlinks() argument 153 xsprintf(path1, "/run/systemd/dynamic-uid/direct:" UID_FMT, uid); in make_uid_symlinks() 322 uid_t uid = UID_INVALID; in dynamic_user_pop() local 323 struct iovec iov = IOVEC_INIT(&uid, sizeof(uid)); in dynamic_user_pop() 338 *ret_uid = uid; in dynamic_user_pop() 344 static int dynamic_user_push(DynamicUser *d, uid_t uid, int lock_fd) { in dynamic_user_push() argument 345 struct iovec iov = IOVEC_INIT(&uid, sizeof(uid)); in dynamic_user_push() 353 static void unlink_uid_lock(int lock_fd, uid_t uid, const char *name) { in unlink_uid_lock() argument 359 xsprintf(lock_path, "/run/systemd/dynamic-uid/" UID_FMT, uid); in unlink_uid_lock() 362 (void) make_uid_symlinks(uid, name, false); /* remove direct lookup symlinks */ in unlink_uid_lock() [all …]
|
/systemd-251/src/libsystemd/sd-login/ |
D | sd-login.c | 102 _public_ int sd_pid_get_owner_uid(pid_t pid, uid_t *uid) { in sd_pid_get_owner_uid() argument 106 assert_return(uid, -EINVAL); in sd_pid_get_owner_uid() 108 r = cg_pid_get_owner_uid(pid, uid); in sd_pid_get_owner_uid() 152 _public_ int sd_peer_get_owner_uid(int fd, uid_t *uid) { in sd_peer_get_owner_uid() argument 157 assert_return(uid, -EINVAL); in sd_peer_get_owner_uid() 163 return cg_pid_get_owner_uid(ucred.pid, uid); in sd_peer_get_owner_uid() 250 static int file_of_uid(uid_t uid, char **p) { in file_of_uid() argument 252 assert_return(uid_is_valid(uid), -EINVAL); in file_of_uid() 255 if (asprintf(p, "/run/systemd/users/" UID_FMT, uid) < 0) in file_of_uid() 261 _public_ int sd_uid_get_state(uid_t uid, char**state) { in sd_uid_get_state() argument [all …]
|
/systemd-251/src/nspawn/ |
D | nspawn-setuid.c | 63 uid_t uid, in change_uid_gid_raw() argument 69 if (!uid_is_valid(uid)) in change_uid_gid_raw() 70 uid = 0; in change_uid_gid_raw() 75 (void) fchown(STDIN_FILENO, uid, gid); in change_uid_gid_raw() 76 (void) fchown(STDOUT_FILENO, uid, gid); in change_uid_gid_raw() 77 (void) fchown(STDERR_FILENO, uid, gid); in change_uid_gid_raw() 86 if (setresuid(uid, uid, uid) < 0) in change_uid_gid_raw() 99 uid_t uid; in change_uid_gid() local 172 r = parse_uid(u, &uid); in change_uid_gid() 233 r = mkdir_safe(home, 0755, uid, gid, 0); in change_uid_gid() [all …]
|
/systemd-251/src/systemd/ |
D | sd-login.h | 58 int sd_pid_get_owner_uid(pid_t pid, uid_t *uid); 89 int sd_peer_get_owner_uid(int fd, uid_t *uid); 116 int sd_uid_get_state(uid_t uid, char **state); 119 int sd_uid_get_display(uid_t uid, char **session); 123 int sd_uid_is_on_seat(uid_t uid, int require_active, const char *seat); 128 int sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions); 133 int sd_uid_get_seats(uid_t uid, int require_active, char ***seats); 146 int sd_session_get_uid(const char *session, uid_t *uid); 179 int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
|
/systemd-251/src/timesync/ |
D | timesyncd.c | 24 static int load_clock_timestamp(uid_t uid, gid_t gid) { in load_clock_timestamp() argument 51 r = fchmod_and_chown(fd, 0644, uid, gid); in load_clock_timestamp() 57 r = mkdir_safe_label(STATE_DIR, 0755, uid, gid, in load_clock_timestamp() 65 r = touch_file(CLOCK_FILE, /* parents= */ false, min, uid, gid, 0644); in load_clock_timestamp() 89 uid_t uid, uid_current; in run() local 101 uid = uid_current = geteuid(); in run() 105 r = get_user_creds(&user, &uid, &gid, NULL, NULL, 0); in run() 110 r = load_clock_timestamp(uid, gid); in run() 117 r = drop_privileges(uid, gid, (1ULL << CAP_SYS_TIME)); in run()
|
/systemd-251/src/home/ |
D | homed-manager-bus.c | 95 (uint32_t) h->uid, in method_get_home_by_name() 111 uint32_t uid; in method_get_home_by_uid() local 118 r = sd_bus_message_read(message, "u", &uid); in method_get_home_by_uid() 121 if (!uid_is_valid(uid)) in method_get_home_by_uid() 122 … return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "UID " UID_FMT " is not valid", uid); in method_get_home_by_uid() 124 h = hashmap_get(m->homes_by_uid, UID_TO_PTR(uid)); in method_get_home_by_uid() 126 … return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_HOME, "No home for UID " UID_FMT " known", uid); in method_get_home_by_uid() 131 if (asprintf(&path, "/org/freedesktop/home1/home/" UID_FMT, h->uid) < 0) in method_get_home_by_uid() 176 (uint32_t) h->uid, in method_list_homes() 242 uint32_t uid; in method_get_user_record_by_uid() local [all …]
|
/systemd-251/src/sysusers/ |
D | sysusers.c | 74 uid_t uid; member 393 static const char* default_shell(uid_t uid) { in default_shell() argument 394 return uid == 0 ? "/bin/sh" : NOLOGIN; in default_shell() 464 .pw_uid = i->uid, in write_temporary_passwd() 476 .pw_shell = i->shell ?: (char*) default_shell(i->uid), in write_temporary_passwd() 559 ordered_hashmap_remove(todo_uids, UID_TO_PTR(i->uid)); in write_temporary_shadow() 937 static int uid_is_ok(uid_t uid, const char *name, bool check_with_gid) { in uid_is_ok() argument 940 if (ordered_hashmap_get(todo_uids, UID_TO_PTR(uid))) in uid_is_ok() 948 i = ordered_hashmap_get(todo_gids, GID_TO_PTR(uid)); in uid_is_ok() 954 if (hashmap_contains(database_by_uid, UID_TO_PTR(uid))) in uid_is_ok() [all …]
|