From d9f8647ef9391285fec4a94f1cd3aad4df553272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Wed, 17 Feb 2010 11:47:14 +0100 Subject: [PATCH] Fixed enabling permissions when no UserMapping file is found --- src/lowntfs-3g.c | 12 ++++++++---- src/ntfs-3g.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index c6427be9..06ad2d06 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -3732,9 +3732,7 @@ static char *parse_mount_options(const char *orig_opts) goto err_exit; sscanf(val, "%o", &ctx->fmask); ctx->dmask = ctx->fmask; -#if !POSIXACLS - default_permissions = 1; -#endif + want_permissions = 1; } else if (!strcmp(opt, "fmask")) { if (missing_option_value(val, "fmask")) goto err_exit; @@ -4387,8 +4385,14 @@ int main(int argc, char *argv[]) /* same ownership/permissions for all files */ ctx->security.mapping[MAPUSERS] = (struct MAPPING*)NULL; ctx->security.mapping[MAPGROUPS] = (struct MAPPING*)NULL; - if (ctx->secure_flags & (1 << SECURITY_WANTED)) + if ((ctx->secure_flags & (1 << SECURITY_WANTED)) + && !(ctx->secure_flags & (1 << SECURITY_DEFAULT))) { ctx->secure_flags |= (1 << SECURITY_DEFAULT); + if (strappend(&parsed_options, ",default_permissions")) { + err = NTFS_VOLUME_SYNTAX_ERROR; + goto err_out; + } + } if (ctx->secure_flags & (1 << SECURITY_DEFAULT)) { ctx->secure_flags |= (1 << SECURITY_RAW); permissions_mode = "Global ownership and permissions enforced"; diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 97693164..5da26e28 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -3702,9 +3702,7 @@ static char *parse_mount_options(const char *orig_opts) goto err_exit; sscanf(val, "%o", &ctx->fmask); ctx->dmask = ctx->fmask; -#if !POSIXACLS - default_permissions = 1; -#endif + want_permissions = 1; } else if (!strcmp(opt, "fmask")) { if (missing_option_value(val, "fmask")) goto err_exit; @@ -4361,8 +4359,14 @@ int main(int argc, char *argv[]) /* same ownership/permissions for all files */ ctx->security.mapping[MAPUSERS] = (struct MAPPING*)NULL; ctx->security.mapping[MAPGROUPS] = (struct MAPPING*)NULL; - if (ctx->secure_flags & (1 << SECURITY_WANTED)) + if ((ctx->secure_flags & (1 << SECURITY_WANTED)) + && !(ctx->secure_flags & (1 << SECURITY_DEFAULT))) { ctx->secure_flags |= (1 << SECURITY_DEFAULT); + if (strappend(&parsed_options, ",default_permissions")) { + err = NTFS_VOLUME_SYNTAX_ERROR; + goto err_out; + } + } if (ctx->secure_flags & (1 << SECURITY_DEFAULT)) { ctx->secure_flags |= (1 << SECURITY_RAW); permissions_mode = "Global ownership and permissions enforced";