summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-03-11 01:33:06 +0000
committerAndrew Tridgell <tridge@samba.org>2002-03-11 01:33:06 +0000
commitcc24c353bb79b18819873d7afb02f704d9a89fec (patch)
treec98dc7d24a766c0ae5ac43118cef0391144b35b8 /source3/libsmb
parentec4f138436f4754aa5c991b6f102b1e070fd1bb7 (diff)
downloadsamba-cc24c353bb79b18819873d7afb02f704d9a89fec.tar.gz
samba-cc24c353bb79b18819873d7afb02f704d9a89fec.tar.bz2
samba-cc24c353bb79b18819873d7afb02f704d9a89fec.zip
added cli_locktype() for testing different lockingX lock types
(This used to be commit 136b9752fc9da86f0ad0e1f46dc389b752975aea)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clifile.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 102114f871..05843ac5de 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -542,6 +542,59 @@ BOOL cli_close(struct cli_state *cli, int fnum)
return !cli_is_error(cli);
}
+
+/****************************************************************************
+ send a lock with a specified locktype
+ this is used for testing LOCKING_ANDX_CANCEL_LOCK
+****************************************************************************/
+NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
+ uint32 offset, uint32 len, int timeout, unsigned char locktype)
+{
+ char *p;
+ int saved_timeout = cli->timeout;
+
+ memset(cli->outbuf,'\0',smb_size);
+ memset(cli->inbuf,'\0', smb_size);
+
+ 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,locktype);
+ 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*1000);
+ }
+
+ if (!cli_receive_smb(cli)) {
+ cli->timeout = saved_timeout;
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ cli->timeout = saved_timeout;
+
+ return cli_nt_error(cli);
+}
+
+
/****************************************************************************
Lock a file.
****************************************************************************/
@@ -746,6 +799,7 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
return True;
}
+
/****************************************************************************
Do a SMBgetattrE call.
****************************************************************************/