summaryrefslogtreecommitdiff
path: root/source3/locking/locking.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-08-27 08:19:43 +0000
committerAndrew Tridgell <tridge@samba.org>2001-08-27 08:19:43 +0000
commite8e98c9ea0690e3acf1126b50882e59e1056c7b3 (patch)
tree2fa75bc825f7e5da041809fe49080e3319656506 /source3/locking/locking.c
parent3820578473da81b7ae0dfa978605da809be59f62 (diff)
downloadsamba-e8e98c9ea0690e3acf1126b50882e59e1056c7b3.tar.gz
samba-e8e98c9ea0690e3acf1126b50882e59e1056c7b3.tar.bz2
samba-e8e98c9ea0690e3acf1126b50882e59e1056c7b3.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 (This used to be commit 83d9896c1ea8be796192b51a4678c2a3b87f7518)
Diffstat (limited to 'source3/locking/locking.c')
-rw-r--r--source3/locking/locking.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 81b2e92f68..d6915140a5 100644
--- a/source3/locking/locking.c
+++ b/source3/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 */
}
/****************************************************************************