#include <sys/types.h>
#include <unistd.h>
+/* Users managed by systemd-homed. See https://systemd.io/UIDS-GIDS for details how this range fits into the rest of the world */
+#define HOME_UID_MIN 60001
+#define HOME_UID_MAX 60513
+
+/* Users mapped from host into a container */
+#define MAP_UID_MIN 60514
+#define MAP_UID_MAX 60577
+
bool uid_is_valid(uid_t uid);
static inline bool gid_is_valid(gid_t gid) {
#include "time-util.h"
#include "user-record.h"
-/* See https://systemd.io/UIDS-GIDS for details how this range fits into the rest of the world */
-#define HOME_UID_MIN 60001
-#define HOME_UID_MAX 60513
-
/* Put some limits on disk sizes: not less than 5M, not more than 5T */
#define USER_DISK_SIZE_MIN (UINT64_C(5)*1024*1024)
#define USER_DISK_SIZE_MAX (UINT64_C(5)*1024*1024*1024*1024)
#include "user-util.h"
#include "userdb.h"
-#define MAP_UID_START 60514
-#define MAP_UID_END 60577
-
static int check_etc_passwd_collisions(
const char *directory,
const char *name,
assert(current_uid);
for (;; (*current_uid) ++) {
- if (*current_uid > MAP_UID_END || *current_uid > max_uid)
+ if (*current_uid > MAP_UID_MAX || *current_uid > max_uid)
return log_error_errno(
SYNTHETIC_ERRNO(EBUSY),
"No suitable available UID in range " UID_FMT "…" UID_FMT " in container detected, can't map user.",
- MAP_UID_START, MAP_UID_END);
+ MAP_UID_MIN, MAP_UID_MAX);
r = check_etc_passwd_collisions(directory, NULL, *current_uid);
if (r < 0)
BindUserContext **ret) {
_cleanup_(bind_user_context_freep) BindUserContext *c = NULL;
- uid_t current_uid = MAP_UID_START;
+ uid_t current_uid = MAP_UID_MIN;
char **n;
int r;