2012-03-26 10:45:01 +04:00
|
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-03-26 20:20:38 +04:00
|
|
|
|
* RPC over HTTP
|
2012-03-26 10:45:01 +04:00
|
|
|
|
*
|
2012-03-26 20:20:38 +04:00
|
|
|
|
* Copyright 2012 Fujitsu Technology Solutions GmbH
|
|
|
|
|
* Copyright 2012 Dmitrij Jasnov <dmitrij.jasnov@ts.fujitsu.com>
|
2012-11-01 04:38:48 +04:00
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2012-03-26 10:45:01 +04:00
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-03-26 10:45:01 +04:00
|
|
|
|
#include "config.h"
|
2012-08-15 01:09:01 +04:00
|
|
|
|
#endif
|
|
|
|
|
|
2012-03-26 10:45:01 +04:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2012-09-09 00:45:06 +04:00
|
|
|
|
#include <winpr/crt.h>
|
2012-10-29 06:16:21 +04:00
|
|
|
|
#include <winpr/tchar.h>
|
2012-11-28 22:38:01 +04:00
|
|
|
|
#include <winpr/synch.h>
|
2012-10-29 04:55:19 +04:00
|
|
|
|
#include <winpr/dsparse.h>
|
2014-09-12 16:36:29 +04:00
|
|
|
|
|
2014-08-19 20:26:39 +04:00
|
|
|
|
#include <freerdp/log.h>
|
2012-10-29 04:55:19 +04:00
|
|
|
|
|
2012-03-26 10:45:01 +04:00
|
|
|
|
#include <openssl/rand.h>
|
2014-05-21 19:32:14 +04:00
|
|
|
|
#include <openssl/bio.h>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
|
|
|
|
#include <valgrind/memcheck.h>
|
|
|
|
|
#endif
|
2012-03-26 10:45:01 +04:00
|
|
|
|
|
2012-04-14 22:19:31 +04:00
|
|
|
|
#include "http.h"
|
2012-11-15 19:00:07 +04:00
|
|
|
|
#include "ntlm.h"
|
2012-11-28 07:03:05 +04:00
|
|
|
|
#include "ncacn_http.h"
|
2012-11-28 09:32:12 +04:00
|
|
|
|
#include "rpc_bind.h"
|
|
|
|
|
#include "rpc_fault.h"
|
2012-11-28 21:47:04 +04:00
|
|
|
|
#include "rpc_client.h"
|
2012-04-14 22:19:31 +04:00
|
|
|
|
|
|
|
|
|
#include "rpc.h"
|
2012-03-26 10:45:01 +04:00
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
|
#define TAG FREERDP_TAG("core.gateway.rpc")
|
|
|
|
|
|
2012-11-18 01:46:30 +04:00
|
|
|
|
/* Security Verification Trailer Signature */
|
|
|
|
|
|
|
|
|
|
rpc_sec_verification_trailer RPC_SEC_VERIFICATION_TRAILER =
|
2014-08-19 20:26:39 +04:00
|
|
|
|
{ { 0x8a, 0xe3, 0x13, 0x71, 0x02, 0xf4, 0x36, 0x71 } };
|
2012-11-18 01:46:30 +04:00
|
|
|
|
|
2012-10-30 21:01:54 +04:00
|
|
|
|
static char* PTYPE_STRINGS[] =
|
|
|
|
|
{
|
|
|
|
|
"PTYPE_REQUEST",
|
|
|
|
|
"PTYPE_PING",
|
|
|
|
|
"PTYPE_RESPONSE",
|
|
|
|
|
"PTYPE_FAULT",
|
|
|
|
|
"PTYPE_WORKING",
|
|
|
|
|
"PTYPE_NOCALL",
|
|
|
|
|
"PTYPE_REJECT",
|
|
|
|
|
"PTYPE_ACK",
|
|
|
|
|
"PTYPE_CL_CANCEL",
|
|
|
|
|
"PTYPE_FACK",
|
|
|
|
|
"PTYPE_CANCEL_ACK",
|
|
|
|
|
"PTYPE_BIND",
|
|
|
|
|
"PTYPE_BIND_ACK",
|
|
|
|
|
"PTYPE_BIND_NAK",
|
|
|
|
|
"PTYPE_ALTER_CONTEXT",
|
|
|
|
|
"PTYPE_ALTER_CONTEXT_RESP",
|
|
|
|
|
"PTYPE_RPC_AUTH_3",
|
|
|
|
|
"PTYPE_SHUTDOWN",
|
|
|
|
|
"PTYPE_CO_CANCEL",
|
|
|
|
|
"PTYPE_ORPHANED",
|
|
|
|
|
"PTYPE_RTS",
|
|
|
|
|
""
|
|
|
|
|
};
|
|
|
|
|
|
2012-11-28 09:32:12 +04:00
|
|
|
|
const RPC_SECURITY_PROVIDER_INFO RPC_SECURITY_PROVIDER_INFO_TABLE[] =
|
2012-10-31 18:52:04 +04:00
|
|
|
|
{
|
2012-11-28 09:32:12 +04:00
|
|
|
|
{ RPC_C_AUTHN_NONE, TRUE, -1 },
|
|
|
|
|
{ RPC_C_AUTHN_GSS_NEGOTIATE, TRUE, -1 },
|
|
|
|
|
{ RPC_C_AUTHN_WINNT, FALSE, 3 },
|
|
|
|
|
{ RPC_C_AUTHN_GSS_SCHANNEL, TRUE, -1 },
|
|
|
|
|
{ RPC_C_AUTHN_GSS_KERBEROS, TRUE, -1 },
|
|
|
|
|
{ RPC_C_AUTHN_DEFAULT, -1, -1 },
|
|
|
|
|
{ 0, -1, -1 }
|
2012-10-31 18:52:04 +04:00
|
|
|
|
};
|
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
void rpc_pdu_header_print(rpcconn_hdr_t* header)
|
2012-10-30 21:01:54 +04:00
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, "rpc_vers: %d", header->common.rpc_vers);
|
|
|
|
|
WLog_INFO(TAG, "rpc_vers_minor: %d", header->common.rpc_vers_minor);
|
2012-10-30 21:01:54 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.ptype > PTYPE_RTS)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, "ptype: %s (%d)", "PTYPE_UNKNOWN", header->common.ptype);
|
2012-10-30 21:01:54 +04:00
|
|
|
|
else
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, "ptype: %s (%d)", PTYPE_STRINGS[header->common.ptype], header->common.ptype);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, "pfc_flags (0x%02X) = {", header->common.pfc_flags);
|
2012-10-30 21:01:54 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_FIRST_FRAG)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_FIRST_FRAG");
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_LAST_FRAG)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_LAST_FRAG");
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_PENDING_CANCEL)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_PENDING_CANCEL");
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_RESERVED_1)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_RESERVED_1");
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_CONC_MPX)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_CONC_MPX");
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_DID_NOT_EXECUTE)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_DID_NOT_EXECUTE");
|
2012-10-30 21:01:54 +04:00
|
|
|
|
|
2014-08-19 20:26:39 +04:00
|
|
|
|
if (header->common.pfc_flags & PFC_OBJECT_UUID)
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " PFC_OBJECT_UUID");
|
2012-10-30 21:01:54 +04:00
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, " }");
|
|
|
|
|
WLog_INFO(TAG, "packed_drep[4]: %02X %02X %02X %02X",
|
|
|
|
|
header->common.packed_drep[0], header->common.packed_drep[1],
|
|
|
|
|
header->common.packed_drep[2], header->common.packed_drep[3]);
|
|
|
|
|
WLog_INFO(TAG, "frag_length: %d", header->common.frag_length);
|
|
|
|
|
WLog_INFO(TAG, "auth_length: %d", header->common.auth_length);
|
|
|
|
|
WLog_INFO(TAG, "call_id: %d", header->common.call_id);
|
2012-11-09 14:04:39 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
if (header->common.ptype == PTYPE_RESPONSE)
|
2012-11-09 14:04:39 +04:00
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_INFO(TAG, "alloc_hint: %d", header->response.alloc_hint);
|
|
|
|
|
WLog_INFO(TAG, "p_cont_id: %d", header->response.p_cont_id);
|
|
|
|
|
WLog_INFO(TAG, "cancel_count: %d", header->response.cancel_count);
|
|
|
|
|
WLog_INFO(TAG, "reserved: %d", header->response.reserved);
|
2012-11-09 14:04:39 +04:00
|
|
|
|
}
|
2012-10-30 21:01:54 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
void rpc_pdu_header_init(rdpRpc* rpc, rpcconn_hdr_t* header)
|
2012-10-30 00:41:20 +04:00
|
|
|
|
{
|
2012-11-16 01:25:22 +04:00
|
|
|
|
header->common.rpc_vers = rpc->rpc_vers;
|
|
|
|
|
header->common.rpc_vers_minor = rpc->rpc_vers_minor;
|
|
|
|
|
header->common.packed_drep[0] = rpc->packed_drep[0];
|
|
|
|
|
header->common.packed_drep[1] = rpc->packed_drep[1];
|
|
|
|
|
header->common.packed_drep[2] = rpc->packed_drep[2];
|
|
|
|
|
header->common.packed_drep[3] = rpc->packed_drep[3];
|
2012-10-30 00:41:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-30 02:46:32 +04:00
|
|
|
|
UINT32 rpc_offset_align(UINT32* offset, UINT32 alignment)
|
|
|
|
|
{
|
|
|
|
|
UINT32 pad;
|
|
|
|
|
pad = *offset;
|
|
|
|
|
*offset = (*offset + alignment - 1) & ~(alignment - 1);
|
|
|
|
|
pad = *offset - pad;
|
|
|
|
|
return pad;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UINT32 rpc_offset_pad(UINT32* offset, UINT32 pad)
|
|
|
|
|
{
|
|
|
|
|
*offset += pad;
|
|
|
|
|
return pad;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-08 02:41:12 +04:00
|
|
|
|
/**
|
|
|
|
|
* PDU Segments:
|
|
|
|
|
* ________________________________
|
|
|
|
|
* | |
|
|
|
|
|
* | PDU Header |
|
|
|
|
|
* |________________________________|
|
|
|
|
|
* | |
|
|
|
|
|
* | |
|
|
|
|
|
* | PDU Body |
|
|
|
|
|
* | |
|
|
|
|
|
* |________________________________|
|
|
|
|
|
* | |
|
|
|
|
|
* | Security Trailer |
|
|
|
|
|
* |________________________________|
|
|
|
|
|
* | |
|
|
|
|
|
* | Authentication Token |
|
|
|
|
|
* |________________________________|
|
|
|
|
|
*/
|
|
|
|
|
|
2012-11-18 01:46:30 +04:00
|
|
|
|
/**
|
|
|
|
|
* PDU Structure with verification trailer
|
|
|
|
|
*
|
|
|
|
|
* MUST only appear in a request PDU!
|
|
|
|
|
* ________________________________
|
|
|
|
|
* | |
|
|
|
|
|
* | PDU Header |
|
|
|
|
|
* |________________________________| _______
|
|
|
|
|
* | | /|\
|
|
|
|
|
* | | |
|
|
|
|
|
* | Stub Data | |
|
|
|
|
|
* | | |
|
|
|
|
|
* |________________________________| |
|
|
|
|
|
* | | PDU Body
|
|
|
|
|
* | Stub Pad | |
|
|
|
|
|
* |________________________________| |
|
|
|
|
|
* | | |
|
|
|
|
|
* | Verification Trailer | |
|
|
|
|
|
* |________________________________| |
|
|
|
|
|
* | | |
|
|
|
|
|
* | Authentication Pad | |
|
|
|
|
|
* |________________________________| __\|/__
|
|
|
|
|
* | |
|
|
|
|
|
* | Security Trailer |
|
|
|
|
|
* |________________________________|
|
|
|
|
|
* | |
|
|
|
|
|
* | Authentication Token |
|
|
|
|
|
* |________________________________|
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2012-12-08 02:41:12 +04:00
|
|
|
|
/**
|
|
|
|
|
* Security Trailer:
|
|
|
|
|
*
|
|
|
|
|
* The sec_trailer structure MUST be placed at the end of the PDU, including past stub data,
|
|
|
|
|
* when present. The sec_trailer structure MUST be 4-byte aligned with respect to the beginning
|
|
|
|
|
* of the PDU. Padding octets MUST be used to align the sec_trailer structure if its natural
|
|
|
|
|
* beginning is not already 4-byte aligned.
|
|
|
|
|
*
|
|
|
|
|
* All PDUs that carry sec_trailer information share certain common fields:
|
|
|
|
|
* frag_length and auth_length. The beginning of the sec_trailer structure for each PDU MUST be
|
|
|
|
|
* calculated to start from offset (frag_length – auth_length – 8) from the beginning of the PDU.
|
|
|
|
|
*
|
|
|
|
|
* Immediately after the sec_trailer structure, there MUST be a BLOB carrying the authentication
|
|
|
|
|
* information produced by the security provider. This BLOB is called the authentication token and
|
|
|
|
|
* MUST be of size auth_length. The size MUST also be equal to the length from the first octet
|
|
|
|
|
* immediately after the sec_trailer structure all the way to the end of the fragment;
|
|
|
|
|
* the two values MUST be the same.
|
|
|
|
|
*
|
|
|
|
|
* A client or a server that (during composing of a PDU) has allocated more space for the
|
|
|
|
|
* authentication token than the security provider fills in SHOULD fill in the rest of
|
|
|
|
|
* the allocated space with zero octets. These zero octets are still considered to belong
|
|
|
|
|
* to the authentication token part of the PDU.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
BOOL rpc_get_stub_data_info(rdpRpc* rpc, BYTE* buffer, UINT32* offset, UINT32* length)
|
2012-11-15 04:51:45 +04:00
|
|
|
|
{
|
2012-11-15 08:06:56 +04:00
|
|
|
|
UINT32 alloc_hint = 0;
|
2012-11-16 01:25:22 +04:00
|
|
|
|
rpcconn_hdr_t* header;
|
2014-05-21 19:32:14 +04:00
|
|
|
|
UINT32 frag_length;
|
|
|
|
|
UINT32 auth_length;
|
|
|
|
|
UINT32 auth_pad_length;
|
|
|
|
|
UINT32 sec_trailer_offset;
|
|
|
|
|
rpc_sec_trailer* sec_trailer;
|
2012-11-15 04:51:45 +04:00
|
|
|
|
*offset = RPC_COMMON_FIELDS_LENGTH;
|
2012-11-16 01:25:22 +04:00
|
|
|
|
header = ((rpcconn_hdr_t*) buffer);
|
2012-11-15 04:51:45 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
switch (header->common.ptype)
|
2012-11-15 04:51:45 +04:00
|
|
|
|
{
|
2014-05-21 19:32:14 +04:00
|
|
|
|
case PTYPE_RESPONSE:
|
|
|
|
|
*offset += 8;
|
|
|
|
|
rpc_offset_align(offset, 8);
|
|
|
|
|
alloc_hint = header->response.alloc_hint;
|
|
|
|
|
break;
|
|
|
|
|
case PTYPE_REQUEST:
|
|
|
|
|
*offset += 4;
|
|
|
|
|
rpc_offset_align(offset, 8);
|
|
|
|
|
alloc_hint = header->request.alloc_hint;
|
|
|
|
|
break;
|
|
|
|
|
case PTYPE_RTS:
|
|
|
|
|
*offset += 4;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "unknown ptype=0x%x", header->common.ptype);
|
2014-05-21 19:32:14 +04:00
|
|
|
|
return FALSE;
|
2012-11-15 04:51:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (!length)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
if (header->common.ptype == PTYPE_REQUEST)
|
2012-11-15 04:51:45 +04:00
|
|
|
|
{
|
2014-05-21 19:32:14 +04:00
|
|
|
|
UINT32 sec_trailer_offset;
|
|
|
|
|
sec_trailer_offset = header->common.frag_length - header->common.auth_length - 8;
|
|
|
|
|
*length = sec_trailer_offset - *offset;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2012-11-15 12:08:30 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
frag_length = header->common.frag_length;
|
|
|
|
|
auth_length = header->common.auth_length;
|
|
|
|
|
sec_trailer_offset = frag_length - auth_length - 8;
|
|
|
|
|
sec_trailer = (rpc_sec_trailer*) &buffer[sec_trailer_offset];
|
|
|
|
|
auth_pad_length = sec_trailer->auth_pad_length;
|
2012-12-08 02:41:12 +04:00
|
|
|
|
#if 0
|
2014-09-15 21:51:37 +04:00
|
|
|
|
WLog_DBG(TAG, "sec_trailer: type: %d level: %d pad_length: %d reserved: %d context_id: %d",
|
2014-09-12 16:36:29 +04:00
|
|
|
|
sec_trailer->auth_type,
|
|
|
|
|
sec_trailer->auth_level,
|
|
|
|
|
sec_trailer->auth_pad_length,
|
|
|
|
|
sec_trailer->auth_reserved,
|
|
|
|
|
sec_trailer->auth_context_id);
|
2012-12-08 02:41:12 +04:00
|
|
|
|
#endif
|
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
/**
|
|
|
|
|
* According to [MS-RPCE], auth_pad_length is the number of padding
|
|
|
|
|
* octets used to 4-byte align the security trailer, but in practice
|
|
|
|
|
* we get values up to 15, which indicates 16-byte alignment.
|
|
|
|
|
*/
|
2012-12-08 02:41:12 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if ((frag_length - (sec_trailer_offset + 8)) != auth_length)
|
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "invalid auth_length: actual: %d, expected: %d", auth_length,
|
|
|
|
|
(frag_length - (sec_trailer_offset + 8)));
|
2012-11-15 04:51:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
*length = frag_length - auth_length - 24 - 8 - auth_pad_length;
|
2012-11-15 04:51:45 +04:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-17 12:45:15 +04:00
|
|
|
|
int rpc_out_read(rdpRpc* rpc, BYTE* data, int length)
|
|
|
|
|
{
|
|
|
|
|
int status;
|
2014-05-21 19:32:14 +04:00
|
|
|
|
status = BIO_read(rpc->TlsOut->bio, data, length);
|
2014-06-02 05:37:20 +04:00
|
|
|
|
|
2014-08-19 20:26:39 +04:00
|
|
|
|
if (status > 0)
|
|
|
|
|
{
|
2014-05-21 19:32:14 +04:00
|
|
|
|
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
|
|
|
|
VALGRIND_MAKE_MEM_DEFINED(data, status);
|
|
|
|
|
#endif
|
|
|
|
|
return status;
|
|
|
|
|
}
|
2012-11-17 12:45:15 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (BIO_should_retry(rpc->TlsOut->bio))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return -1;
|
2012-11-17 12:45:15 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
int rpc_out_write(rdpRpc* rpc, const BYTE* data, int length)
|
2012-11-17 12:45:15 +04:00
|
|
|
|
{
|
|
|
|
|
int status;
|
|
|
|
|
status = tls_write_all(rpc->TlsOut, data, length);
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
int rpc_in_write(rdpRpc* rpc, const BYTE* data, int length)
|
2012-11-17 12:45:15 +04:00
|
|
|
|
{
|
|
|
|
|
int status;
|
2012-11-23 00:32:21 +04:00
|
|
|
|
#ifdef WITH_DEBUG_TSG
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_DBG(TAG, "Sending PDU (length: %d)", length);
|
2013-03-14 20:57:45 +04:00
|
|
|
|
rpc_pdu_header_print((rpcconn_hdr_t*) data);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
winpr_HexDump(TAG, WLOG_DEBUG, data, length);
|
2012-11-23 00:32:21 +04:00
|
|
|
|
#endif
|
2012-11-17 12:45:15 +04:00
|
|
|
|
status = tls_write_all(rpc->TlsIn, data, length);
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-29 05:30:03 +04:00
|
|
|
|
int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
2012-03-26 10:45:01 +04:00
|
|
|
|
{
|
2012-10-30 02:46:32 +04:00
|
|
|
|
BYTE* buffer;
|
|
|
|
|
UINT32 offset;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
rdpNtlm* ntlm;
|
2012-10-30 02:46:32 +04:00
|
|
|
|
UINT32 stub_data_pad;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
SecBuffer Buffers[2];
|
|
|
|
|
SecBufferDesc Message;
|
2012-12-12 09:49:15 +04:00
|
|
|
|
RpcClientCall* clientCall;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
SECURITY_STATUS encrypt_status;
|
2012-03-28 21:14:18 +04:00
|
|
|
|
rpcconn_request_hdr_t* request_pdu;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
ntlm = rpc->ntlm;
|
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (!ntlm || !ntlm->table)
|
2013-12-06 02:31:33 +04:00
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "invalid ntlm context");
|
2013-12-06 02:31:33 +04:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-30 02:46:32 +04:00
|
|
|
|
if (ntlm->table->QueryContextAttributes(&ntlm->context, SECPKG_ATTR_SIZES, &ntlm->ContextSizes) != SEC_E_OK)
|
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "QueryContextAttributes SECPKG_ATTR_SIZES failure");
|
2012-10-30 02:46:32 +04:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2012-03-26 10:45:01 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
request_pdu = (rpcconn_request_hdr_t*) calloc(1, sizeof(rpcconn_request_hdr_t));
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (!request_pdu)
|
|
|
|
|
return -1;
|
2012-10-30 00:41:20 +04:00
|
|
|
|
|
2012-11-16 01:25:22 +04:00
|
|
|
|
rpc_pdu_header_init(rpc, (rpcconn_hdr_t*) request_pdu);
|
2012-10-29 23:02:35 +04:00
|
|
|
|
request_pdu->ptype = PTYPE_REQUEST;
|
2012-03-26 10:45:01 +04:00
|
|
|
|
request_pdu->pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG;
|
2014-02-11 07:12:13 +04:00
|
|
|
|
request_pdu->auth_length = (UINT16) ntlm->ContextSizes.cbMaxSignature;
|
2012-12-12 08:34:51 +04:00
|
|
|
|
request_pdu->call_id = rpc->CallId++;
|
2012-03-26 10:45:01 +04:00
|
|
|
|
request_pdu->alloc_hint = length;
|
|
|
|
|
request_pdu->p_cont_id = 0x0000;
|
|
|
|
|
request_pdu->opnum = opnum;
|
2012-12-12 09:49:15 +04:00
|
|
|
|
clientCall = rpc_client_call_new(request_pdu->call_id, request_pdu->opnum);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (!clientCall)
|
|
|
|
|
goto out_free_pdu;
|
|
|
|
|
|
|
|
|
|
if (ArrayList_Add(rpc->client->ClientCallList, clientCall) < 0)
|
|
|
|
|
goto out_free_clientCall;
|
2012-12-08 06:09:55 +04:00
|
|
|
|
|
|
|
|
|
if (request_pdu->opnum == TsProxySetupReceivePipeOpnum)
|
|
|
|
|
rpc->PipeCallId = request_pdu->call_id;
|
|
|
|
|
|
2012-10-31 17:22:32 +04:00
|
|
|
|
request_pdu->stub_data = data;
|
2012-10-30 02:46:32 +04:00
|
|
|
|
offset = 24;
|
2012-10-31 17:22:32 +04:00
|
|
|
|
stub_data_pad = 0;
|
2012-10-30 02:46:32 +04:00
|
|
|
|
stub_data_pad = rpc_offset_align(&offset, 8);
|
2012-10-31 17:22:32 +04:00
|
|
|
|
offset += length;
|
2012-10-30 02:46:32 +04:00
|
|
|
|
request_pdu->auth_verifier.auth_pad_length = rpc_offset_align(&offset, 4);
|
2012-11-01 04:38:48 +04:00
|
|
|
|
request_pdu->auth_verifier.auth_type = RPC_C_AUTHN_WINNT;
|
|
|
|
|
request_pdu->auth_verifier.auth_level = RPC_C_AUTHN_LEVEL_PKT_INTEGRITY;
|
2012-10-29 23:02:35 +04:00
|
|
|
|
request_pdu->auth_verifier.auth_reserved = 0x00;
|
|
|
|
|
request_pdu->auth_verifier.auth_context_id = 0x00000000;
|
2012-10-30 02:46:32 +04:00
|
|
|
|
offset += (8 + request_pdu->auth_length);
|
|
|
|
|
request_pdu->frag_length = offset;
|
2014-05-21 19:32:14 +04:00
|
|
|
|
buffer = (BYTE*) calloc(1, request_pdu->frag_length);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (!buffer)
|
|
|
|
|
goto out_free_pdu;
|
2012-03-26 10:45:01 +04:00
|
|
|
|
|
2014-08-19 20:26:39 +04:00
|
|
|
|
CopyMemory(buffer, request_pdu, 24);
|
2012-10-30 02:46:32 +04:00
|
|
|
|
offset = 24;
|
|
|
|
|
rpc_offset_pad(&offset, stub_data_pad);
|
|
|
|
|
CopyMemory(&buffer[offset], request_pdu->stub_data, length);
|
|
|
|
|
offset += length;
|
|
|
|
|
rpc_offset_pad(&offset, request_pdu->auth_verifier.auth_pad_length);
|
|
|
|
|
CopyMemory(&buffer[offset], &request_pdu->auth_verifier.auth_type, 8);
|
|
|
|
|
offset += 8;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
Buffers[0].BufferType = SECBUFFER_DATA; /* auth_data */
|
|
|
|
|
Buffers[1].BufferType = SECBUFFER_TOKEN; /* signature */
|
2012-10-30 02:46:32 +04:00
|
|
|
|
Buffers[0].pvBuffer = buffer;
|
|
|
|
|
Buffers[0].cbBuffer = offset;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
Buffers[1].cbBuffer = ntlm->ContextSizes.cbMaxSignature;
|
2014-05-21 19:32:14 +04:00
|
|
|
|
Buffers[1].pvBuffer = calloc(1, Buffers[1].cbBuffer);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (!Buffers[1].pvBuffer)
|
|
|
|
|
return -1;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
|
|
|
|
|
Message.cBuffers = 2;
|
|
|
|
|
Message.ulVersion = SECBUFFER_VERSION;
|
|
|
|
|
Message.pBuffers = (PSecBuffer) &Buffers;
|
2012-12-12 08:34:51 +04:00
|
|
|
|
encrypt_status = ntlm->table->EncryptMessage(&ntlm->context, 0, &Message, rpc->SendSeqNum++);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2012-04-22 04:16:48 +04:00
|
|
|
|
if (encrypt_status != SEC_E_OK)
|
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "EncryptMessage status: 0x%08X", encrypt_status);
|
2013-08-28 18:26:11 +04:00
|
|
|
|
free(request_pdu);
|
2012-10-30 02:46:32 +04:00
|
|
|
|
return -1;
|
2012-04-22 04:16:48 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-30 02:46:32 +04:00
|
|
|
|
CopyMemory(&buffer[offset], Buffers[1].pvBuffer, Buffers[1].cbBuffer);
|
|
|
|
|
offset += Buffers[1].cbBuffer;
|
2012-12-12 09:49:15 +04:00
|
|
|
|
free(Buffers[1].pvBuffer);
|
2012-03-26 10:45:01 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (rpc_send_enqueue_pdu(rpc, buffer, request_pdu->frag_length) < 0)
|
2013-12-21 02:56:59 +04:00
|
|
|
|
length = -1;
|
|
|
|
|
|
2012-12-12 08:34:51 +04:00
|
|
|
|
free(request_pdu);
|
|
|
|
|
return length;
|
2014-05-21 19:32:14 +04:00
|
|
|
|
out_free_clientCall:
|
|
|
|
|
rpc_client_call_free(clientCall);
|
|
|
|
|
out_free_pdu:
|
|
|
|
|
free(request_pdu);
|
|
|
|
|
return -1;
|
2012-11-29 10:33:19 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
|
BOOL rpc_connect(rdpRpc* rpc)
|
2012-03-26 10:45:01 +04:00
|
|
|
|
{
|
2012-11-15 19:00:07 +04:00
|
|
|
|
rpc->TlsIn = rpc->transport->TlsIn;
|
|
|
|
|
rpc->TlsOut = rpc->transport->TlsOut;
|
2012-04-24 00:33:18 +04:00
|
|
|
|
|
2012-04-22 00:18:07 +04:00
|
|
|
|
if (!rts_connect(rpc))
|
2012-04-21 21:45:25 +04:00
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "rts_connect error!");
|
2012-10-09 10:31:28 +04:00
|
|
|
|
return FALSE;
|
2012-04-21 21:45:25 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-28 09:32:12 +04:00
|
|
|
|
rpc->State = RPC_CLIENT_STATE_ESTABLISHED;
|
2012-03-26 10:45:01 +04:00
|
|
|
|
|
2012-11-28 09:32:12 +04:00
|
|
|
|
if (rpc_secure_bind(rpc) != 0)
|
2012-03-26 10:45:01 +04:00
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
|
WLog_ERR(TAG, "rpc_secure_bind error!");
|
2012-10-09 10:31:28 +04:00
|
|
|
|
return FALSE;
|
2012-03-26 10:45:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
|
return TRUE;
|
2012-03-26 10:45:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-17 03:30:53 +04:00
|
|
|
|
void rpc_client_virtual_connection_init(rdpRpc* rpc, RpcVirtualConnection* connection)
|
2012-04-21 21:28:20 +04:00
|
|
|
|
{
|
2012-11-17 03:30:53 +04:00
|
|
|
|
connection->DefaultInChannel->State = CLIENT_IN_CHANNEL_STATE_INITIAL;
|
|
|
|
|
connection->DefaultInChannel->BytesSent = 0;
|
|
|
|
|
connection->DefaultInChannel->SenderAvailableWindow = rpc->ReceiveWindow;
|
|
|
|
|
connection->DefaultInChannel->PingOriginator.ConnectionTimeout = 30;
|
|
|
|
|
connection->DefaultInChannel->PingOriginator.KeepAliveInterval = 0;
|
2012-11-29 05:30:03 +04:00
|
|
|
|
connection->DefaultInChannel->Mutex = CreateMutex(NULL, FALSE, NULL);
|
2012-11-17 03:30:53 +04:00
|
|
|
|
connection->DefaultOutChannel->State = CLIENT_OUT_CHANNEL_STATE_INITIAL;
|
|
|
|
|
connection->DefaultOutChannel->BytesReceived = 0;
|
|
|
|
|
connection->DefaultOutChannel->ReceiverAvailableWindow = rpc->ReceiveWindow;
|
|
|
|
|
connection->DefaultOutChannel->ReceiveWindow = rpc->ReceiveWindow;
|
|
|
|
|
connection->DefaultOutChannel->ReceiveWindowSize = rpc->ReceiveWindow;
|
2012-11-17 06:17:04 +04:00
|
|
|
|
connection->DefaultOutChannel->AvailableWindowAdvertised = rpc->ReceiveWindow;
|
2012-11-29 05:30:03 +04:00
|
|
|
|
connection->DefaultOutChannel->Mutex = CreateMutex(NULL, FALSE, NULL);
|
2012-04-21 21:28:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RpcVirtualConnection* rpc_client_virtual_connection_new(rdpRpc* rpc)
|
|
|
|
|
{
|
2014-04-10 23:07:53 +04:00
|
|
|
|
RpcVirtualConnection* connection = (RpcVirtualConnection*) calloc(1, sizeof(RpcVirtualConnection));
|
2012-04-21 21:28:20 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!connection)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
connection->State = VIRTUAL_CONNECTION_STATE_INITIAL;
|
2014-08-19 20:26:39 +04:00
|
|
|
|
connection->DefaultInChannel = (RpcInChannel*)calloc(1, sizeof(RpcInChannel));
|
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!connection->DefaultInChannel)
|
|
|
|
|
goto out_free;
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
connection->DefaultOutChannel = (RpcOutChannel*)calloc(1, sizeof(RpcOutChannel));
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!connection->DefaultOutChannel)
|
|
|
|
|
goto out_default_in;
|
2012-04-21 21:28:20 +04:00
|
|
|
|
|
2014-08-19 20:26:39 +04:00
|
|
|
|
rpc_client_virtual_connection_init(rpc, connection);
|
2012-11-16 20:25:10 +04:00
|
|
|
|
return connection;
|
2014-04-10 23:07:53 +04:00
|
|
|
|
out_default_in:
|
|
|
|
|
free(connection->DefaultInChannel);
|
|
|
|
|
out_free:
|
|
|
|
|
free(connection);
|
|
|
|
|
return NULL;
|
2012-04-21 21:28:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rpc_client_virtual_connection_free(RpcVirtualConnection* virtual_connection)
|
|
|
|
|
{
|
|
|
|
|
if (virtual_connection != NULL)
|
|
|
|
|
{
|
2012-12-12 09:49:15 +04:00
|
|
|
|
free(virtual_connection->DefaultInChannel);
|
|
|
|
|
free(virtual_connection->DefaultOutChannel);
|
2012-10-09 07:21:26 +04:00
|
|
|
|
free(virtual_connection);
|
2012-04-21 21:28:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 00:33:18 +04:00
|
|
|
|
rdpRpc* rpc_new(rdpTransport* transport)
|
|
|
|
|
{
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rdpRpc* rpc = (rdpRpc*) calloc(1, sizeof(rdpRpc));
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!rpc)
|
|
|
|
|
return NULL;
|
2012-04-24 00:33:18 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc->State = RPC_CLIENT_STATE_INITIAL;
|
|
|
|
|
rpc->transport = transport;
|
|
|
|
|
rpc->settings = transport->settings;
|
|
|
|
|
rpc->SendSeqNum = 0;
|
|
|
|
|
rpc->ntlm = ntlm_new();
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!rpc->ntlm)
|
|
|
|
|
goto out_free;
|
2012-04-24 00:33:18 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc->NtlmHttpIn = ntlm_http_new();
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!rpc->NtlmHttpIn)
|
|
|
|
|
goto out_free_ntlm;
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc->NtlmHttpOut = ntlm_http_new();
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!rpc->NtlmHttpOut)
|
|
|
|
|
goto out_free_ntlm_http_in;
|
2012-04-24 00:33:18 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc_ntlm_http_init_channel(rpc, rpc->NtlmHttpIn, TSG_CHANNEL_IN);
|
|
|
|
|
rpc_ntlm_http_init_channel(rpc, rpc->NtlmHttpOut, TSG_CHANNEL_OUT);
|
|
|
|
|
rpc->PipeCallId = 0;
|
|
|
|
|
rpc->StubCallId = 0;
|
|
|
|
|
rpc->StubFragCount = 0;
|
|
|
|
|
rpc->rpc_vers = 5;
|
|
|
|
|
rpc->rpc_vers_minor = 0;
|
|
|
|
|
/* little-endian data representation */
|
|
|
|
|
rpc->packed_drep[0] = 0x10;
|
|
|
|
|
rpc->packed_drep[1] = 0x00;
|
|
|
|
|
rpc->packed_drep[2] = 0x00;
|
|
|
|
|
rpc->packed_drep[3] = 0x00;
|
|
|
|
|
rpc->max_xmit_frag = 0x0FF8;
|
|
|
|
|
rpc->max_recv_frag = 0x0FF8;
|
|
|
|
|
rpc->ReceiveWindow = 0x00010000;
|
|
|
|
|
rpc->ChannelLifetime = 0x40000000;
|
|
|
|
|
rpc->ChannelLifetimeSet = 0;
|
|
|
|
|
rpc->KeepAliveInterval = 300000;
|
|
|
|
|
rpc->CurrentKeepAliveInterval = rpc->KeepAliveInterval;
|
|
|
|
|
rpc->CurrentKeepAliveTime = 0;
|
|
|
|
|
rpc->VirtualConnection = rpc_client_virtual_connection_new(rpc);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!rpc->VirtualConnection)
|
|
|
|
|
goto out_free_ntlm_http_out;
|
2012-11-16 20:25:10 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc->VirtualConnectionCookieTable = ArrayList_New(TRUE);
|
2014-08-19 20:26:39 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
if (!rpc->VirtualConnectionCookieTable)
|
|
|
|
|
goto out_free_virtual_connection;
|
2012-03-27 07:20:25 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc->CallId = 2;
|
2012-11-28 22:38:01 +04:00
|
|
|
|
|
2014-05-21 19:32:14 +04:00
|
|
|
|
if (rpc_client_new(rpc) < 0)
|
|
|
|
|
goto out_free_virtualConnectionCookieTable;
|
2012-11-29 05:30:03 +04:00
|
|
|
|
|
2014-04-10 23:07:53 +04:00
|
|
|
|
rpc->client->SynchronousSend = TRUE;
|
|
|
|
|
rpc->client->SynchronousReceive = TRUE;
|
2012-04-18 09:53:12 +04:00
|
|
|
|
return rpc;
|
2014-05-21 19:32:14 +04:00
|
|
|
|
out_free_virtualConnectionCookieTable:
|
|
|
|
|
rpc_client_free(rpc);
|
|
|
|
|
ArrayList_Free(rpc->VirtualConnectionCookieTable);
|
2014-04-10 23:07:53 +04:00
|
|
|
|
out_free_virtual_connection:
|
|
|
|
|
rpc_client_virtual_connection_free(rpc->VirtualConnection);
|
|
|
|
|
out_free_ntlm_http_out:
|
|
|
|
|
ntlm_http_free(rpc->NtlmHttpOut);
|
|
|
|
|
out_free_ntlm_http_in:
|
|
|
|
|
ntlm_http_free(rpc->NtlmHttpIn);
|
|
|
|
|
out_free_ntlm:
|
|
|
|
|
ntlm_free(rpc->ntlm);
|
|
|
|
|
out_free:
|
|
|
|
|
free(rpc);
|
|
|
|
|
return NULL;
|
2012-03-27 07:20:25 +04:00
|
|
|
|
}
|
2012-04-24 00:33:18 +04:00
|
|
|
|
|
|
|
|
|
void rpc_free(rdpRpc* rpc)
|
|
|
|
|
{
|
|
|
|
|
if (rpc != NULL)
|
|
|
|
|
{
|
2012-12-13 05:02:56 +04:00
|
|
|
|
rpc_client_stop(rpc);
|
|
|
|
|
|
|
|
|
|
if (rpc->State >= RPC_CLIENT_STATE_CONTEXT_NEGOTIATED)
|
|
|
|
|
{
|
|
|
|
|
ntlm_client_uninit(rpc->ntlm);
|
|
|
|
|
ntlm_free(rpc->ntlm);
|
|
|
|
|
}
|
2012-12-12 09:49:15 +04:00
|
|
|
|
|
2012-04-24 00:33:18 +04:00
|
|
|
|
rpc_client_virtual_connection_free(rpc->VirtualConnection);
|
2012-12-12 08:34:51 +04:00
|
|
|
|
ArrayList_Clear(rpc->VirtualConnectionCookieTable);
|
|
|
|
|
ArrayList_Free(rpc->VirtualConnectionCookieTable);
|
2012-10-09 07:21:26 +04:00
|
|
|
|
free(rpc);
|
2012-04-24 00:33:18 +04:00
|
|
|
|
}
|
|
|
|
|
}
|