Observation/Question on use of NTSTATUS in the Samba4 code base

Andrew Bartlett abartlet at samba.org
Wed Apr 4 00:54:01 GMT 2007


On Tue, 2007-04-03 at 19:18 -0400, Krishna Ganugapati wrote:
> I happened to notice that Samba4 uses NTSTATUS codes throughout its code
> base irrespective of whether the code is "user mode" code or "kernel
> mode" code, All NT device drivers use NTSTATUS which means the kernel
> mode transports - the netbt.sys, smb.sys,  and the kernel mode file
> systems srv,sys (the SMB file server and npfs.sys (the named pipe file
> system). However all user mode code typically uses Win32 errror codes
> (WERRORS).  I noticed that the samr.idl files use NTSTATUS and so do the
> eventlog.idl files. I would have thought that the samr stuff returns
> WERRORs.

No, SAMR is NTSTATUS.  Others are WERROR, but it is still a minority,
and it is the historically less implemented pipes (other key NTSTATUS
pipes include NETLOGON and LSA).

> I also notice that the rpc code uses NTSTATUS error codes - I know that
> the named pipe support would use Win32 error codes  (in user space) and
> therefore the rpc returns would be WERRORs  but it seems that the Samba4
> implementation uses NTSTATUS codes.
> 
>  
> 
> 
> 
> Is there any particular formal model that Samba4 subscribes to with
> respect to error codes? In general there is not a 1-1 mapping between
> WERRORS and NTSTATUS codes

We have chosen NTSTATUS as the general error description in Samba,
mostly due to the fact that until recently, we came across very few
pipes that did WERROR, and our on-the-wire error codes for SMB are also
NTSTATUS.

Perhaps we should look at the WERROR codes more carefully, as we move
towards handling a broader range of tasks.  The change would not be easy
however. 

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Red Hat Inc.                  http://redhat.com
-------------- 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/20070404/269a259c/attachment.bin


More information about the samba-technical mailing list