summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/libsmb/clifile.c26
2 files changed, 23 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ef5f60522b..38706b1d62 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -875,6 +875,9 @@ 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_create_full(struct cli_state *cli, char *fname, uint32 DesiredAccess,
+ uint32 FileAttributes, uint32 ShareAccess,
+ uint32 CreateDisposition, uint32 CreateOptions);
int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess);
int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode);
BOOL cli_close(struct cli_state *cli, int fnum);
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 79a168121b..bae07d34e6 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -167,9 +167,13 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname)
}
/****************************************************************************
-open a file
+ open a file - exposing the full horror of the NT API :-).
+ Used in smbtorture.
****************************************************************************/
-int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess)
+
+int cli_nt_create_full(struct cli_state *cli, char *fname, uint32 DesiredAccess,
+ uint32 FileAttributes, uint32 ShareAccess,
+ uint32 CreateDisposition, uint32 CreateOptions)
{
char *p;
int len;
@@ -190,10 +194,10 @@ int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess)
SIVAL(cli->outbuf,smb_ntcreate_Flags, 0);
SIVAL(cli->outbuf,smb_ntcreate_RootDirectoryFid, 0x0);
SIVAL(cli->outbuf,smb_ntcreate_DesiredAccess, DesiredAccess);
- SIVAL(cli->outbuf,smb_ntcreate_FileAttributes, 0x0);
- SIVAL(cli->outbuf,smb_ntcreate_ShareAccess, 0x03);
- SIVAL(cli->outbuf,smb_ntcreate_CreateDisposition, 0x01);
- SIVAL(cli->outbuf,smb_ntcreate_CreateOptions, 0x0);
+ SIVAL(cli->outbuf,smb_ntcreate_FileAttributes, FileAttributes);
+ SIVAL(cli->outbuf,smb_ntcreate_ShareAccess, ShareAccess);
+ SIVAL(cli->outbuf,smb_ntcreate_CreateDisposition, CreateDisposition);
+ SIVAL(cli->outbuf,smb_ntcreate_CreateOptions, CreateOptions);
SIVAL(cli->outbuf,smb_ntcreate_ImpersonationLevel, 0x02);
p = smb_buf(cli->outbuf);
@@ -221,6 +225,16 @@ int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess)
/****************************************************************************
open a file
+****************************************************************************/
+
+int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess)
+{
+ return cli_nt_create_full(cli, fname, DesiredAccess, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_EXISTS_OPEN, 0x0);
+}
+
+/****************************************************************************
+open a file
WARNING: if you open with O_WRONLY then getattrE won't work!
****************************************************************************/
int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode)