Re: [PATCH 24/25] autofs-5.0.7 - fix bad mkdir permission on create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-08-19 at 09:14 +0800, Ian Kent wrote:
> Reported by Gordon Lack (gordon[dot]m[dot]lack[at]gsk[dot]com).
> 
> If the automount daemon needs to create a directory (hierarchy) for an
> automount and it is started up with a umask of 027 (or similar) then it
> creates unusable directories (permission == 550).
> ---
>  CHANGELOG          |    1 +
>  daemon/automount.c |    5 ++++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/CHANGELOG b/CHANGELOG
> index 2499f1c..3a3fec1 100644
> --- a/CHANGELOG
> +++ b/CHANGELOG
> @@ -75,6 +75,7 @@
>  - fix fix wildcard multi map regression.
>  - improve timeout option description.
>  - only probe specific nfs version if requested.
> +- fix bad mkdir permission on create.
>  
>  25/07/2012 autofs-5.0.7
>  =======================
> diff --git a/daemon/automount.c b/daemon/automount.c
> index 97c726a..6b55103 100644
> --- a/daemon/automount.c
> +++ b/daemon/automount.c
> @@ -122,7 +122,10 @@ static int do_mkdir(const char *parent, const char *path, mode_t mode)
>  		status = statfs(parent, &fs);
>  	if ((status != -1 && fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC) ||
>  	    contained_in_local_fs(path)) {
> -		if (mkdir(path, mode) == -1) {
> +		int mask = umask(0022);
> +		int ret = mkdir(path, mode);
> +		void umask(mask);

OK, so that void should be (void).

> +		if (ret == -1) {
>  			errno = EACCES;
>  			return 0;
>  		}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe autofs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux