Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halt mounting with a faulty usermapping path #10

Open
wants to merge 1 commit into
base: edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/lowntfs-3g.c
Original file line number Diff line number Diff line change
Expand Up @@ -4787,6 +4787,16 @@ int main(int argc, char *argv[])
#endif /* POSIXACLS */
ctx->dmask = ctx->fmask = 0;
} else {
/*
* User mapping path was defined, but building it failed
* Warn the user and halt the mounting
*/
if (ctx->usermap_path) {
ntfs_log_perror("Failed to load user mapping '%s'",
ctx->usermap_path);
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
ctx->security.uid = ctx->uid;
ctx->security.gid = ctx->gid;
/* same ownership/permissions for all files */
Expand All @@ -4808,8 +4818,6 @@ int main(int argc, char *argv[])
permissions_mode = "Ownership and permissions disabled";
}
}
if (ctx->usermap_path)
free (ctx->usermap_path);

#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
xattr_mapping = ntfs_xattr_build_mapping(ctx->vol,
Expand Down Expand Up @@ -4855,6 +4863,8 @@ int main(int argc, char *argv[])
fuse_session_destroy(se);
err_out:
ntfs_mount_error(opts.device, opts.mnt_point, err);
if (ctx->usermap_path)
free(ctx->usermap_path);
if (ctx->abs_mnt_point)
free(ctx->abs_mnt_point);
#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
Expand Down
14 changes: 12 additions & 2 deletions src/ntfs-3g.c
Original file line number Diff line number Diff line change
Expand Up @@ -4514,6 +4514,16 @@ int main(int argc, char *argv[])
#endif /* POSIXACLS */
ctx->dmask = ctx->fmask = 0;
} else {
/*
* User mapping path was defined, but building it failed
* Warn the user and halt the mounting
*/
if (ctx->usermap_path) {
ntfs_log_perror("Failed to load user mapping '%s'",
ctx->usermap_path);
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
ctx->security.uid = ctx->uid;
ctx->security.gid = ctx->gid;
/* same ownership/permissions for all files */
Expand All @@ -4535,8 +4545,6 @@ int main(int argc, char *argv[])
permissions_mode = "Ownership and permissions disabled";
}
}
if (ctx->usermap_path)
free (ctx->usermap_path);

#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
xattr_mapping = ntfs_xattr_build_mapping(ctx->vol,
Expand Down Expand Up @@ -4584,6 +4592,8 @@ int main(int argc, char *argv[])
fuse_destroy(fh);
err_out:
ntfs_mount_error(opts.device, opts.mnt_point, err);
if (ctx->usermap_path)
free(ctx->usermap_path);
if (ctx->abs_mnt_point)
free(ctx->abs_mnt_point);
#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
Expand Down