summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/libsmb/clifile.c41
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, &param_len,
+ &rdata, &data_len)) {
+ return False;
+ }
+
+ if (rdata) free(rdata);
+ if (rparam) free(rparam);
+
+ return True;
+}
+
+/****************************************************************************
}
/****************************************************************************