From: Todd C. Miller Date: Tue, 21 Mar 2017 20:55:19 +0000 (-0600) Subject: Don't set owner/mode on directories that already exist, only on X-Git-Tag: SUDO_1_8_20^2~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2caddff3f995e3b68c251f99bbdac3053db22666;p=sudo Don't set owner/mode on directories that already exist, only on newly-created ones. --- diff --git a/plugins/sudoers/mkdir_parents.c b/plugins/sudoers/mkdir_parents.c index d49f93e24..87db53f15 100644 --- a/plugins/sudoers/mkdir_parents.c +++ b/plugins/sudoers/mkdir_parents.c @@ -66,14 +66,7 @@ sudo_mkdir_parents(char *path, uid_t uid, gid_t gid, mode_t mode, bool quiet) sudo_warn(U_("unable to stat %s"), path); goto bad; } - if (S_ISDIR(sb.st_mode)) { - if (uid != (uid_t)-1 && gid != (gid_t)-1) { - if (sb.st_uid != uid || sb.st_gid != uid) - ignore_result(chown(path, uid, uid)); - } - if ((sb.st_mode & ALLPERMS) != mode) - ignore_result(chmod(path, mode)); - } else { + if (!S_ISDIR(sb.st_mode)) { if (!quiet) sudo_warnx(U_("%s exists but is not a directory (0%o)"), path, (unsigned int) sb.st_mode);