Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/useradd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2220,12 +2220,21 @@ static void create_home(const struct option_flags *flags)
char *bhome, *cp;
mode_t mode;
bool process_selinux;
#if WITH_BTRFS
uid_t uid_min;
uid_t uid_max;
#endif

process_selinux = !flags->chroot && !flags->prefix;

if (access (prefix_user_home, F_OK) == 0)
return;

#if WITH_BTRFS
uid_min = getdef_ulong("UID_MIN", 1000UL);
uid_max = getdef_ulong("UID_MAX", 60000UL);
#endif

strcpy(path, "");
bhome = strdup(prefix_user_home);
if (!bhome) {
Expand Down Expand Up @@ -2264,7 +2273,8 @@ static void create_home(const struct option_flags *flags)

dir_created = false;
#if WITH_BTRFS
if (subvolflg && (strlen(prefix_user_home) - (int)strlen(path)) <= 1) {
if (subvolflg && user_id >= uid_min && user_id <= uid_max
&& (strlen(prefix_user_home) - (int)strlen(path)) <= 1) {
char *btrfs_check = strdup(path);
struct statfs sfs;

Expand Down
Loading