diff options
author | Volker Lendecke <vl@samba.org> | 2011-01-16 20:04:17 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2011-01-17 08:03:43 +0100 |
commit | dd2f234412a004ca8c259b60302f1aac42c3a882 (patch) | |
tree | f199a3f53bc6320046dfc1aaf5c09cd417b69a07 /source3/libsmb | |
parent | 0e2854f7433680b9b76002b0ff3d3b039661bd43 (diff) | |
download | samba-dd2f234412a004ca8c259b60302f1aac42c3a882.tar.gz samba-dd2f234412a004ca8c259b60302f1aac42c3a882.tar.bz2 samba-dd2f234412a004ca8c259b60302f1aac42c3a882.zip |
s3: Convert cli_lock to use cli_locktype
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clifile.c | 53 |
1 files changed, 7 insertions, 46 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index aeada27ca8..582fe0a12b 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2537,54 +2537,15 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum, ****************************************************************************/ bool cli_lock(struct cli_state *cli, uint16_t fnum, - uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type) + uint32_t offset, uint32_t len, int timeout, + enum brl_type lock_type) { - char *p; - int saved_timeout = cli->timeout; - - memset(cli->outbuf,'\0',smb_size); - memset(cli->inbuf,'\0', smb_size); - - cli_set_message(cli->outbuf,8,0,True); - - SCVAL(cli->outbuf,smb_com,SMBlockingX); - SSVAL(cli->outbuf,smb_tid,cli->cnum); - cli_setup_packet(cli); - - SCVAL(cli->outbuf,smb_vwv0,0xFF); - SSVAL(cli->outbuf,smb_vwv2,fnum); - SCVAL(cli->outbuf,smb_vwv3,(lock_type == READ_LOCK? 1 : 0)); - SIVALS(cli->outbuf, smb_vwv4, timeout); - SSVAL(cli->outbuf,smb_vwv6,0); - SSVAL(cli->outbuf,smb_vwv7,1); - - p = smb_buf(cli->outbuf); - SSVAL(p, 0, cli->pid); - SIVAL(p, 2, offset); - SIVAL(p, 6, len); - - p += 10; - - cli_setup_bcc(cli, p); - - cli_send_smb(cli); - - if (timeout != 0) { - cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout*2 + 5*1000); - } - - if (!cli_receive_smb(cli)) { - cli->timeout = saved_timeout; - return False; - } - - cli->timeout = saved_timeout; - - if (cli_is_error(cli)) { - return False; - } + NTSTATUS status; - return True; + status = cli_locktype(cli, fnum, offset, len, timeout, + (lock_type == READ_LOCK? 1 : 0)); + cli_set_error(cli, status); + return NT_STATUS_IS_OK(status); } /**************************************************************************** |