summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-05 18:22:57 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-07 08:33:41 +0200
commit96a3ec51b40ff6d84d7194dcd5386884f00122bd (patch)
treea1466f7ac8aca33a2733c7078c3d5f14877d8e11 /source3
parent817bb1f8f24bb86bcf675a9294169d5320512178 (diff)
downloadsamba-96a3ec51b40ff6d84d7194dcd5386884f00122bd.tar.gz
samba-96a3ec51b40ff6d84d7194dcd5386884f00122bd.tar.bz2
samba-96a3ec51b40ff6d84d7194dcd5386884f00122bd.zip
s3:smb2cli: don't terminate the pathname in smb2cli_create()
Windows generates NT_STATUS_OBJECT_NAME_INVALID otherwise. metze
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/smb2cli_create.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/libsmb/smb2cli_create.c b/source3/libsmb/smb2cli_create.c
index 50c9816ded..68bb98180e 100644
--- a/source3/libsmb/smb2cli_create.c
+++ b/source3/libsmb/smb2cli_create.c
@@ -77,12 +77,17 @@ struct tevent_req *smb2cli_create_send(
}
if (!convert_string_talloc(state, CH_UNIX, CH_UTF16,
- filename, strlen(filename)+1,
+ filename, strlen(filename),
&name_utf16, &name_utf16_len)) {
tevent_req_oom(req);
return tevent_req_post(req, ev);
}
+ if (strlen(filename) == 0) {
+ TALLOC_FREE(name_utf16);
+ name_utf16_len = 0;
+ }
+
fixed = state->fixed;
SSVAL(fixed, 0, 57);
@@ -118,8 +123,10 @@ struct tevent_req *smb2cli_create_send(
return tevent_req_post(req, ev);
}
- memcpy(dyn, name_utf16, name_utf16_len);
- TALLOC_FREE(name_utf16);
+ if (name_utf16) {
+ memcpy(dyn, name_utf16, name_utf16_len);
+ TALLOC_FREE(name_utf16);
+ }
if (blob.data != NULL) {
memcpy(dyn + blobs_offset - (SMB2_HDR_BODY + 56),