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

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