Blame SOURCES/autofs-5.0.7-fix-bad-mkdir-permission-on-create.patch

306fa1
autofs-5.0.7 - fix bad mkdir permission on create
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
Reported by Gordon Lack (gordon[dot]m[dot]lack[at]gsk[dot]com).
306fa1
306fa1
If the automount daemon needs to create a directory (hierarchy) for an
306fa1
automount and it is started up with a umask of 027 (or similar) then it
306fa1
creates unusable directories (permission == 550).
306fa1
---
306fa1
 CHANGELOG          |    1 +
306fa1
 daemon/automount.c |    5 ++++-
306fa1
 2 files changed, 5 insertions(+), 1 deletion(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -88,6 +88,7 @@
306fa1
 - check for bind onto self in mount_bind.c.
306fa1
 - fix symlink expire.
306fa1
 - fix master map type check.
306fa1
+- fix bad mkdir permission on create.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/daemon/automount.c
306fa1
+++ autofs-5.0.7/daemon/automount.c
306fa1
@@ -122,7 +122,10 @@ static int do_mkdir(const char *parent,
306fa1
 		status = statfs(parent, &fs);
306fa1
 	if ((status != -1 && fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC) ||
306fa1
 	    contained_in_local_fs(path)) {
306fa1
-		if (mkdir(path, mode) == -1) {
306fa1
+		mode_t mask = umask(0022);
306fa1
+		int ret = mkdir(path, mode);
306fa1
+		(void) umask(mask);
306fa1
+		if (ret == -1) {
306fa1
 			errno = EACCES;
306fa1
 			return 0;
306fa1
 		}