summaryrefslogtreecommitdiffstats
path: root/source/libsmb
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-09 19:34:57 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-09 19:34:57 +0000
commitcaeb99201a1471bd709b4e8f07c57e5caabf0795 (patch)
tree4c3f64bc081ffdd07fcf2c76e62e919ddcc61f3d /source/libsmb
parent32d0f5e4a564686ad6b270dd24423ee49a81f223 (diff)
downloadsamba-caeb99201a1471bd709b4e8f07c57e5caabf0795.tar.gz
samba-caeb99201a1471bd709b4e8f07c57e5caabf0795.tar.xz
samba-caeb99201a1471bd709b4e8f07c57e5caabf0795.zip
basic client-side ntcreateX function (hard-wired values except filename)
Diffstat (limited to 'source/libsmb')
-rw-r--r--source/libsmb/clientgen.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 5ae84f763b9..8eb832128cd 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -976,6 +976,50 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname)
/****************************************************************************
open a file
****************************************************************************/
+int cli_nt_create(struct cli_state *cli, char *fname)
+{
+ char *p;
+
+ bzero(cli->outbuf,smb_size);
+ bzero(cli->inbuf,smb_size);
+
+ set_message(cli->outbuf,24,1 + strlen(fname),True);
+
+ CVAL(cli->outbuf,smb_com) = SMBntcreateX;
+ SSVAL(cli->outbuf,smb_tid,cli->cnum);
+ cli_setup_packet(cli);
+
+ SSVAL(cli->outbuf,smb_vwv0,0xFF);
+ SIVAL(cli->outbuf,smb_ntcreate_Flags, 0x06);
+ SIVAL(cli->outbuf,smb_ntcreate_RootDirectoryFid, 0x0);
+ SIVAL(cli->outbuf,smb_ntcreate_DesiredAccess, 0x2019f);
+ 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_ImpersonationLevel, 0x02);
+ SSVAL(cli->outbuf,smb_ntcreate_NameLength, strlen(fname));
+
+ p = smb_buf(cli->outbuf);
+ pstrcpy(p,fname);
+ p = skip_string(p,1);
+
+ send_smb(cli->fd,cli->outbuf);
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ return -1;
+ }
+
+ if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ return -1;
+ }
+
+ return SVAL(cli->inbuf,smb_vwv2 + 1);
+}
+
+
+/****************************************************************************
+open a file
+****************************************************************************/
int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode)
{
char *p;