cifs: Error STATUS_INVALID_OWNER should map to EACCES
diff mbox

Message ID 1449575977-9783-1-git-send-email-sprabhu@redhat.com
State New
Headers show

Commit Message

Sachin Prabhu Dec. 8, 2015, 11:59 a.m. UTC
Error STATUS_INVALID_OWNER maps to -EIO. This was encountered when
a non priviledged user attempts to change ownership on a file to another
user on a share mounted with the cifsacl mount option.

 # chown wintest1 a
chown: changing ownership of ‘a’: Input/output error

The error returned is confusing for users who do not expect this error.
The proposal is to return -EACCES instead when a STATUS_INVALID_OWNER is
returned.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
---
 fs/cifs/netmisc.c      | 2 +-
 fs/cifs/smb2maperror.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Sachin Prabhu Dec. 9, 2015, 6:10 a.m. UTC | #1
On Tue, 2015-12-08 at 17:29 +0530, Sachin Prabhu wrote:
> Error STATUS_INVALID_OWNER maps to -EIO. This was encountered when
> a non priviledged user attempts to change ownership on a file to
> another
> user on a share mounted with the cifsacl mount option.
> 
>  # chown wintest1 a
> chown: changing ownership of ‘a’: Input/output error
> 
> The error returned is confusing for users who do not expect this
> error.
> The proposal is to return -EACCES instead when a STATUS_INVALID_OWNER
> is
> returned.
> 
> Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>

Maybe EINVAL may be better in this case. Steve/Sirish, do you have any
advise on how we should proceed with this?

Sachin Prabhu

> ---
>  fs/cifs/netmisc.c      | 2 +-
>  fs/cifs/smb2maperror.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
> index abae6dd..301d3d4 100644
> --- a/fs/cifs/netmisc.c
> +++ b/fs/cifs/netmisc.c
> @@ -324,7 +324,7 @@ static const struct {
>  	ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, {
>  	ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, {
>  	ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, {
> -	ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, {
> +	ERRDOS, ERRnoaccess, NT_STATUS_INVALID_OWNER}, {
>  	ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, {
>  	ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, {
>  	ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, {
> diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c
> index 8257a5a..fd88cfa 100644
> --- a/fs/cifs/smb2maperror.c
> +++ b/fs/cifs/smb2maperror.c
> @@ -384,7 +384,7 @@ static const struct status_to_posix_error
> smb2_error_map_table[] = {
>  	"STATUS_CTL_FILE_NOT_SUPPORTED"},
>  	{STATUS_UNKNOWN_REVISION, -EIO, "STATUS_UNKNOWN_REVISION"},
>  	{STATUS_REVISION_MISMATCH, -EIO,
> "STATUS_REVISION_MISMATCH"},
> -	{STATUS_INVALID_OWNER, -EIO, "STATUS_INVALID_OWNER"},
> +	{STATUS_INVALID_OWNER, -EACCES, "STATUS_INVALID_OWNER"},
>  	{STATUS_INVALID_PRIMARY_GROUP, -EIO,
> "STATUS_INVALID_PRIMARY_GROUP"},
>  	{STATUS_NO_IMPERSONATION_TOKEN, -EIO,
> "STATUS_NO_IMPERSONATION_TOKEN"},
>  	{STATUS_CANT_DISABLE_MANDATORY, -EIO,
> "STATUS_CANT_DISABLE_MANDATORY"},

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index abae6dd..301d3d4 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -324,7 +324,7 @@  static const struct {
 	ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, {
 	ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, {
 	ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, {
-	ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, {
+	ERRDOS, ERRnoaccess, NT_STATUS_INVALID_OWNER}, {
 	ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, {
 	ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, {
 	ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, {
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c
index 8257a5a..fd88cfa 100644
--- a/fs/cifs/smb2maperror.c
+++ b/fs/cifs/smb2maperror.c
@@ -384,7 +384,7 @@  static const struct status_to_posix_error smb2_error_map_table[] = {
 	"STATUS_CTL_FILE_NOT_SUPPORTED"},
 	{STATUS_UNKNOWN_REVISION, -EIO, "STATUS_UNKNOWN_REVISION"},
 	{STATUS_REVISION_MISMATCH, -EIO, "STATUS_REVISION_MISMATCH"},
-	{STATUS_INVALID_OWNER, -EIO, "STATUS_INVALID_OWNER"},
+	{STATUS_INVALID_OWNER, -EACCES, "STATUS_INVALID_OWNER"},
 	{STATUS_INVALID_PRIMARY_GROUP, -EIO, "STATUS_INVALID_PRIMARY_GROUP"},
 	{STATUS_NO_IMPERSONATION_TOKEN, -EIO, "STATUS_NO_IMPERSONATION_TOKEN"},
 	{STATUS_CANT_DISABLE_MANDATORY, -EIO, "STATUS_CANT_DISABLE_MANDATORY"},