In looking at some smborture DENY1 problems, I noticed that we seem to be returning the wrong value if the client opens a file without asking for WRITE access, and then try to write the file. In reply_write_and_X we use the CHECK_WRITE macro, which translates into: #define CHECK_WRITE(fsp) if (!(fsp)->can_write) \ return(ERROR_DOS(ERRDOS,ERRbadaccess)) This eventually calls dos_to_ntstatus, which uses this entry: {ERRDOS, ERRbadaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, and we see NT_STATUS_INVALID_LOCK_SEQUENCE on the wire, however, Win2K returns NT_STATUS_ACCESS_DENIED (which seems vastly more reasonable). The question, of course, is, are there circumstances when ERRbadaccess should map to NT_STATUS_INVALID_LOCK_SEQUENCE, or is the code just wrong at the moment? I have looked at all the places where we use ERRbadaccess, and it looks like we can simply map that error to NT_STATUS_ACCESS_DENIED.
OK, further investigation shows that Win2K refuses (it seems) to send back DOS error codes. I modified clientgen.c to remove the bit asking for NT Status codes, but Win2K sent NT Status codes anyway ... In addition, here are the places where we use ERRbadaccess: grep ERRbadaccess ~/open-src/samba/branches/SAMBA_3_0/source/*/*.c /fs/home/rsharpe/open-src/samba/branches/SAMBA_3_0/source/libsmb/errormap.c: {ERRDOS, ERRbadaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, /fs/home/rsharpe/open-src/samba/branches/SAMBA_3_0/source/libsmb/smberr.c: {"ERRbadaccess",ERRbadaccess,"Invalid open mode."}, /fs/home/rsharpe/open-src/samba/branches/SAMBA_3_0/source/smbd/reply.c: return ERROR_DOS(ERRDOS,ERRbadaccess); /fs/home/rsharpe/open-src/samba/branches/SAMBA_3_0/source/smbd/reply.c: return ERROR_DOS(ERRDOS,ERRbadaccess); So, it seems that we already think that ERRbadaccess means something different than INVALID_LOCK_SEQUENCE ... So, I would suggest changing the errmap.c mapping to NT_STATUS_SHARING_VIOLATION.
Fixed in change # r415.
That should say, change the error returned to NT_STATUS_ACCESS_DENIED, which is what I changed the error to.
originally reported against 3.0aph24. Bugzilla spring cleaning. Removing old alpha versions.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.