s3-lib: Fix error mapping for EROFS
authorSachin Prabhu via samba-technical <samba-technical@lists.samba.org>
Thu, 7 Sep 2017 11:49:49 +0000 (12:49 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 8 Sep 2017 00:33:14 +0000 (02:33 +0200)
EROFS is incorrectly mapped to NT_STATUS_ACCESS_DENIED. This should
instead be mapped to NT_STATUS_MEDIA_WRITE_PROTECTED.

This change has already been done for the client in
unix_nt_errmap in libcli/util/errmap_unix.c
commit 9d055846f225 ("r3278: - rewrote the client side rpc...)")

SMB1 specs for SMB_COM_DELETE also specifies this mapping for EROFS
https://msdn.microsoft.com/en-us/library/ee441772.aspx

RH bz: 1171705
This problem was reported by Red Hat glusterfs QE who encountered
different errors when performing the same operation on a fuse mount and
on a cifs mount of the same underlying gluster filesystem.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Gunther Deschner <gdeschne@redhat.com>
Reported-by: Surabhi Bhalothia <sbhaloth@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/errmap_unix.c

index f572b99d666b7f1dfdcbdb452660349f4dd316ca..9eb30f7b814243c74dcdde2af8b8479f4dccde18 100644 (file)
@@ -71,7 +71,7 @@ static const struct {
        { EXDEV,        NT_STATUS_NOT_SAME_DEVICE },
 #endif
 #ifdef EROFS
-       { EROFS,        NT_STATUS_ACCESS_DENIED },
+       { EROFS,        NT_STATUS_MEDIA_WRITE_PROTECTED },
 #endif
 #ifdef ENAMETOOLONG
        { ENAMETOOLONG, NT_STATUS_OBJECT_NAME_INVALID },