summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)