From e8e98c9ea0690e3acf1126b50882e59e1056c7b3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Aug 2001 08:19:43 +0000 Subject: converted smbd to use NTSTATUS by default major changes include: - added NSTATUS type - added automatic mapping between dos and nt error codes - changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT() these calls auto-translate to the client error code system - got rid of the cached error code and the writebmpx code We eventually will need to also: - get rid of BOOL, so we don't lose error info - replace all ERROR_DOS() calls with ERROR_NT() calls but that is too much for one night (This used to be commit 83d9896c1ea8be796192b51a4678c2a3b87f7518) --- source3/include/msdfs.h | 4 ++-- source3/include/smb.h | 4 ++-- source3/include/smb_macros.h | 25 ++++++++----------------- 3 files changed, 12 insertions(+), 21 deletions(-) (limited to 'source3/include') diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h index 2c0f9a19ba..0748577b0b 100644 --- a/source3/include/msdfs.h +++ b/source3/include/msdfs.h @@ -64,13 +64,13 @@ struct dfs_path #define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \ { if(((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES)) && \ dfs_redirect(name,conn)) \ - return(dfs_path_error(inbuf,outbuf)); } + return ERROR_NT(NT_STATUS_PATH_NOT_COVERED); } #define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) \ { if((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) || \ get_remote_arch()==RA_WIN95) \ if(dfs_findfirst_redirect(directory,conn)) \ - return(dfs_path_error(inbuf,outbuf)); } + return ERROR_NT(NT_STATUS_PATH_NOT_COVERED); } #define init_dfsroot(conn, inbuf, outbuf) \ { if(lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) \ diff --git a/source3/include/smb.h b/source3/include/smb.h index a4887e1529..d8b5540510 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -205,9 +205,10 @@ typedef struct nttime_info { uint32 low; uint32 high; - } NTTIME; +typedef uint32 NTSTATUS; + /* Allowable account control bits */ #define ACB_DISABLED 0x0001 /* 1 = User account disabled */ #define ACB_HOMDIRREQ 0x0002 /* 1 = Home directory required */ @@ -370,7 +371,6 @@ typedef struct files_struct SMB_OFF_T size; mode_t mode; uint16 vuid; - write_bmpx_struct *wbmpx_ptr; write_cache *wcp; struct timeval open_time; int share_mode; diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index e1deaf58ea..0c66a8e7a9 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -67,16 +67,14 @@ #define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn) #define CHECK_FSP(fsp,conn) if (!FNUM_OK(fsp,conn)) \ - return(ERROR(ERRDOS,ERRbadfid)); \ + return(ERROR_DOS(ERRDOS,ERRbadfid)); \ else if((fsp)->fd == -1) \ - return(ERROR(ERRDOS,ERRbadaccess)) + return(ERROR_DOS(ERRDOS,ERRbadaccess)) #define CHECK_READ(fsp) if (!(fsp)->can_read) \ - return(ERROR(ERRDOS,ERRbadaccess)) + return(ERROR_DOS(ERRDOS,ERRbadaccess)) #define CHECK_WRITE(fsp) if (!(fsp)->can_write) \ - return(ERROR(ERRDOS,ERRbadaccess)) -#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \ - return(CACHED_ERROR(fsp)) + return(ERROR_DOS(ERRDOS,ERRbadaccess)) /* translates a connection number into a service number */ #define SNUM(conn) ((conn)?(conn)->service:-1) @@ -134,22 +132,15 @@ #define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) #define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) -/* Macro to cache an error in a write_bmpx_struct */ -#define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ - w->wr_discard = True, -1) -/* Macro to test if an error has been cached for this fnum */ -#define HAS_CACHED_ERROR(fsp) ((fsp)->wbmpx_ptr && \ - (fsp)->wbmpx_ptr->wr_discard) -/* Macro to turn the cached error into an error packet */ -#define CACHED_ERROR(fsp) cached_error_packet(inbuf,outbuf,fsp,__LINE__) - /* these are the datagram types */ #define DGRAM_DIRECT_UNIQUE 0x10 -#define ERROR(class,x) error_packet(inbuf,outbuf,class,x,__LINE__) +#define ERROR_DOS(class,code) error_packet(outbuf,0,class,code,__LINE__) +#define ERROR_NT(status) error_packet(outbuf,status,0,0,__LINE__) +#define ERROR_BOTH(status,class,code) error_packet(outbuf,status,class,code,__LINE__) /* this is how errors are generated */ -#define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,__LINE__) +#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__) #define SMB_ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1)) -- cgit