summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2000-12-21 05:22:15 +0000
committerTim Potter <tpot@samba.org>2000-12-21 05:22:15 +0000
commit8fd4d9fab4195dcfcd13c455c3c2da665cbe8533 (patch)
tree82a0f109898b6a60c2eb70069614bb36a0438ab7 /source3/libsmb
parentb37ac378cff2b2cbc3266ca85ebd738694727526 (diff)
downloadsamba-8fd4d9fab4195dcfcd13c455c3c2da665cbe8533.tar.gz
samba-8fd4d9fab4195dcfcd13c455c3c2da665cbe8533.tar.bz2
samba-8fd4d9fab4195dcfcd13c455c3c2da665cbe8533.zip
Added a cli_nt_create_uni() to do a ntcreate&x with a unicode filename,
regardless of the settings negotiated in the flags2 smb field. (This used to be commit c4476c6315a6e99dd4a1d0e3185a0d17c073205d)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clifile.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index cb492f1539..ce9a79ede3 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -163,8 +163,6 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname)
return True;
}
-
-
/****************************************************************************
open a file
****************************************************************************/
@@ -212,6 +210,55 @@ int cli_nt_create(struct cli_state *cli, char *fname, uint32 DesiredAccess)
return SVAL(cli->inbuf,smb_vwv2 + 1);
}
+/****************************************************************************
+open a file
+****************************************************************************/
+int cli_nt_create_uni(struct cli_state *cli, char *fname, uint32 DesiredAccess)
+{
+ pstring uni;
+ char *p;
+
+ memset(cli->outbuf,'\0',smb_size);
+ memset(cli->inbuf,'\0',smb_size);
+
+ set_message(cli->outbuf,24,(strlen(fname) + 1) * 2 + 1,True);
+
+ CVAL(cli->outbuf,smb_com) = SMBntcreateX;
+ SSVAL(cli->outbuf,smb_tid,cli->cnum);
+ cli_setup_packet(cli);
+
+ SSVAL(cli->outbuf,smb_vwv0,0xFF);
+ if (cli->use_oplocks)
+ SIVAL(cli->outbuf,smb_ntcreate_Flags, REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK);
+ else
+ 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_ImpersonationLevel, 0x02);
+ SSVAL(cli->outbuf,smb_ntcreate_NameLength, strlen(fname) * 2);
+
+ p = smb_buf(cli->outbuf);
+ p++; /* Alignment */
+ pstrcpy(uni, fname);
+ unix_to_dos(uni, True);
+ dos_struni2(p, uni, (strlen(fname) + 1) * 2);
+
+ cli_send_smb(cli);
+ if (!cli_receive_smb(cli)) {
+ return -1;
+ }
+
+ if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ return -1;
+ }
+
+ return SVAL(cli->inbuf,smb_vwv2 + 1);
+}
+
/****************************************************************************
open a file