BOOL do_unlock(uint16 smbpid, files_struct * fsp, struct vfs_connection_struct *conn, SMB_BIG_UINT count, SMB_BIG_UINT offset, uint32 *err) { BOOL ok = False; if (!lp_locking(conn->snum)) return (True); if (!OPEN_FSP(fsp) || !fsp->can_lock || (fsp->conn != conn)) { *err = NT_STATUS_NOT_LOCKED; return False; } DEBUG(10, ("do_unlock: unlock start=%.0f len=%.0f requested for file %s\n", (double)offset, (double)count, smbstrA(fsp->fsp_name))); /* * Remove the existing lock record from the tdb lockdb * before looking at POSIX locks. If this record doesn't * match then don't bother looking to remove POSIX locks. */ ok = brl_unlock(fsp->sbuf.st_dev, fsp->sbuf.st_ino, fsp->fnum, smbpid, sys_getpid(), conn->snum, offset, count); if (!ok) { DEBUG(10, ("do_unlock: returning ERRlock.\n")); *err = NT_STATUS_RANGE_NOT_LOCKED; return False; } if (!lp_posix_locking(conn->snum)) return True; (void)release_posix_lock(fsp, offset, count); return True; /* Did unlock */ }
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 NT_STATUS_OK; if (!OPEN_FSP(fsp) || !fsp->can_lock || (fsp->conn != conn)) { return NT_STATUS_INVALID_HANDLE; } DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for file %s\n", (double)offset, (double)count, fsp->fsp_name )); /* * Remove the existing lock record from the tdb lockdb * before looking at POSIX locks. If this record doesn't * match then don't bother looking to remove POSIX locks. */ ok = brl_unlock(fsp->dev, fsp->inode, fsp->fnum, lock_pid, sys_getpid(), conn->cnum, offset, count, False); if (!ok) { DEBUG(10,("do_unlock: returning ERRlock.\n" )); return NT_STATUS_RANGE_NOT_LOCKED; } if (!lp_posix_locking(SNUM(conn))) return NT_STATUS_OK; (void)release_posix_lock(fsp, offset, count); return NT_STATUS_OK; }