diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-08-27 08:19:43 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-08-27 08:19:43 +0000 |
commit | 83d9896c1ea8be796192b51a4678c2a3b87f7518 (patch) | |
tree | 3eca52e51950890d1a5b6e7c8b0ddfdee78a239a /source/locking/locking.c | |
parent | 9e0c9a99f6ca01cd6a0ee3084f85e1c36b11d7c3 (diff) | |
download | samba-83d9896c1ea8be796192b51a4678c2a3b87f7518.tar.gz samba-83d9896c1ea8be796192b51a4678c2a3b87f7518.tar.xz samba-83d9896c1ea8be796192b51a4678c2a3b87f7518.zip |
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
Diffstat (limited to 'source/locking/locking.c')
-rw-r--r-- | source/locking/locking.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/source/locking/locking.c b/source/locking/locking.c index 81b2e92f684..d6915140a50 100644 --- a/source/locking/locking.c +++ b/source/locking/locking.c @@ -99,14 +99,13 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn, Utility function called by locking requests. ****************************************************************************/ -BOOL do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, - SMB_BIG_UINT count,SMB_BIG_UINT offset,enum brl_type lock_type, - int *eclass,uint32 *ecode) +NTSTATUS do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, + SMB_BIG_UINT count,SMB_BIG_UINT offset,enum brl_type lock_type) { BOOL ok = False; if (!lp_locking(SNUM(conn))) - return(True); + return NT_STATUS_NOPROBLEMO; /* NOTE! 0 byte long ranges ARE allowed and should be stored */ @@ -142,31 +141,25 @@ BOOL do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, } } - if (!ok) { - *eclass = ERRDOS; - *ecode = ERRlock; - return False; - } - return True; /* Got lock */ + if (!ok) return NT_STATUS_FILE_LOCK_CONFLICT; + + return NT_STATUS_NOPROBLEMO; /* Got lock */ } /**************************************************************************** Utility function called by unlocking requests. ****************************************************************************/ -BOOL do_unlock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, - SMB_BIG_UINT count,SMB_BIG_UINT offset, - int *eclass,uint32 *ecode) +NTSTATUS do_unlock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, + SMB_BIG_UINT count,SMB_BIG_UINT offset) { BOOL ok = False; if (!lp_locking(SNUM(conn))) - return(True); + return NT_STATUS_NOPROBLEMO; if (!OPEN_FSP(fsp) || !fsp->can_lock || (fsp->conn != conn)) { - *eclass = ERRDOS; - *ecode = ERRbadfid; - return False; + return NT_STATUS_INVALID_HANDLE; } DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for file %s\n", @@ -183,17 +176,15 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, if (!ok) { DEBUG(10,("do_unlock: returning ERRlock.\n" )); - *eclass = ERRDOS; - *ecode = ERRnotlocked; - return False; + return NT_STATUS_LOCK_NOT_GRANTED; } if (!lp_posix_locking(SNUM(conn))) - return True; + return NT_STATUS_NOPROBLEMO; (void)release_posix_lock(fsp, offset, count); - return True; /* Did unlock */ + return NT_STATUS_NOPROBLEMO; /* Did unlock */ } /**************************************************************************** |