summaryrefslogtreecommitdiffstats
path: root/debian/patches-applied/pam_mkhomedir_stat_before_opendir
blob: aec49b69d76bf2011473c5952f006412a6f22fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Index: pam/modules/pam_mkhomedir/mkhomedir_helper.c
===================================================================
--- pam.orig/modules/pam_mkhomedir/mkhomedir_helper.c
+++ pam/modules/pam_mkhomedir/mkhomedir_helper.c
@@ -39,6 +39,7 @@
    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 @@
       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)