diff mbox

[nfs-utils] mount: chk_mountpoint should only check for execute perms for unpriveleged users

Message ID 1395346354-64069-1-git-send-email-smayhew@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Scott Mayhew March 20, 2014, 8:12 p.m. UTC
Otherwise 'mount -o remount' fails on mounts that have root squashing
enabled and world execute perms disabled.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 utils/mount/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve Dickson March 22, 2014, 2:13 p.m. UTC | #1
On 03/20/2014 04:12 PM, Scott Mayhew wrote:
> Otherwise 'mount -o remount' fails on mounts that have root squashing
> enabled and world execute perms disabled.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed...

steved.
> ---
>  utils/mount/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/mount/utils.c b/utils/mount/utils.c
> index ede77a8..92662ed 100644
> --- a/utils/mount/utils.c
> +++ b/utils/mount/utils.c
> @@ -130,7 +130,7 @@ int chk_mountpoint(const char *mount_point)
>  		mount_error(NULL, mount_point, ENOTDIR);
>  		return 1;
>  	}
> -	if (access(mount_point, X_OK) < 0) {
> +	if (getuid() != 0 && geteuid() != 0 && access(mount_point, X_OK) < 0) {
>  		mount_error(NULL, mount_point, errno);
>  		return 1;
>  	}
> -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mount/utils.c b/utils/mount/utils.c
index ede77a8..92662ed 100644
--- a/utils/mount/utils.c
+++ b/utils/mount/utils.c
@@ -130,7 +130,7 @@  int chk_mountpoint(const char *mount_point)
 		mount_error(NULL, mount_point, ENOTDIR);
 		return 1;
 	}
-	if (access(mount_point, X_OK) < 0) {
+	if (getuid() != 0 && geteuid() != 0 && access(mount_point, X_OK) < 0) {
 		mount_error(NULL, mount_point, errno);
 		return 1;
 	}