Skip to content

Commit

Permalink
fixed wrong flags when uid/gid are forced in mount options
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Pierre André committed May 12, 2010
1 parent 911328b commit 02b1157
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/lowntfs-3g.c
Original file line number Diff line number Diff line change
Expand Up @@ -4432,19 +4432,19 @@ 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))
&& !(ctx->secure_flags & (1 << SECURITY_DEFAULT))) {
ctx->secure_flags |= (1 << SECURITY_DEFAULT);
if ((ctx->vol->secure_flags & (1 << SECURITY_WANTED))
&& !(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))) {
ctx->vol->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);
if (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT)) {
ctx->vol->secure_flags |= (1 << SECURITY_RAW);
permissions_mode = "Global ownership and permissions enforced";
} else {
ctx->secure_flags &= ~(1 << SECURITY_RAW);
ctx->vol->secure_flags &= ~(1 << SECURITY_RAW);
permissions_mode = "Ownership and permissions disabled";
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/ntfs-3g.c
Original file line number Diff line number Diff line change
Expand Up @@ -4395,19 +4395,19 @@ 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))
&& !(ctx->secure_flags & (1 << SECURITY_DEFAULT))) {
ctx->secure_flags |= (1 << SECURITY_DEFAULT);
if ((ctx->vol->secure_flags & (1 << SECURITY_WANTED))
&& !(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))) {
ctx->vol->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);
if (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT)) {
ctx->vol->secure_flags |= (1 << SECURITY_RAW);
permissions_mode = "Global ownership and permissions enforced";
} else {
ctx->secure_flags &= ~(1 << SECURITY_RAW);
ctx->vol->secure_flags &= ~(1 << SECURITY_RAW);
permissions_mode = "Ownership and permissions disabled";
}
}
Expand All @@ -4432,7 +4432,7 @@ int main(int argc, char *argv[])
if (permissions_mode)
ntfs_log_info("%s, configuration type %d\n",permissions_mode,
4 + POSIXACLS*6 - KERNELPERMS*3 + CACHEING);
if ((ctx->secure_flags & (1 << SECURITY_RAW))
if ((ctx->vol->secure_flags & (1 << SECURITY_RAW))
&& !ctx->uid && ctx->gid)
ntfs_log_error("Warning : using problematic uid==0 and gid!=0\n");

Expand Down

0 comments on commit 02b1157

Please sign in to comment.