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

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