Blame SOURCES/pam-1.1.8-mkhomedir-inroot.patch
|
|
f2fdff |
diff -up Linux-PAM-1.1.8/modules/pam_mkhomedir/mkhomedir_helper.c.mkhomedir-inroot Linux-PAM-1.1.8/modules/pam_mkhomedir/mkhomedir_helper.c
|
|
|
f2fdff |
--- Linux-PAM-1.1.8/modules/pam_mkhomedir/mkhomedir_helper.c.mkhomedir-inroot 2013-06-18 16:11:21.000000000 +0200
|
|
|
f2fdff |
+++ Linux-PAM-1.1.8/modules/pam_mkhomedir/mkhomedir_helper.c 2017-11-03 10:20:59.823998481 +0100
|
|
|
f2fdff |
@@ -352,16 +352,18 @@ make_parent_dirs(char *dir, int make)
|
|
|
f2fdff |
char *cp = strrchr(dir, '/');
|
|
|
f2fdff |
struct stat st;
|
|
|
f2fdff |
|
|
|
f2fdff |
- if (!cp || cp == dir)
|
|
|
f2fdff |
+ if (!cp)
|
|
|
f2fdff |
return rc;
|
|
|
f2fdff |
|
|
|
f2fdff |
- *cp = '\0';
|
|
|
f2fdff |
- if (stat(dir, &st) && errno == ENOENT)
|
|
|
f2fdff |
- rc = make_parent_dirs(dir, 1);
|
|
|
f2fdff |
- *cp = '/';
|
|
|
f2fdff |
+ if (cp != dir) {
|
|
|
f2fdff |
+ *cp = '\0';
|
|
|
f2fdff |
+ if (stat(dir, &st) && errno == ENOENT)
|
|
|
f2fdff |
+ rc = make_parent_dirs(dir, 1);
|
|
|
f2fdff |
+ *cp = '/';
|
|
|
f2fdff |
|
|
|
f2fdff |
- if (rc != PAM_SUCCESS)
|
|
|
f2fdff |
- return rc;
|
|
|
f2fdff |
+ if (rc != PAM_SUCCESS)
|
|
|
f2fdff |
+ return rc;
|
|
|
f2fdff |
+ }
|
|
|
f2fdff |
|
|
|
f2fdff |
if (make && mkdir(dir, 0755) && errno != EEXIST) {
|
|
|
f2fdff |
pam_syslog(NULL, LOG_ERR, "unable to create directory %s: %m", dir);
|