fixed wrong flags when uid/gid are forced in mount options

PERMISSION_HANDLING_BRANCH
Jean-Pierre André 2010-05-12 09:30:08 +02:00
parent 911328be86
commit 02b11579cc
2 changed files with 13 additions and 13 deletions

View File

@ -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";
}
}

View File

@ -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";
}
}
@ -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");