diff options
author | Luke Leighton <lkcl@samba.org> | 1998-10-09 19:34:57 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-10-09 19:34:57 +0000 |
commit | 4e004a0b5e7521a361444f6d67a3c2910c5688c2 (patch) | |
tree | adf7366300306ca62e405ad45441f3e0036a34f9 /source3/libsmb | |
parent | 755986764f5a6b0ec25c7f20fde0a80eb4d121ba (diff) | |
download | samba-4e004a0b5e7521a361444f6d67a3c2910c5688c2.tar.gz samba-4e004a0b5e7521a361444f6d67a3c2910c5688c2.tar.bz2 samba-4e004a0b5e7521a361444f6d67a3c2910c5688c2.zip |
basic client-side ntcreateX function (hard-wired values except filename)
(This used to be commit caeb99201a1471bd709b4e8f07c57e5caabf0795)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clientgen.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 5ae84f763b..8eb832128c 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/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; |