From 96a3ec51b40ff6d84d7194dcd5386884f00122bd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 5 Sep 2011 18:22:57 +0200 Subject: s3:smb2cli: don't terminate the pathname in smb2cli_create() Windows generates NT_STATUS_OBJECT_NAME_INVALID otherwise. metze --- source3/libsmb/smb2cli_create.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source3') 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), -- cgit