From 3e54c36fa459ec6f5e721b90ce4e4c1d0e31d85c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 09:11:51 +0000 Subject: r11674: SMB2 tree connect now works. We do 2 session setups and 2 tree connects, giving the following output: Running SMB2-CONNECT Negprot reply: current_time = Fri Nov 11 20:10:42 2005 EST boot_time = Sat Nov 12 10:34:33 2005 EST Session setup gave UID 0x40000000071 Session setup gave UID 0x140000000075 Tree connect gave tid = 0x7500000001 Tree connect gave tid = 0x7500000005 SMB2-CONNECT took 0.049024 secs (This used to be commit a24a4c311005dec4c5638e9c7c10e5e2f9872f4d) --- source4/libcli/smb2/request.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source4/libcli/smb2/request.c') diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 28e7018ecc..deadd1794f 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -204,3 +204,40 @@ NTSTATUS smb2_push_ofs_blob(struct smb2_request *req, uint8_t *ptr, DATA_BLOB bl memcpy(ptr+4, blob.data, blob.length); return NT_STATUS_OK; } + +/* + pull a string in a ofs/length/blob format +*/ +NTSTATUS smb2_pull_ofs_string(struct smb2_request *req, uint8_t *ptr, + const char **str) +{ + DATA_BLOB blob; + NTSTATUS status; + ssize_t size; + void *vstr; + status = smb2_pull_ofs_blob(req, ptr, &blob); + NT_STATUS_NOT_OK_RETURN(status); + size = convert_string_talloc(req, CH_UTF16, CH_UNIX, + blob.data, blob.length, &vstr); + data_blob_free(&blob); + (*str) = vstr; + if (size == -1) { + return NT_STATUS_ILLEGAL_CHARACTER; + } + return NT_STATUS_OK; +} + +/* + create a UTF16 string in a blob from a char* +*/ +NTSTATUS smb2_string_blob(TALLOC_CTX *mem_ctx, const char *str, DATA_BLOB *blob) +{ + ssize_t size; + size = convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16, + str, strlen(str), (void **)&blob->data); + if (size == -1) { + return NT_STATUS_ILLEGAL_CHARACTER; + } + blob->length = size; + return NT_STATUS_OK; +} -- cgit