s3:smb2cli: don't terminate the pathname in smb2cli_tcon()
authorStefan Metzmacher <metze@samba.org>
Mon, 5 Sep 2011 16:22:57 +0000 (18:22 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 7 Sep 2011 06:33:40 +0000 (08:33 +0200)
Windows generates NT_STATUS_BAD_NETWORK_NAME otherwise.

metze

source3/libsmb/smb2cli_tcon.c

index c51418227da9b7c4c084728813192841d6746006..8c2c802bddfde24a41d5471f4490abd28095b5a7 100644 (file)
@@ -60,12 +60,17 @@ struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
        if (!convert_string_talloc(state, CH_UNIX, CH_UTF16,
-                                  tcon_share, talloc_get_size(tcon_share),
+                                  tcon_share, strlen(tcon_share),
                                   &dyn, &dyn_len)) {
                tevent_req_oom(req);
                return tevent_req_post(req, ev);
        }
 
+       if (strlen(tcon_share) == 0) {
+               TALLOC_FREE(dyn);
+               dyn_len = 0;
+       }
+
        fixed = state->fixed;
        SSVAL(fixed, 0, 9);
        SSVAL(fixed, 4, SMB2_HDR_BODY + 8);