diff options
author | Jeremy Allison <jra@samba.org> | 2001-03-29 02:58:47 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-03-29 02:58:47 +0000 |
commit | 34508053bfeba53ec91f5dbf18874c5078e146c9 (patch) | |
tree | 8ead034d7ca9d716a3c5201e7617cd9ff9591d77 /source3 | |
parent | 1b95784324cd518d166cc790d9b1cf8a7905aed6 (diff) | |
download | samba-34508053bfeba53ec91f5dbf18874c5078e146c9.tar.gz samba-34508053bfeba53ec91f5dbf18874c5078e146c9.tar.bz2 samba-34508053bfeba53ec91f5dbf18874c5078e146c9.zip |
Added cli_nt_delete_on_close() call to allow flag to be set for torture tests.
Jeremy.
(This used to be commit 6f7d9e29e4d3a17254ff0ae20c0da63eacded7fe)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/libsmb/clifile.c | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 38706b1d62..9b6aab6645 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -875,6 +875,7 @@ BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst); BOOL cli_unlink(struct cli_state *cli, char *fname); BOOL cli_mkdir(struct cli_state *cli, char *dname); BOOL cli_rmdir(struct cli_state *cli, char *dname); +int cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag); int cli_nt_create_full(struct cli_state *cli, char *fname, uint32 DesiredAccess, uint32 FileAttributes, uint32 ShareAccess, uint32 CreateDisposition, uint32 CreateOptions); diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index bae07d34e6..e90bd7c41f 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -164,6 +164,47 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname) } return True; + Set or clear the delete on close flag. +****************************************************************************/ + +int cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag) +{ + int data_len = 1; + int param_len = 6; + uint16 setup = TRANSACT2_SETFILEINFO; + pstring param; + unsigned char data; + char *rparam=NULL, *rdata=NULL; + + memset(param, 0, param_len); + SSVAL(param,0,fnum); + SSVAL(param,2,SMB_SET_FILE_DISPOSITION_INFO); + + data = flag ? 1 : 0; + + if (!cli_send_trans(cli, SMBtrans2, + NULL, 0, /* name, length */ + -1, 0, /* fid, flags */ + &setup, 1, 0, /* setup, length, max */ + param, param_len, 2, /* param, length, max */ + &data, data_len, cli->max_xmit /* data, length, max */ + )) { + return False; + } + + if (!cli_receive_trans(cli, SMBtrans2, + &rparam, ¶m_len, + &rdata, &data_len)) { + return False; + } + + if (rdata) free(rdata); + if (rparam) free(rparam); + + return True; +} + +/**************************************************************************** } /**************************************************************************** |