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

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