Bug 1300 - SAMBA_3_0 (svn) returns NT_STATUS_INVALID_LOCK_SEQUENCE when Win2K returns NT_STATUS_ACCESS_DENIED
SAMBA_3_0 (svn) returns NT_STATUS_INVALID_LOCK_SEQUENCE when Win2K returns NT...
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: File Services
3.0.0preX
Other other
: P3 normal
: none
Assigned To: Samba Bugzilla Account
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-28 11:14 UTC by Richard Sharpe
Modified: 2005-08-24 10:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sharpe 2004-04-28 11:14:56 UTC
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.
Comment 1 Richard Sharpe 2004-04-29 10:44:56 UTC
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.
Comment 2 Richard Sharpe 2004-04-29 17:59:13 UTC
Fixed in change # r415.
Comment 3 Richard Sharpe 2004-04-30 13:43:36 UTC
That should say, change the error returned to NT_STATUS_ACCESS_DENIED, which is
what I changed the error to.
Comment 4 Gerald (Jerry) Carter 2005-02-07 07:57:24 UTC
originally reported against 3.0aph24.  Bugzilla spring cleaning.  
Removing old alpha versions.
Comment 5 Gerald (Jerry) Carter 2005-08-24 10:26:55 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.