Possible incorrect error mapping ...

Andrew Bartlett abartlet at samba.org
Wed Apr 28 22:41:31 GMT 2004

On Thu, 2004-04-29 at 03:16, Richard Sharpe wrote:
> Hi,
> 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?

Well, there are two issues here:  

The first is that our mapping from DOS -> NTSTATUS error codes is not
the best (the only mapping that we know is accurate is the NTSTATUS ->
DOS mapping, because it was extracted over-the-wire from a windows

The second issue is that we should have NTSTATUS error returns in the
code, and translate to DOS only if the client is dos-only.

When forcing DOS error codes, what does win2k reply with?  If it is
DOS,ERRnoaccess then things are fine, otherwise we need to use
ERROR_BOTH() and figure out why that case is weird...

Andrew Bartlett

Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20040429/59ec5760/attachment.bin

More information about the samba-technical mailing list