summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSam Hartman <hartmans@debian.org>2023-09-11 14:00:42 -0600
committerSam Hartman <hartmans@debian.org>2024-02-27 21:30:52 -0700
commit34f9f87f75cd75f61a72bf2de1d9e537882803ba (patch)
tree1a389a09be5aa885f86d35fedcb9c88fb64bd8d8 /modules
parentcd44f33304731b2c602f5d9ac255d3af2db0d1ea (diff)
pam_mkhomedir_stat_before_opendir
=================================================================== Gbp-Pq: Name pam_mkhomedir_stat_before_opendir
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_mkhomedir/mkhomedir_helper.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/pam_mkhomedir/mkhomedir_helper.c b/modules/pam_mkhomedir/mkhomedir_helper.c
index 3213f028..643d5d01 100644
--- a/modules/pam_mkhomedir/mkhomedir_helper.c
+++ b/modules/pam_mkhomedir/mkhomedir_helper.c
@@ -39,6 +39,7 @@ create_homedir(const struct passwd *pwd,
DIR *d;
struct dirent *dent;
int retval = PAM_SESSION_ERR;
+ struct stat stat_buf;
/* Create the new directory */
if (mkdir(dest, 0700) && errno != EEXIST)
@@ -54,6 +55,12 @@ create_homedir(const struct passwd *pwd,
goto go_out;
}
+ /* Various things such as an autofs mount with browsing disabled
+ * can cause the directory to appear only on stat. The intent is
+ * to minimize network traversal when a file explorer tries to
+ * traverse large chunks of a directory tree. So stat first.*/
+ stat(source, &stat_buf);
+
/* Scan the directory */
d = opendir(source);
if (d == NULL)