Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
/*
|
|
|
|
* RPC binding API
|
|
|
|
*
|
2008-10-18 19:20:44 +02:00
|
|
|
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
2004-01-21 00:36:50 +01:00
|
|
|
* Copyright 2003 Mike Hearn
|
2004-04-27 01:33:39 +02:00
|
|
|
* Copyright 2004 Filip Navara
|
2006-05-19 12:03:06 +02:00
|
|
|
* Copyright 2006 CodeWeavers
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2002-11-06 22:58:21 +01:00
|
|
|
#include <assert.h>
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
#include "winerror.h"
|
2004-01-21 00:36:50 +01:00
|
|
|
#include "winternl.h"
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
|
|
|
|
#include "rpc.h"
|
2004-04-27 01:33:39 +02:00
|
|
|
#include "rpcndr.h"
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "rpc_binding.h"
|
2007-12-16 13:11:49 +01:00
|
|
|
#include "rpc_assoc.h"
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2005-03-14 11:11:04 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2003-10-08 00:54:17 +02:00
|
|
|
LPSTR RPCRT4_strndupA(LPCSTR src, INT slen)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
DWORD len;
|
|
|
|
LPSTR s;
|
|
|
|
if (!src) return NULL;
|
|
|
|
if (slen == -1) slen = strlen(src);
|
|
|
|
len = slen;
|
|
|
|
s = HeapAlloc(GetProcessHeap(), 0, len+1);
|
|
|
|
memcpy(s, src, len);
|
|
|
|
s[len] = 0;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2007-01-25 11:24:00 +01:00
|
|
|
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
DWORD len;
|
|
|
|
LPSTR s;
|
|
|
|
if (!src) return NULL;
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
|
|
|
|
s = HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, src, -1, s, len, NULL, NULL);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2007-01-25 11:24:00 +01:00
|
|
|
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
DWORD len;
|
|
|
|
LPWSTR s;
|
|
|
|
if (!src) return NULL;
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
|
|
|
|
s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, src, -1, s, len);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2007-06-25 15:27:17 +02:00
|
|
|
static LPWSTR RPCRT4_strndupAtoW(LPCSTR src, INT slen)
|
|
|
|
{
|
|
|
|
DWORD len;
|
|
|
|
LPWSTR s;
|
|
|
|
if (!src) return NULL;
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, src, slen, NULL, 0);
|
|
|
|
s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, src, slen, s, len);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2007-01-25 11:23:11 +01:00
|
|
|
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
DWORD len;
|
|
|
|
LPWSTR s;
|
|
|
|
if (!src) return NULL;
|
|
|
|
if (slen == -1) slen = strlenW(src);
|
|
|
|
len = slen;
|
|
|
|
s = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
|
|
|
|
memcpy(s, src, len*sizeof(WCHAR));
|
|
|
|
s[len] = 0;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RPCRT4_strfree(LPSTR src)
|
|
|
|
{
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, src);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
|
2005-07-24 19:11:59 +02:00
|
|
|
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding** Binding, BOOL server)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RpcBinding* NewBinding;
|
|
|
|
|
|
|
|
NewBinding = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcBinding));
|
|
|
|
NewBinding->refs = 1;
|
|
|
|
NewBinding->server = server;
|
2003-02-19 04:44:35 +01:00
|
|
|
|
|
|
|
*Binding = NewBinding;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
static RPC_STATUS RPCRT4_CreateBindingA(RpcBinding** Binding, BOOL server, LPCSTR Protseq)
|
2003-02-19 04:44:35 +01:00
|
|
|
{
|
|
|
|
RpcBinding* NewBinding;
|
|
|
|
|
|
|
|
RPCRT4_AllocBinding(&NewBinding, server);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
NewBinding->Protseq = RPCRT4_strdupA(Protseq);
|
|
|
|
|
|
|
|
TRACE("binding: %p\n", NewBinding);
|
|
|
|
*Binding = NewBinding;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
static RPC_STATUS RPCRT4_CreateBindingW(RpcBinding** Binding, BOOL server, LPCWSTR Protseq)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RpcBinding* NewBinding;
|
|
|
|
|
2003-02-19 04:44:35 +01:00
|
|
|
RPCRT4_AllocBinding(&NewBinding, server);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
NewBinding->Protseq = RPCRT4_strdupWtoA(Protseq);
|
|
|
|
|
|
|
|
TRACE("binding: %p\n", NewBinding);
|
|
|
|
*Binding = NewBinding;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
static RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPCSTR NetworkAddr,
|
|
|
|
LPCSTR Endpoint, LPCSTR NetworkOptions)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2007-03-26 19:13:49 +02:00
|
|
|
RPC_STATUS status;
|
|
|
|
|
2006-11-05 20:01:42 +01:00
|
|
|
TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
|
2003-02-19 04:44:35 +01:00
|
|
|
debugstr_a(NetworkAddr), debugstr_a(Endpoint), debugstr_a(NetworkOptions));
|
2002-10-18 05:56:56 +02:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
RPCRT4_strfree(Binding->NetworkAddr);
|
|
|
|
Binding->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
|
|
|
|
RPCRT4_strfree(Binding->Endpoint);
|
2008-08-18 22:13:41 +02:00
|
|
|
Binding->Endpoint = RPCRT4_strdupA(Endpoint);
|
2007-01-25 11:23:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
|
|
|
|
Binding->NetworkOptions = RPCRT4_strdupAtoW(NetworkOptions);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2008-08-18 22:13:41 +02:00
|
|
|
/* only attempt to get an association if the binding is complete */
|
|
|
|
if (Endpoint && Endpoint[0] != '\0')
|
|
|
|
{
|
|
|
|
status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
|
|
|
|
Binding->Endpoint, Binding->NetworkOptions,
|
|
|
|
&Binding->Assoc);
|
|
|
|
if (status != RPC_S_OK)
|
|
|
|
return status;
|
|
|
|
}
|
2007-03-26 19:13:49 +02:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
static RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPCWSTR NetworkAddr,
|
|
|
|
LPCWSTR Endpoint, LPCWSTR NetworkOptions)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2007-03-26 19:13:49 +02:00
|
|
|
RPC_STATUS status;
|
|
|
|
|
2006-11-05 20:01:42 +01:00
|
|
|
TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
|
2002-10-18 05:56:56 +02:00
|
|
|
debugstr_w(NetworkAddr), debugstr_w(Endpoint), debugstr_w(NetworkOptions));
|
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
RPCRT4_strfree(Binding->NetworkAddr);
|
|
|
|
Binding->NetworkAddr = RPCRT4_strdupWtoA(NetworkAddr);
|
|
|
|
RPCRT4_strfree(Binding->Endpoint);
|
2008-08-18 22:13:41 +02:00
|
|
|
Binding->Endpoint = RPCRT4_strdupWtoA(Endpoint);
|
2007-01-25 11:23:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
|
|
|
|
Binding->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2008-08-18 22:13:41 +02:00
|
|
|
/* only attempt to get an association if the binding is complete */
|
|
|
|
if (Endpoint && Endpoint[0] != '\0')
|
|
|
|
{
|
|
|
|
status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
|
|
|
|
Binding->Endpoint, Binding->NetworkOptions,
|
|
|
|
&Binding->Assoc);
|
|
|
|
if (status != RPC_S_OK)
|
|
|
|
return status;
|
|
|
|
}
|
2007-03-26 19:13:49 +02:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2007-03-26 19:13:49 +02:00
|
|
|
RPC_STATUS status;
|
|
|
|
|
2003-01-31 04:22:38 +01:00
|
|
|
TRACE("(RpcBinding == ^%p, EndPoint == \"%s\"\n", Binding, Endpoint);
|
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
RPCRT4_strfree(Binding->Endpoint);
|
|
|
|
Binding->Endpoint = RPCRT4_strdupA(Endpoint);
|
|
|
|
|
2008-08-18 22:12:41 +02:00
|
|
|
if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
|
2007-03-26 19:13:49 +02:00
|
|
|
Binding->Assoc = NULL;
|
|
|
|
status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
|
|
|
|
Binding->Endpoint, Binding->NetworkOptions,
|
|
|
|
&Binding->Assoc);
|
|
|
|
if (status != RPC_S_OK)
|
|
|
|
return status;
|
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2002-11-06 22:58:21 +01:00
|
|
|
TRACE("(*RpcBinding == ^%p, UUID == %s)\n", Binding, debugstr_guid(ObjectUuid));
|
2008-03-13 21:52:48 +01:00
|
|
|
if (ObjectUuid) Binding->ObjectUuid = *ObjectUuid;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
else UuidCreateNil(&Binding->ObjectUuid);
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2003-02-19 04:44:35 +01:00
|
|
|
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RpcBinding* NewBinding;
|
2005-02-15 21:45:37 +01:00
|
|
|
TRACE("(RpcBinding == ^%p, Connection == ^%p)\n", Binding, Connection);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2003-02-19 04:44:35 +01:00
|
|
|
RPCRT4_AllocBinding(&NewBinding, Connection->server);
|
2006-04-20 14:00:28 +02:00
|
|
|
NewBinding->Protseq = RPCRT4_strdupA(rpcrt4_conn_get_name(Connection));
|
2003-02-19 04:44:35 +01:00
|
|
|
NewBinding->NetworkAddr = RPCRT4_strdupA(Connection->NetworkAddr);
|
|
|
|
NewBinding->Endpoint = RPCRT4_strdupA(Connection->Endpoint);
|
|
|
|
NewBinding->FromConn = Connection;
|
|
|
|
|
|
|
|
TRACE("binding: %p\n", NewBinding);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*Binding = NewBinding;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2008-04-01 13:48:15 +02:00
|
|
|
void RPCRT4_AddRefBinding(RpcBinding* Binding)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2008-04-01 13:48:15 +02:00
|
|
|
InterlockedIncrement(&Binding->refs);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
|
2008-04-01 13:48:15 +02:00
|
|
|
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
if (InterlockedDecrement(&Binding->refs))
|
|
|
|
return RPC_S_OK;
|
|
|
|
|
|
|
|
TRACE("binding: %p\n", Binding);
|
2007-03-26 19:13:49 +02:00
|
|
|
if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
RPCRT4_strfree(Binding->Endpoint);
|
|
|
|
RPCRT4_strfree(Binding->NetworkAddr);
|
|
|
|
RPCRT4_strfree(Binding->Protseq);
|
2007-01-25 11:23:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
|
2007-01-19 13:59:35 +01:00
|
|
|
if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo);
|
|
|
|
if (Binding->QOS) RpcQualityOfService_Release(Binding->QOS);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, Binding);
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2004-04-27 01:33:39 +02:00
|
|
|
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
|
2007-08-17 23:10:58 +02:00
|
|
|
const RPC_SYNTAX_IDENTIFIER *TransferSyntax,
|
|
|
|
const RPC_SYNTAX_IDENTIFIER *InterfaceId)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2002-10-28 21:07:01 +01:00
|
|
|
TRACE("(Binding == ^%p)\n", Binding);
|
2003-02-19 04:44:35 +01:00
|
|
|
|
2006-06-07 21:12:34 +02:00
|
|
|
if (!Binding->server) {
|
2007-07-12 16:32:43 +02:00
|
|
|
return RpcAssoc_GetClientConnection(Binding->Assoc, InterfaceId,
|
|
|
|
TransferSyntax, Binding->AuthInfo, Binding->QOS, Connection);
|
2004-04-27 01:33:39 +02:00
|
|
|
} else {
|
2005-03-30 19:08:31 +02:00
|
|
|
/* we already have a connection with acceptable binding, so use it */
|
2004-04-27 01:33:39 +02:00
|
|
|
if (Binding->FromConn) {
|
|
|
|
*Connection = Binding->FromConn;
|
|
|
|
return RPC_S_OK;
|
2007-07-12 16:32:43 +02:00
|
|
|
} else {
|
|
|
|
ERR("no connection in binding\n");
|
|
|
|
return RPC_S_INTERNAL_ERROR;
|
2004-04-27 01:33:39 +02:00
|
|
|
}
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
|
2003-02-19 04:44:35 +01:00
|
|
|
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2002-11-06 22:58:21 +01:00
|
|
|
TRACE("(Binding == ^%p)\n", Binding);
|
2003-02-19 04:44:35 +01:00
|
|
|
if (!Connection) return RPC_S_OK;
|
2006-06-07 21:12:34 +02:00
|
|
|
if (Binding->server) {
|
|
|
|
/* don't destroy a connection that is cached in the binding */
|
|
|
|
if (Binding->FromConn == Connection)
|
|
|
|
return RPC_S_OK;
|
|
|
|
return RPCRT4_DestroyConnection(Connection);
|
|
|
|
}
|
|
|
|
else {
|
2007-03-26 19:13:49 +02:00
|
|
|
RpcAssoc_ReleaseIdleConnection(Binding->Assoc, Connection);
|
2006-06-07 21:12:34 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static LPSTR RPCRT4_strconcatA(LPSTR dst, LPCSTR src)
|
|
|
|
{
|
|
|
|
DWORD len = strlen(dst), slen = strlen(src);
|
|
|
|
LPSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(CHAR));
|
2003-11-21 00:42:38 +01:00
|
|
|
if (!ndst)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, dst);
|
|
|
|
return NULL;
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
ndst[len] = ',';
|
2003-11-21 00:42:38 +01:00
|
|
|
memcpy(ndst+len+1, src, slen+1);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return ndst;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LPWSTR RPCRT4_strconcatW(LPWSTR dst, LPCWSTR src)
|
|
|
|
{
|
|
|
|
DWORD len = strlenW(dst), slen = strlenW(src);
|
|
|
|
LPWSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(WCHAR));
|
2003-11-21 00:42:38 +01:00
|
|
|
if (!ndst)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, dst);
|
|
|
|
return NULL;
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
ndst[len] = ',';
|
2003-11-21 00:42:38 +01:00
|
|
|
memcpy(ndst+len+1, src, (slen+1)*sizeof(WCHAR));
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return ndst;
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
/* Copies the escaped version of a component into a string binding.
|
|
|
|
* Note: doesn't nul-terminate the string */
|
|
|
|
static RPC_CSTR escape_string_binding_component(RPC_CSTR string_binding,
|
|
|
|
const unsigned char *component)
|
|
|
|
{
|
|
|
|
for (; *component; component++) {
|
|
|
|
switch (*component) {
|
|
|
|
case '@':
|
|
|
|
case ':':
|
|
|
|
case '[':
|
|
|
|
case ']':
|
|
|
|
case '\\':
|
|
|
|
*string_binding++ = '\\';
|
|
|
|
*string_binding++ = *component;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*string_binding++ = *component;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return string_binding;
|
|
|
|
}
|
|
|
|
|
|
|
|
static RPC_WSTR escape_string_binding_componentW(RPC_WSTR string_binding,
|
|
|
|
const WCHAR *component)
|
|
|
|
{
|
|
|
|
for (; *component; component++) {
|
|
|
|
switch (*component) {
|
|
|
|
case '@':
|
|
|
|
case ':':
|
|
|
|
case '[':
|
|
|
|
case ']':
|
|
|
|
case '\\':
|
|
|
|
*string_binding++ = '\\';
|
|
|
|
*string_binding++ = *component;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*string_binding++ = *component;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return string_binding;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const unsigned char *string_binding_find_delimiter(
|
|
|
|
const unsigned char *string_binding, unsigned char delim)
|
|
|
|
{
|
|
|
|
const unsigned char *next;
|
|
|
|
for (next = string_binding; *next; next++) {
|
|
|
|
if (*next == '\\') {
|
|
|
|
next++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (*next == delim)
|
|
|
|
return next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const WCHAR *string_binding_find_delimiterW(
|
|
|
|
const WCHAR *string_binding, WCHAR delim)
|
|
|
|
{
|
|
|
|
const WCHAR *next;
|
|
|
|
for (next = string_binding; *next; next++) {
|
|
|
|
if (*next == '\\') {
|
|
|
|
next++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (*next == delim)
|
|
|
|
return next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static RPC_CSTR unescape_string_binding_component(
|
|
|
|
const unsigned char *string_binding, int len)
|
|
|
|
{
|
|
|
|
RPC_CSTR component, p;
|
|
|
|
|
|
|
|
if (len == -1) len = strlen((const char *)string_binding);
|
|
|
|
|
|
|
|
component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
|
|
|
|
if (!component) return NULL;
|
|
|
|
for (p = component; len > 0; string_binding++, len--) {
|
|
|
|
if (*string_binding == '\\') {
|
|
|
|
string_binding++;
|
|
|
|
len--;
|
|
|
|
*p++ = *string_binding;
|
|
|
|
} else {
|
|
|
|
*p++ = *string_binding;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*p = '\0';
|
|
|
|
return component;
|
|
|
|
}
|
|
|
|
|
|
|
|
static RPC_WSTR unescape_string_binding_componentW(
|
|
|
|
const WCHAR *string_binding, int len)
|
|
|
|
{
|
|
|
|
RPC_WSTR component, p;
|
|
|
|
|
2008-09-05 23:08:42 +02:00
|
|
|
if (len == -1) len = strlenW(string_binding);
|
2008-08-14 10:15:20 +02:00
|
|
|
|
|
|
|
component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
|
|
|
|
if (!component) return NULL;
|
|
|
|
for (p = component; len > 0; string_binding++, len--) {
|
|
|
|
if (*string_binding == '\\') {
|
|
|
|
string_binding++;
|
|
|
|
len--;
|
|
|
|
*p++ = *string_binding;
|
|
|
|
} else {
|
|
|
|
*p++ = *string_binding;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*p = '\0';
|
|
|
|
return component;
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcStringBindingComposeA (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq,
|
|
|
|
RPC_CSTR NetworkAddr, RPC_CSTR Endpoint,
|
|
|
|
RPC_CSTR Options, RPC_CSTR *StringBinding )
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
DWORD len = 1;
|
2008-08-14 10:15:20 +02:00
|
|
|
RPC_CSTR data;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE( "(%s,%s,%s,%s,%s,%p)\n",
|
2005-09-06 12:26:13 +02:00
|
|
|
debugstr_a( (char*)ObjUuid ), debugstr_a( (char*)Protseq ),
|
|
|
|
debugstr_a( (char*)NetworkAddr ), debugstr_a( (char*)Endpoint ),
|
|
|
|
debugstr_a( (char*)Options ), StringBinding );
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
/* overestimate for each component for escaping of delimiters */
|
|
|
|
if (ObjUuid && *ObjUuid) len += strlen((char*)ObjUuid) * 2 + 1;
|
|
|
|
if (Protseq && *Protseq) len += strlen((char*)Protseq) * 2 + 1;
|
|
|
|
if (NetworkAddr && *NetworkAddr) len += strlen((char*)NetworkAddr) * 2;
|
|
|
|
if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) * 2 + 2;
|
|
|
|
if (Options && *Options) len += strlen((char*)Options) * 2 + 2;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
data = HeapAlloc(GetProcessHeap(), 0, len);
|
2008-08-14 10:15:20 +02:00
|
|
|
*StringBinding = data;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
if (ObjUuid && *ObjUuid) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_component(data, ObjUuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*data++ = '@';
|
|
|
|
}
|
|
|
|
if (Protseq && *Protseq) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_component(data, Protseq);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*data++ = ':';
|
|
|
|
}
|
2002-10-24 01:36:24 +02:00
|
|
|
if (NetworkAddr && *NetworkAddr)
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_component(data, NetworkAddr);
|
2002-10-24 01:36:24 +02:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if ((Endpoint && *Endpoint) ||
|
|
|
|
(Options && *Options)) {
|
|
|
|
*data++ = '[';
|
|
|
|
if (Endpoint && *Endpoint) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_component(data, Endpoint);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (Options && *Options) *data++ = ',';
|
|
|
|
}
|
|
|
|
if (Options && *Options) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_component(data, Options);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
*data++ = ']';
|
|
|
|
}
|
|
|
|
*data = 0;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcStringBindingComposeW (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcStringBindingComposeW( RPC_WSTR ObjUuid, RPC_WSTR Protseq,
|
|
|
|
RPC_WSTR NetworkAddr, RPC_WSTR Endpoint,
|
|
|
|
RPC_WSTR Options, RPC_WSTR* StringBinding )
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
DWORD len = 1;
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_WSTR data;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE("(%s,%s,%s,%s,%s,%p)\n",
|
|
|
|
debugstr_w( ObjUuid ), debugstr_w( Protseq ),
|
|
|
|
debugstr_w( NetworkAddr ), debugstr_w( Endpoint ),
|
|
|
|
debugstr_w( Options ), StringBinding);
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
/* overestimate for each component for escaping of delimiters */
|
|
|
|
if (ObjUuid && *ObjUuid) len += strlenW(ObjUuid) * 2 + 1;
|
|
|
|
if (Protseq && *Protseq) len += strlenW(Protseq) * 2 + 1;
|
|
|
|
if (NetworkAddr && *NetworkAddr) len += strlenW(NetworkAddr) * 2;
|
|
|
|
if (Endpoint && *Endpoint) len += strlenW(Endpoint) * 2 + 2;
|
|
|
|
if (Options && *Options) len += strlenW(Options) * 2 + 2;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
data = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
*StringBinding = data;
|
|
|
|
|
|
|
|
if (ObjUuid && *ObjUuid) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_componentW(data, ObjUuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*data++ = '@';
|
|
|
|
}
|
|
|
|
if (Protseq && *Protseq) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_componentW(data, Protseq);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
*data++ = ':';
|
|
|
|
}
|
|
|
|
if (NetworkAddr && *NetworkAddr) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_componentW(data, NetworkAddr);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
if ((Endpoint && *Endpoint) ||
|
|
|
|
(Options && *Options)) {
|
|
|
|
*data++ = '[';
|
|
|
|
if (Endpoint && *Endpoint) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_componentW(data, Endpoint);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (Options && *Options) *data++ = ',';
|
|
|
|
}
|
|
|
|
if (Options && *Options) {
|
2008-08-14 10:15:20 +02:00
|
|
|
data = escape_string_binding_componentW(data, Options);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
*data++ = ']';
|
|
|
|
}
|
|
|
|
*data = 0;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcStringBindingParseA (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcStringBindingParseA( RPC_CSTR StringBinding, RPC_CSTR *ObjUuid,
|
|
|
|
RPC_CSTR *Protseq, RPC_CSTR *NetworkAddr,
|
|
|
|
RPC_CSTR *Endpoint, RPC_CSTR *Options)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2008-08-14 10:15:20 +02:00
|
|
|
const unsigned char *data, *next;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
static const char ep_opt[] = "endpoint=";
|
2008-02-27 20:02:54 +01:00
|
|
|
BOOL endpoint_already_found = FALSE;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2005-09-06 12:26:13 +02:00
|
|
|
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a((char*)StringBinding),
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
|
|
|
|
|
|
|
|
if (ObjUuid) *ObjUuid = NULL;
|
|
|
|
if (Protseq) *Protseq = NULL;
|
|
|
|
if (NetworkAddr) *NetworkAddr = NULL;
|
|
|
|
if (Endpoint) *Endpoint = NULL;
|
|
|
|
if (Options) *Options = NULL;
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
data = StringBinding;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiter(data, '@');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (next) {
|
2008-07-31 09:19:32 +02:00
|
|
|
UUID uuid;
|
|
|
|
RPC_STATUS status;
|
2008-08-14 10:15:20 +02:00
|
|
|
RPC_CSTR str_uuid = unescape_string_binding_component(data, next - data);
|
2008-07-31 09:19:32 +02:00
|
|
|
status = UuidFromStringA(str_uuid, &uuid);
|
|
|
|
if (status != RPC_S_OK) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, str_uuid);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
if (ObjUuid)
|
|
|
|
*ObjUuid = str_uuid;
|
|
|
|
else
|
|
|
|
HeapFree(GetProcessHeap(), 0, str_uuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiter(data, ':');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (next) {
|
2008-08-14 10:15:20 +02:00
|
|
|
if (Protseq) *Protseq = unescape_string_binding_component(data, next - data);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiter(data, '[');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (next) {
|
2008-08-14 10:15:20 +02:00
|
|
|
const unsigned char *close;
|
|
|
|
RPC_CSTR opt;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
if (NetworkAddr) *NetworkAddr = unescape_string_binding_component(data, next - data);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
2008-08-14 10:15:20 +02:00
|
|
|
close = string_binding_find_delimiter(data, ']');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (!close) goto fail;
|
|
|
|
|
|
|
|
/* tokenize options */
|
|
|
|
while (data < close) {
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiter(data, ',');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (!next || next > close) next = close;
|
|
|
|
/* FIXME: this is kind of inefficient */
|
2008-08-14 10:15:20 +02:00
|
|
|
opt = unescape_string_binding_component(data, next - data);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
|
|
|
|
|
|
|
/* parse option */
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiter(opt, '=');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (!next) {
|
2002-10-24 01:36:24 +02:00
|
|
|
/* not an option, must be an endpoint */
|
2008-02-27 20:02:54 +01:00
|
|
|
if (endpoint_already_found) goto fail;
|
2008-08-14 10:15:20 +02:00
|
|
|
if (Endpoint) *Endpoint = opt;
|
2008-02-27 20:02:54 +01:00
|
|
|
else HeapFree(GetProcessHeap(), 0, opt);
|
|
|
|
endpoint_already_found = TRUE;
|
2002-10-24 01:36:24 +02:00
|
|
|
} else {
|
2008-08-14 10:15:20 +02:00
|
|
|
if (strncmp((const char *)opt, ep_opt, strlen(ep_opt)) == 0) {
|
2002-10-24 01:36:24 +02:00
|
|
|
/* endpoint option */
|
2008-02-27 20:02:54 +01:00
|
|
|
if (endpoint_already_found) goto fail;
|
2008-08-14 10:15:20 +02:00
|
|
|
if (Endpoint) *Endpoint = unescape_string_binding_component(next+1, -1);
|
2002-10-24 01:36:24 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, opt);
|
2008-02-27 20:02:54 +01:00
|
|
|
endpoint_already_found = TRUE;
|
2002-10-24 01:36:24 +02:00
|
|
|
} else {
|
|
|
|
/* network option */
|
2008-02-27 20:02:54 +01:00
|
|
|
if (Options) {
|
|
|
|
if (*Options) {
|
|
|
|
/* FIXME: this is kind of inefficient */
|
2008-08-14 10:15:20 +02:00
|
|
|
*Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, (char *)opt);
|
2008-02-27 20:02:54 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, opt);
|
|
|
|
} else
|
2008-08-14 10:15:20 +02:00
|
|
|
*Options = opt;
|
2008-02-27 20:02:54 +01:00
|
|
|
} else
|
2002-10-24 01:36:24 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, opt);
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data = close+1;
|
|
|
|
if (*data) goto fail;
|
|
|
|
}
|
2002-10-24 01:36:24 +02:00
|
|
|
else if (NetworkAddr)
|
2008-08-14 10:15:20 +02:00
|
|
|
*NetworkAddr = unescape_string_binding_component(data, -1);
|
2002-10-24 01:36:24 +02:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
|
|
|
|
fail:
|
2009-02-16 09:54:10 +01:00
|
|
|
if (ObjUuid) RpcStringFreeA(ObjUuid);
|
|
|
|
if (Protseq) RpcStringFreeA(Protseq);
|
|
|
|
if (NetworkAddr) RpcStringFreeA(NetworkAddr);
|
|
|
|
if (Endpoint) RpcStringFreeA(Endpoint);
|
|
|
|
if (Options) RpcStringFreeA(Options);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_INVALID_STRING_BINDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcStringBindingParseW (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjUuid,
|
|
|
|
RPC_WSTR *Protseq, RPC_WSTR *NetworkAddr,
|
|
|
|
RPC_WSTR *Endpoint, RPC_WSTR *Options)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2008-08-14 10:15:20 +02:00
|
|
|
const WCHAR *data, *next;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
static const WCHAR ep_opt[] = {'e','n','d','p','o','i','n','t','=',0};
|
2008-02-27 20:02:54 +01:00
|
|
|
BOOL endpoint_already_found = FALSE;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_w(StringBinding),
|
|
|
|
ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
|
|
|
|
|
|
|
|
if (ObjUuid) *ObjUuid = NULL;
|
|
|
|
if (Protseq) *Protseq = NULL;
|
|
|
|
if (NetworkAddr) *NetworkAddr = NULL;
|
|
|
|
if (Endpoint) *Endpoint = NULL;
|
|
|
|
if (Options) *Options = NULL;
|
|
|
|
|
|
|
|
data = StringBinding;
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiterW(data, '@');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (next) {
|
2008-07-31 09:19:32 +02:00
|
|
|
UUID uuid;
|
|
|
|
RPC_STATUS status;
|
2008-08-14 10:15:20 +02:00
|
|
|
RPC_WSTR str_uuid = unescape_string_binding_componentW(data, next - data);
|
2008-07-31 09:19:32 +02:00
|
|
|
status = UuidFromStringW(str_uuid, &uuid);
|
|
|
|
if (status != RPC_S_OK) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, str_uuid);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
if (ObjUuid)
|
|
|
|
*ObjUuid = str_uuid;
|
|
|
|
else
|
|
|
|
HeapFree(GetProcessHeap(), 0, str_uuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiterW(data, ':');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (next) {
|
2008-08-14 10:15:20 +02:00
|
|
|
if (Protseq) *Protseq = unescape_string_binding_componentW(data, next - data);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiterW(data, '[');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (next) {
|
2008-08-14 10:15:20 +02:00
|
|
|
const WCHAR *close;
|
|
|
|
RPC_WSTR opt;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2008-08-14 10:15:20 +02:00
|
|
|
if (NetworkAddr) *NetworkAddr = unescape_string_binding_componentW(data, next - data);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
2008-08-14 10:15:20 +02:00
|
|
|
close = string_binding_find_delimiterW(data, ']');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (!close) goto fail;
|
|
|
|
|
|
|
|
/* tokenize options */
|
|
|
|
while (data < close) {
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiterW(data, ',');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (!next || next > close) next = close;
|
|
|
|
/* FIXME: this is kind of inefficient */
|
2008-08-14 10:15:20 +02:00
|
|
|
opt = unescape_string_binding_componentW(data, next - data);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
data = next+1;
|
|
|
|
|
|
|
|
/* parse option */
|
2008-08-14 10:15:20 +02:00
|
|
|
next = string_binding_find_delimiterW(opt, '=');
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (!next) {
|
2002-10-24 01:36:24 +02:00
|
|
|
/* not an option, must be an endpoint */
|
2008-02-27 20:02:54 +01:00
|
|
|
if (endpoint_already_found) goto fail;
|
|
|
|
if (Endpoint) *Endpoint = opt;
|
|
|
|
else HeapFree(GetProcessHeap(), 0, opt);
|
|
|
|
endpoint_already_found = TRUE;
|
2002-10-24 01:36:24 +02:00
|
|
|
} else {
|
|
|
|
if (strncmpW(opt, ep_opt, strlenW(ep_opt)) == 0) {
|
|
|
|
/* endpoint option */
|
2008-02-27 20:02:54 +01:00
|
|
|
if (endpoint_already_found) goto fail;
|
2008-08-14 10:15:20 +02:00
|
|
|
if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
|
2002-10-24 01:36:24 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, opt);
|
2008-02-27 20:02:54 +01:00
|
|
|
endpoint_already_found = TRUE;
|
2002-10-24 01:36:24 +02:00
|
|
|
} else {
|
|
|
|
/* network option */
|
2008-02-27 20:02:54 +01:00
|
|
|
if (Options) {
|
|
|
|
if (*Options) {
|
|
|
|
/* FIXME: this is kind of inefficient */
|
|
|
|
*Options = RPCRT4_strconcatW(*Options, opt);
|
|
|
|
HeapFree(GetProcessHeap(), 0, opt);
|
|
|
|
} else
|
|
|
|
*Options = opt;
|
|
|
|
} else
|
2002-10-24 01:36:24 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, opt);
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data = close+1;
|
|
|
|
if (*data) goto fail;
|
2002-10-24 01:36:24 +02:00
|
|
|
} else if (NetworkAddr)
|
2008-08-14 10:15:20 +02:00
|
|
|
*NetworkAddr = unescape_string_binding_componentW(data, -1);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
return RPC_S_OK;
|
2002-10-24 01:36:24 +02:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
fail:
|
|
|
|
if (ObjUuid) RpcStringFreeW(ObjUuid);
|
|
|
|
if (Protseq) RpcStringFreeW(Protseq);
|
|
|
|
if (NetworkAddr) RpcStringFreeW(NetworkAddr);
|
|
|
|
if (Endpoint) RpcStringFreeW(Endpoint);
|
|
|
|
if (Options) RpcStringFreeW(Options);
|
|
|
|
return RPC_S_INVALID_STRING_BINDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingFree (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcBindingFree( RPC_BINDING_HANDLE* Binding )
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
TRACE("(%p) = %p\n", Binding, *Binding);
|
2008-04-01 13:48:15 +02:00
|
|
|
status = RPCRT4_ReleaseBinding(*Binding);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (status == RPC_S_OK) *Binding = 0;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingVectorFree (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector )
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
2009-07-03 13:42:57 +02:00
|
|
|
ULONG c;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", BindingVector);
|
|
|
|
for (c=0; c<(*BindingVector)->Count; c++) {
|
|
|
|
status = RpcBindingFree(&(*BindingVector)->BindingH[c]);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, *BindingVector);
|
|
|
|
*BindingVector = NULL;
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingInqObject (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcBindingInqObject( RPC_BINDING_HANDLE Binding, UUID* ObjectUuid )
|
|
|
|
{
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding* bind = Binding;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%p) = %s\n", Binding, ObjectUuid, debugstr_guid(&bind->ObjectUuid));
|
2008-03-13 21:52:48 +01:00
|
|
|
*ObjectUuid = bind->ObjectUuid;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
2008-03-13 21:52:48 +01:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingSetObject (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcBindingSetObject( RPC_BINDING_HANDLE Binding, UUID* ObjectUuid )
|
|
|
|
{
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding* bind = Binding;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%s)\n", Binding, debugstr_guid(ObjectUuid));
|
|
|
|
if (bind->server) return RPC_S_WRONG_KIND_OF_BINDING;
|
|
|
|
return RPCRT4_SetBindingObject(Binding, ObjectUuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingFromStringBindingA (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcBindingFromStringBindingA( RPC_CSTR StringBinding, RPC_BINDING_HANDLE* Binding )
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RPC_STATUS ret;
|
|
|
|
RpcBinding* bind = NULL;
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_CSTR ObjectUuid, Protseq, NetworkAddr, Endpoint, Options;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
UUID Uuid;
|
|
|
|
|
2005-09-06 12:26:13 +02:00
|
|
|
TRACE("(%s,%p)\n", debugstr_a((char*)StringBinding), Binding);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq,
|
|
|
|
&NetworkAddr, &Endpoint, &Options);
|
|
|
|
if (ret != RPC_S_OK) return ret;
|
|
|
|
|
|
|
|
ret = UuidFromStringA(ObjectUuid, &Uuid);
|
|
|
|
|
|
|
|
if (ret == RPC_S_OK)
|
2005-09-06 12:26:13 +02:00
|
|
|
ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq);
|
2008-04-16 08:37:26 +02:00
|
|
|
if (ret != RPC_S_OK) return ret;
|
|
|
|
ret = RPCRT4_SetBindingObject(bind, &Uuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (ret == RPC_S_OK)
|
2005-09-06 12:26:13 +02:00
|
|
|
ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint, (char*)Options);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcStringFreeA(&Options);
|
|
|
|
RpcStringFreeA(&Endpoint);
|
|
|
|
RpcStringFreeA(&NetworkAddr);
|
|
|
|
RpcStringFreeA(&Protseq);
|
|
|
|
RpcStringFreeA(&ObjectUuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2002-10-24 01:36:24 +02:00
|
|
|
if (ret == RPC_S_OK)
|
|
|
|
*Binding = (RPC_BINDING_HANDLE)bind;
|
|
|
|
else
|
2008-04-01 13:48:15 +02:00
|
|
|
RPCRT4_ReleaseBinding(bind);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingFromStringBindingW (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcBindingFromStringBindingW( RPC_WSTR StringBinding, RPC_BINDING_HANDLE* Binding )
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RPC_STATUS ret;
|
|
|
|
RpcBinding* bind = NULL;
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_WSTR ObjectUuid, Protseq, NetworkAddr, Endpoint, Options;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
UUID Uuid;
|
|
|
|
|
|
|
|
TRACE("(%s,%p)\n", debugstr_w(StringBinding), Binding);
|
|
|
|
|
|
|
|
ret = RpcStringBindingParseW(StringBinding, &ObjectUuid, &Protseq,
|
|
|
|
&NetworkAddr, &Endpoint, &Options);
|
|
|
|
if (ret != RPC_S_OK) return ret;
|
|
|
|
|
|
|
|
ret = UuidFromStringW(ObjectUuid, &Uuid);
|
|
|
|
|
|
|
|
if (ret == RPC_S_OK)
|
|
|
|
ret = RPCRT4_CreateBindingW(&bind, FALSE, Protseq);
|
2008-04-16 08:37:26 +02:00
|
|
|
if (ret != RPC_S_OK) return ret;
|
|
|
|
ret = RPCRT4_SetBindingObject(bind, &Uuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
if (ret == RPC_S_OK)
|
|
|
|
ret = RPCRT4_CompleteBindingW(bind, NetworkAddr, Endpoint, Options);
|
|
|
|
|
|
|
|
RpcStringFreeW(&Options);
|
|
|
|
RpcStringFreeW(&Endpoint);
|
|
|
|
RpcStringFreeW(&NetworkAddr);
|
|
|
|
RpcStringFreeW(&Protseq);
|
|
|
|
RpcStringFreeW(&ObjectUuid);
|
|
|
|
|
2002-10-24 01:36:24 +02:00
|
|
|
if (ret == RPC_S_OK)
|
|
|
|
*Binding = (RPC_BINDING_HANDLE)bind;
|
|
|
|
else
|
2008-04-01 13:48:15 +02:00
|
|
|
RPCRT4_ReleaseBinding(bind);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingToStringBindingA (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcBindingToStringBindingA( RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding )
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RPC_STATUS ret;
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding* bind = Binding;
|
2007-03-26 19:14:27 +02:00
|
|
|
RPC_CSTR ObjectUuid;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", Binding, StringBinding);
|
|
|
|
|
2008-08-14 10:15:02 +02:00
|
|
|
if (UuidIsNil(&bind->ObjectUuid, &ret))
|
|
|
|
ObjectUuid = NULL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret = UuidToStringA(&bind->ObjectUuid, &ObjectUuid);
|
|
|
|
if (ret != RPC_S_OK) return ret;
|
|
|
|
}
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
ret = RpcStringBindingComposeA(ObjectUuid, (unsigned char*)bind->Protseq, (unsigned char*) bind->NetworkAddr,
|
2005-09-06 12:26:13 +02:00
|
|
|
(unsigned char*) bind->Endpoint, NULL, StringBinding);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2007-03-26 19:14:27 +02:00
|
|
|
RpcStringFreeA(&ObjectUuid);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingToStringBindingW (RPCRT4.@)
|
|
|
|
*/
|
2006-10-13 02:19:15 +02:00
|
|
|
RPC_STATUS WINAPI RpcBindingToStringBindingW( RPC_BINDING_HANDLE Binding, RPC_WSTR *StringBinding )
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
|
|
|
RPC_STATUS ret;
|
2004-04-20 01:03:58 +02:00
|
|
|
unsigned char *str = NULL;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
TRACE("(%p,%p)\n", Binding, StringBinding);
|
|
|
|
ret = RpcBindingToStringBindingA(Binding, &str);
|
2005-09-06 12:26:13 +02:00
|
|
|
*StringBinding = RPCRT4_strdupAtoW((char*)str);
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcStringFreeA(&str);
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2003-02-19 04:44:35 +01:00
|
|
|
|
2008-06-26 00:01:55 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* I_RpcBindingInqTransportType (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI I_RpcBindingInqTransportType( RPC_BINDING_HANDLE Binding, unsigned int * Type )
|
|
|
|
{
|
|
|
|
|
|
|
|
FIXME( "(%p,%p): stub\n", Binding, Type);
|
|
|
|
*Type = TRANSPORT_TYPE_LPC;
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* I_RpcBindingSetAsync (RPCRT4.@)
|
|
|
|
* NOTES
|
|
|
|
* Exists in win9x and winNT, but with different number of arguments
|
|
|
|
* (9x version has 3 arguments, NT has 2).
|
|
|
|
*/
|
2002-10-31 23:45:12 +01:00
|
|
|
RPC_STATUS WINAPI I_RpcBindingSetAsync( RPC_BINDING_HANDLE Binding, RPC_BLOCKING_FN BlockingFn)
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
{
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding* bind = Binding;
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
2002-11-01 00:36:07 +01:00
|
|
|
TRACE( "(%p,%p): stub\n", Binding, BlockingFn );
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
|
|
|
|
bind->BlockingFn = BlockingFn;
|
2002-10-31 23:45:12 +01:00
|
|
|
|
Implemented RpcBindingInqObject, RpcBindingSetObject,
RpcBindingVectorFree, RpcBindingToStringBindingA/W,
RpcBindingFromStringBindingA/W, RpcStringBindingParseA/W,
I_RpcBindingSetAsync, RpcStringBindingComposeA/W, RpcBindingFree,
RPCStringFreeW, UUIDHash, UuidToStringW, and associated junk.
2002-10-07 23:49:49 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
2004-01-21 00:36:50 +01:00
|
|
|
|
2006-05-25 00:00:34 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingCopy (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS RPC_ENTRY RpcBindingCopy(
|
|
|
|
RPC_BINDING_HANDLE SourceBinding,
|
|
|
|
RPC_BINDING_HANDLE* DestinationBinding)
|
|
|
|
{
|
|
|
|
RpcBinding *DestBinding;
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding *SrcBinding = SourceBinding;
|
2006-05-25 00:00:34 +02:00
|
|
|
RPC_STATUS status;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", SourceBinding, DestinationBinding);
|
|
|
|
|
|
|
|
status = RPCRT4_AllocBinding(&DestBinding, SrcBinding->server);
|
|
|
|
if (status != RPC_S_OK) return status;
|
|
|
|
|
|
|
|
DestBinding->ObjectUuid = SrcBinding->ObjectUuid;
|
|
|
|
DestBinding->BlockingFn = SrcBinding->BlockingFn;
|
|
|
|
DestBinding->Protseq = RPCRT4_strndupA(SrcBinding->Protseq, -1);
|
|
|
|
DestBinding->NetworkAddr = RPCRT4_strndupA(SrcBinding->NetworkAddr, -1);
|
|
|
|
DestBinding->Endpoint = RPCRT4_strndupA(SrcBinding->Endpoint, -1);
|
2007-01-25 11:23:11 +01:00
|
|
|
DestBinding->NetworkOptions = RPCRT4_strdupW(SrcBinding->NetworkOptions);
|
2007-03-26 19:13:49 +02:00
|
|
|
if (SrcBinding->Assoc) SrcBinding->Assoc->refs++;
|
|
|
|
DestBinding->Assoc = SrcBinding->Assoc;
|
2006-05-25 00:00:34 +02:00
|
|
|
|
|
|
|
if (SrcBinding->AuthInfo) RpcAuthInfo_AddRef(SrcBinding->AuthInfo);
|
|
|
|
DestBinding->AuthInfo = SrcBinding->AuthInfo;
|
2007-01-19 13:59:35 +01:00
|
|
|
if (SrcBinding->QOS) RpcQualityOfService_AddRef(SrcBinding->QOS);
|
|
|
|
DestBinding->QOS = SrcBinding->QOS;
|
2006-05-25 00:00:34 +02:00
|
|
|
|
|
|
|
*DestinationBinding = DestBinding;
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2008-08-18 22:13:54 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingReset (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS RPC_ENTRY RpcBindingReset(RPC_BINDING_HANDLE Binding)
|
|
|
|
{
|
|
|
|
RpcBinding *bind = Binding;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", Binding);
|
|
|
|
|
|
|
|
RPCRT4_strfree(bind->Endpoint);
|
|
|
|
bind->Endpoint = NULL;
|
|
|
|
if (bind->Assoc) RpcAssoc_Release(bind->Assoc);
|
|
|
|
bind->Assoc = NULL;
|
|
|
|
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2005-02-15 21:45:37 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* RpcImpersonateClient (RPCRT4.@)
|
|
|
|
*
|
|
|
|
* Impersonates the client connected via a binding handle so that security
|
|
|
|
* checks are done in the context of the client.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* BindingHandle [I] Handle to the binding to the client.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: RPS_S_OK.
|
|
|
|
* Failure: RPC_STATUS value.
|
2005-03-14 11:11:04 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
*
|
|
|
|
* If BindingHandle is NULL then the function impersonates the client
|
|
|
|
* connected to the binding handle of the current thread.
|
2005-02-15 21:45:37 +01:00
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", BindingHandle);
|
2006-07-24 12:46:07 +02:00
|
|
|
ImpersonateSelf(SecurityImpersonation);
|
2005-03-14 11:11:04 +01:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcRevertToSelfEx (RPCRT4.@)
|
|
|
|
*
|
|
|
|
* Stops impersonating the client connected to the binding handle so that security
|
|
|
|
* checks are no longer done in the context of the client.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* BindingHandle [I] Handle to the binding to the client.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: RPS_S_OK.
|
|
|
|
* Failure: RPC_STATUS value.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
*
|
|
|
|
* If BindingHandle is NULL then the function stops impersonating the client
|
|
|
|
* connected to the binding handle of the current thread.
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcRevertToSelfEx(RPC_BINDING_HANDLE BindingHandle)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", BindingHandle);
|
|
|
|
return RPC_S_OK;
|
2005-02-15 21:45:37 +01:00
|
|
|
}
|
2006-04-26 15:44:07 +02:00
|
|
|
|
2007-06-25 15:27:17 +02:00
|
|
|
static inline BOOL has_nt_auth_identity(ULONG AuthnLevel)
|
|
|
|
{
|
|
|
|
switch (AuthnLevel)
|
|
|
|
{
|
|
|
|
case RPC_C_AUTHN_GSS_NEGOTIATE:
|
|
|
|
case RPC_C_AUTHN_WINNT:
|
|
|
|
case RPC_C_AUTHN_GSS_KERBEROS:
|
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-26 19:16:34 +02:00
|
|
|
static RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
|
|
|
|
CredHandle cred, TimeStamp exp,
|
2007-06-25 15:27:17 +02:00
|
|
|
ULONG cbMaxToken,
|
|
|
|
RPC_AUTH_IDENTITY_HANDLE identity,
|
|
|
|
RpcAuthInfo **ret)
|
2006-05-18 04:40:42 +02:00
|
|
|
{
|
|
|
|
RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo));
|
|
|
|
if (!AuthInfo)
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
|
2007-01-19 13:59:35 +01:00
|
|
|
AuthInfo->refs = 1;
|
2006-05-18 04:40:42 +02:00
|
|
|
AuthInfo->AuthnLevel = AuthnLevel;
|
|
|
|
AuthInfo->AuthnSvc = AuthnSvc;
|
|
|
|
AuthInfo->cred = cred;
|
|
|
|
AuthInfo->exp = exp;
|
2007-03-26 19:16:34 +02:00
|
|
|
AuthInfo->cbMaxToken = cbMaxToken;
|
2007-06-25 15:27:17 +02:00
|
|
|
AuthInfo->identity = identity;
|
2008-01-23 17:32:54 +01:00
|
|
|
AuthInfo->server_principal_name = NULL;
|
2007-06-25 15:27:17 +02:00
|
|
|
|
|
|
|
/* duplicate the SEC_WINNT_AUTH_IDENTITY structure, if applicable, to
|
|
|
|
* enable better matching in RpcAuthInfo_IsEqual */
|
|
|
|
if (identity && has_nt_auth_identity(AuthnSvc))
|
|
|
|
{
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_W *nt_identity = identity;
|
|
|
|
AuthInfo->nt_identity = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo->nt_identity));
|
|
|
|
if (!AuthInfo->nt_identity)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo);
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
AuthInfo->nt_identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
|
|
|
if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
|
|
|
|
AuthInfo->nt_identity->User = RPCRT4_strndupW(nt_identity->User, nt_identity->UserLength);
|
|
|
|
else
|
|
|
|
AuthInfo->nt_identity->User = RPCRT4_strndupAtoW((const char *)nt_identity->User, nt_identity->UserLength);
|
|
|
|
AuthInfo->nt_identity->UserLength = nt_identity->UserLength;
|
|
|
|
if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
|
|
|
|
AuthInfo->nt_identity->Domain = RPCRT4_strndupW(nt_identity->Domain, nt_identity->DomainLength);
|
|
|
|
else
|
|
|
|
AuthInfo->nt_identity->Domain = RPCRT4_strndupAtoW((const char *)nt_identity->Domain, nt_identity->DomainLength);
|
|
|
|
AuthInfo->nt_identity->DomainLength = nt_identity->DomainLength;
|
|
|
|
if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
|
|
|
|
AuthInfo->nt_identity->Password = RPCRT4_strndupW(nt_identity->Password, nt_identity->PasswordLength);
|
|
|
|
else
|
|
|
|
AuthInfo->nt_identity->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength);
|
|
|
|
AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength;
|
|
|
|
|
2008-03-10 17:42:06 +01:00
|
|
|
if ((nt_identity->User && !AuthInfo->nt_identity->User) ||
|
|
|
|
(nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
|
|
|
|
(nt_identity->Password && !AuthInfo->nt_identity->Password))
|
2007-06-25 15:27:17 +02:00
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo);
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
AuthInfo->nt_identity = NULL;
|
2006-05-18 04:40:42 +02:00
|
|
|
*ret = AuthInfo;
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
|
|
|
|
{
|
|
|
|
return InterlockedIncrement(&AuthInfo->refs);
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
|
|
|
|
{
|
|
|
|
ULONG refs = InterlockedDecrement(&AuthInfo->refs);
|
|
|
|
|
|
|
|
if (!refs)
|
|
|
|
{
|
|
|
|
FreeCredentialsHandle(&AuthInfo->cred);
|
2007-06-25 15:27:17 +02:00
|
|
|
if (AuthInfo->nt_identity)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
|
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
|
2007-09-18 17:31:55 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
|
2007-06-25 15:27:17 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
|
|
|
|
}
|
2008-01-23 17:32:54 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo->server_principal_name);
|
2006-05-18 04:40:42 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, AuthInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return refs;
|
|
|
|
}
|
|
|
|
|
2007-06-25 15:27:17 +02:00
|
|
|
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2)
|
|
|
|
{
|
|
|
|
if (AuthInfo1 == AuthInfo2)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!AuthInfo1 || !AuthInfo2)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ((AuthInfo1->AuthnLevel != AuthInfo2->AuthnLevel) ||
|
|
|
|
(AuthInfo1->AuthnSvc != AuthInfo2->AuthnSvc))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (AuthInfo1->identity == AuthInfo2->identity)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!AuthInfo1->identity || !AuthInfo2->identity)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (has_nt_auth_identity(AuthInfo1->AuthnSvc))
|
|
|
|
{
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_W *identity1 = AuthInfo1->nt_identity;
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_W *identity2 = AuthInfo2->nt_identity;
|
|
|
|
/* compare user names */
|
|
|
|
if (identity1->UserLength != identity2->UserLength ||
|
|
|
|
memcmp(identity1->User, identity2->User, identity1->UserLength))
|
|
|
|
return FALSE;
|
|
|
|
/* compare domain names */
|
|
|
|
if (identity1->DomainLength != identity2->DomainLength ||
|
|
|
|
memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
|
|
|
|
return FALSE;
|
|
|
|
/* compare passwords */
|
|
|
|
if (identity1->PasswordLength != identity2->PasswordLength ||
|
|
|
|
memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-01-19 13:59:35 +01:00
|
|
|
static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BOOL unicode, RpcQualityOfService **qos_dst)
|
|
|
|
{
|
|
|
|
RpcQualityOfService *qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos));
|
|
|
|
|
|
|
|
if (!qos)
|
|
|
|
return RPC_S_OUT_OF_RESOURCES;
|
|
|
|
|
|
|
|
qos->refs = 1;
|
|
|
|
qos->qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos->qos));
|
|
|
|
if (!qos->qos) goto error;
|
|
|
|
qos->qos->Version = qos_src->Version;
|
|
|
|
qos->qos->Capabilities = qos_src->Capabilities;
|
|
|
|
qos->qos->IdentityTracking = qos_src->IdentityTracking;
|
|
|
|
qos->qos->ImpersonationType = qos_src->ImpersonationType;
|
|
|
|
qos->qos->AdditionalSecurityInfoType = 0;
|
|
|
|
|
|
|
|
if (qos_src->Version >= 2)
|
|
|
|
{
|
|
|
|
const RPC_SECURITY_QOS_V2_W *qos_src2 = (const RPC_SECURITY_QOS_V2_W *)qos_src;
|
|
|
|
qos->qos->AdditionalSecurityInfoType = qos_src2->AdditionalSecurityInfoType;
|
|
|
|
if (qos_src2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
|
|
|
|
{
|
|
|
|
const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_src = qos_src2->u.HttpCredentials;
|
|
|
|
RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_dst;
|
|
|
|
|
|
|
|
http_credentials_dst = HeapAlloc(GetProcessHeap(), 0, sizeof(*http_credentials_dst));
|
|
|
|
qos->qos->u.HttpCredentials = http_credentials_dst;
|
|
|
|
if (!http_credentials_dst) goto error;
|
2007-01-24 01:27:10 +01:00
|
|
|
http_credentials_dst->TransportCredentials = NULL;
|
2007-01-19 13:59:35 +01:00
|
|
|
http_credentials_dst->Flags = http_credentials_src->Flags;
|
|
|
|
http_credentials_dst->AuthenticationTarget = http_credentials_src->AuthenticationTarget;
|
|
|
|
http_credentials_dst->NumberOfAuthnSchemes = http_credentials_src->NumberOfAuthnSchemes;
|
|
|
|
http_credentials_dst->AuthnSchemes = NULL;
|
|
|
|
http_credentials_dst->ServerCertificateSubject = NULL;
|
2007-01-24 01:27:10 +01:00
|
|
|
if (http_credentials_src->TransportCredentials)
|
|
|
|
{
|
|
|
|
SEC_WINNT_AUTH_IDENTITY_W *cred_dst;
|
|
|
|
cred_dst = http_credentials_dst->TransportCredentials = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cred_dst));
|
|
|
|
if (!cred_dst) goto error;
|
|
|
|
cred_dst->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
|
|
|
if (unicode)
|
|
|
|
{
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_W *cred_src = http_credentials_src->TransportCredentials;
|
|
|
|
cred_dst->UserLength = cred_src->UserLength;
|
|
|
|
cred_dst->PasswordLength = cred_src->PasswordLength;
|
|
|
|
cred_dst->DomainLength = cred_src->DomainLength;
|
|
|
|
cred_dst->User = RPCRT4_strndupW(cred_src->User, cred_src->UserLength);
|
|
|
|
cred_dst->Password = RPCRT4_strndupW(cred_src->Password, cred_src->PasswordLength);
|
|
|
|
cred_dst->Domain = RPCRT4_strndupW(cred_src->Domain, cred_src->DomainLength);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_A *cred_src = (const SEC_WINNT_AUTH_IDENTITY_A *)http_credentials_src->TransportCredentials;
|
|
|
|
cred_dst->UserLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, NULL, 0);
|
|
|
|
cred_dst->DomainLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, NULL, 0);
|
|
|
|
cred_dst->PasswordLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, NULL, 0);
|
|
|
|
cred_dst->User = HeapAlloc(GetProcessHeap(), 0, cred_dst->UserLength * sizeof(WCHAR));
|
|
|
|
cred_dst->Password = HeapAlloc(GetProcessHeap(), 0, cred_dst->PasswordLength * sizeof(WCHAR));
|
|
|
|
cred_dst->Domain = HeapAlloc(GetProcessHeap(), 0, cred_dst->DomainLength * sizeof(WCHAR));
|
|
|
|
if (!cred_dst || !cred_dst->Password || !cred_dst->Domain) goto error;
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, cred_dst->User, cred_dst->UserLength);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, cred_dst->Domain, cred_dst->DomainLength);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, cred_dst->Password, cred_dst->PasswordLength);
|
|
|
|
}
|
|
|
|
}
|
2007-01-19 13:59:35 +01:00
|
|
|
if (http_credentials_src->NumberOfAuthnSchemes)
|
|
|
|
{
|
|
|
|
http_credentials_dst->AuthnSchemes = HeapAlloc(GetProcessHeap(), 0, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
|
|
|
|
if (!http_credentials_dst->AuthnSchemes) goto error;
|
|
|
|
memcpy(http_credentials_dst->AuthnSchemes, http_credentials_src->AuthnSchemes, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
|
|
|
|
}
|
|
|
|
if (http_credentials_src->ServerCertificateSubject)
|
|
|
|
{
|
|
|
|
if (unicode)
|
|
|
|
http_credentials_dst->ServerCertificateSubject =
|
|
|
|
RPCRT4_strndupW(http_credentials_src->ServerCertificateSubject,
|
|
|
|
strlenW(http_credentials_src->ServerCertificateSubject));
|
|
|
|
else
|
|
|
|
http_credentials_dst->ServerCertificateSubject =
|
|
|
|
RPCRT4_strdupAtoW((char *)http_credentials_src->ServerCertificateSubject);
|
|
|
|
if (!http_credentials_dst->ServerCertificateSubject) goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*qos_dst = qos;
|
|
|
|
return RPC_S_OK;
|
|
|
|
|
|
|
|
error:
|
|
|
|
if (qos->qos)
|
|
|
|
{
|
|
|
|
if (qos->qos->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP &&
|
|
|
|
qos->qos->u.HttpCredentials)
|
|
|
|
{
|
2007-01-24 01:27:10 +01:00
|
|
|
if (qos->qos->u.HttpCredentials->TransportCredentials)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->User);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Domain);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Password);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials);
|
|
|
|
}
|
2007-01-19 13:59:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->AuthnSchemes);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->ServerCertificateSubject);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos);
|
|
|
|
return RPC_S_OUT_OF_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos)
|
|
|
|
{
|
|
|
|
return InterlockedIncrement(&qos->refs);
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
|
|
|
|
{
|
|
|
|
ULONG refs = InterlockedDecrement(&qos->refs);
|
|
|
|
|
|
|
|
if (!refs)
|
|
|
|
{
|
|
|
|
if (qos->qos->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
|
|
|
|
{
|
2007-01-24 01:27:10 +01:00
|
|
|
if (qos->qos->u.HttpCredentials->TransportCredentials)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->User);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Domain);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials->Password);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->TransportCredentials);
|
|
|
|
}
|
2007-01-19 13:59:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->AuthnSchemes);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials->ServerCertificateSubject);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos->u.HttpCredentials);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos->qos);
|
|
|
|
HeapFree(GetProcessHeap(), 0, qos);
|
|
|
|
}
|
|
|
|
return refs;
|
|
|
|
}
|
|
|
|
|
2007-06-25 15:27:17 +02:00
|
|
|
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2)
|
|
|
|
{
|
|
|
|
if (qos1 == qos2)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!qos1 || !qos2)
|
|
|
|
return FALSE;
|
|
|
|
|
2009-01-04 01:49:37 +01:00
|
|
|
TRACE("qos1 = { %d %d %d %d }, qos2 = { %d %d %d %d }\n",
|
2007-06-25 15:27:17 +02:00
|
|
|
qos1->qos->Capabilities, qos1->qos->IdentityTracking,
|
|
|
|
qos1->qos->ImpersonationType, qos1->qos->AdditionalSecurityInfoType,
|
|
|
|
qos2->qos->Capabilities, qos2->qos->IdentityTracking,
|
|
|
|
qos2->qos->ImpersonationType, qos2->qos->AdditionalSecurityInfoType);
|
|
|
|
|
|
|
|
if ((qos1->qos->Capabilities != qos2->qos->Capabilities) ||
|
|
|
|
(qos1->qos->IdentityTracking != qos2->qos->IdentityTracking) ||
|
|
|
|
(qos1->qos->ImpersonationType != qos2->qos->ImpersonationType) ||
|
|
|
|
(qos1->qos->AdditionalSecurityInfoType != qos2->qos->AdditionalSecurityInfoType))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (qos1->qos->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
|
|
|
|
{
|
|
|
|
const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials1 = qos1->qos->u.HttpCredentials;
|
|
|
|
const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials2 = qos2->qos->u.HttpCredentials;
|
|
|
|
|
|
|
|
if (http_credentials1->Flags != http_credentials2->Flags)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (http_credentials1->AuthenticationTarget != http_credentials2->AuthenticationTarget)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* authentication schemes and server certificate subject not currently used */
|
|
|
|
|
|
|
|
if (http_credentials1->TransportCredentials != http_credentials2->TransportCredentials)
|
|
|
|
{
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_W *identity1 = http_credentials1->TransportCredentials;
|
|
|
|
const SEC_WINNT_AUTH_IDENTITY_W *identity2 = http_credentials2->TransportCredentials;
|
|
|
|
|
|
|
|
if (!identity1 || !identity2)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* compare user names */
|
|
|
|
if (identity1->UserLength != identity2->UserLength ||
|
|
|
|
memcmp(identity1->User, identity2->User, identity1->UserLength))
|
|
|
|
return FALSE;
|
|
|
|
/* compare domain names */
|
|
|
|
if (identity1->DomainLength != identity2->DomainLength ||
|
|
|
|
memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
|
|
|
|
return FALSE;
|
|
|
|
/* compare passwords */
|
|
|
|
if (identity1->PasswordLength != identity2->PasswordLength ||
|
|
|
|
memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-06-21 13:39:52 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RpcRevertToSelf (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcRevertToSelf(void)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
2006-07-24 12:46:07 +02:00
|
|
|
RevertToSelf();
|
2006-06-21 13:39:52 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcMgmtSetComTimeout (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPC_STATUS WINAPI RpcMgmtSetComTimeout(RPC_BINDING_HANDLE BindingHandle, unsigned int Timeout)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d): stub\n", BindingHandle, Timeout);
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
2006-04-26 15:44:07 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingInqAuthInfoExA (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingInqAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel,
|
|
|
|
ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc,
|
|
|
|
ULONG RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS )
|
2006-04-26 15:44:07 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
|
2006-04-26 15:44:07 +02:00
|
|
|
AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
|
|
|
|
return RPC_S_INVALID_BINDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingInqAuthInfoExW (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingInqAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel,
|
|
|
|
ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc,
|
|
|
|
ULONG RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS )
|
2006-04-26 15:44:07 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
|
2006-04-26 15:44:07 +02:00
|
|
|
AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
|
|
|
|
return RPC_S_INVALID_BINDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingInqAuthInfoA (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingInqAuthInfoA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel,
|
|
|
|
ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc )
|
2006-04-26 15:44:07 +02:00
|
|
|
{
|
|
|
|
FIXME("%p %p %p %p %p %p\n", Binding, ServerPrincName, AuthnLevel,
|
|
|
|
AuthnSvc, AuthIdentity, AuthzSvc);
|
|
|
|
return RPC_S_INVALID_BINDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingInqAuthInfoW (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingInqAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel,
|
|
|
|
ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc )
|
2006-04-26 15:44:07 +02:00
|
|
|
{
|
|
|
|
FIXME("%p %p %p %p %p %p\n", Binding, ServerPrincName, AuthnLevel,
|
|
|
|
AuthnSvc, AuthIdentity, AuthzSvc);
|
|
|
|
return RPC_S_INVALID_BINDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingSetAuthInfoExA (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2006-10-13 02:19:15 +02:00
|
|
|
RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
|
2007-02-06 10:18:02 +01:00
|
|
|
ULONG AuthnLevel, ULONG AuthnSvc,
|
|
|
|
RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr,
|
2006-04-26 15:44:07 +02:00
|
|
|
RPC_SECURITY_QOS *SecurityQos )
|
|
|
|
{
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding* bind = Binding;
|
2006-05-18 04:41:16 +02:00
|
|
|
SECURITY_STATUS r;
|
2006-05-18 04:40:42 +02:00
|
|
|
CredHandle cred;
|
|
|
|
TimeStamp exp;
|
2006-05-18 04:41:16 +02:00
|
|
|
ULONG package_count;
|
|
|
|
ULONG i;
|
|
|
|
PSecPkgInfoA packages;
|
2007-03-26 19:16:34 +02:00
|
|
|
ULONG cbMaxToken;
|
2006-05-15 16:04:25 +02:00
|
|
|
|
2007-02-06 10:18:02 +01:00
|
|
|
TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_a((const char*)ServerPrincName),
|
2006-05-15 16:04:25 +02:00
|
|
|
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
|
|
|
|
|
2007-01-19 13:59:35 +01:00
|
|
|
if (SecurityQos)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
|
2009-01-07 12:22:02 +01:00
|
|
|
TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
|
2007-01-19 13:59:35 +01:00
|
|
|
SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
|
|
|
|
if (SecurityQos->Version >= 2)
|
|
|
|
{
|
|
|
|
const RPC_SECURITY_QOS_V2_A *SecurityQos2 = (const RPC_SECURITY_QOS_V2_A *)SecurityQos;
|
2009-01-04 01:49:37 +01:00
|
|
|
TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
|
2007-01-19 13:59:35 +01:00
|
|
|
if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
|
2009-01-04 01:49:37 +01:00
|
|
|
TRACE(", { %p, 0x%x, %d, %d, %p, %s }",
|
2007-01-19 13:59:35 +01:00
|
|
|
SecurityQos2->u.HttpCredentials->TransportCredentials,
|
|
|
|
SecurityQos2->u.HttpCredentials->Flags,
|
|
|
|
SecurityQos2->u.HttpCredentials->AuthenticationTarget,
|
|
|
|
SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
|
|
|
|
SecurityQos2->u.HttpCredentials->AuthnSchemes,
|
|
|
|
SecurityQos2->u.HttpCredentials->ServerCertificateSubject);
|
|
|
|
}
|
|
|
|
TRACE("}\n");
|
|
|
|
status = RpcQualityOfService_Create(SecurityQos, FALSE, &bind->QOS);
|
|
|
|
if (status != RPC_S_OK)
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bind->QOS) RpcQualityOfService_Release(bind->QOS);
|
|
|
|
bind->QOS = NULL;
|
|
|
|
}
|
|
|
|
|
2006-11-21 14:09:44 +01:00
|
|
|
if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
|
|
|
|
AuthnSvc = RPC_C_AUTHN_WINNT;
|
|
|
|
|
|
|
|
/* FIXME: the mapping should probably be retrieved using SSPI somehow */
|
|
|
|
if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
|
|
|
|
AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
|
|
|
|
|
|
|
|
if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
|
|
|
|
{
|
|
|
|
if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
|
|
|
|
bind->AuthInfo = NULL;
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
|
2006-05-15 16:04:25 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("unknown AuthnLevel %u\n", AuthnLevel);
|
2006-05-15 16:04:25 +02:00
|
|
|
return RPC_S_UNKNOWN_AUTHN_LEVEL;
|
|
|
|
}
|
|
|
|
|
2008-06-23 09:52:23 +02:00
|
|
|
/* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
|
|
|
|
if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
|
2006-05-15 16:04:25 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
|
2006-05-15 16:04:25 +02:00
|
|
|
return RPC_S_UNKNOWN_AUTHZ_SERVICE;
|
|
|
|
}
|
|
|
|
|
2006-05-18 04:41:16 +02:00
|
|
|
r = EnumerateSecurityPackagesA(&package_count, &packages);
|
|
|
|
if (r != SEC_E_OK)
|
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", r);
|
2006-05-18 04:41:16 +02:00
|
|
|
return RPC_S_SEC_PKG_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < package_count; i++)
|
|
|
|
if (packages[i].wRPCID == AuthnSvc)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == package_count)
|
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
|
2006-05-18 04:41:16 +02:00
|
|
|
FreeContextBuffer(packages);
|
|
|
|
return RPC_S_UNKNOWN_AUTHN_SERVICE;
|
|
|
|
}
|
|
|
|
|
2007-02-06 10:18:02 +01:00
|
|
|
TRACE("found package %s for service %u\n", packages[i].Name, AuthnSvc);
|
2008-01-23 17:32:54 +01:00
|
|
|
r = AcquireCredentialsHandleA(NULL, packages[i].Name, SECPKG_CRED_OUTBOUND, NULL,
|
2006-05-18 04:40:42 +02:00
|
|
|
AuthIdentity, NULL, NULL, &cred, &exp);
|
2007-03-26 19:16:34 +02:00
|
|
|
cbMaxToken = packages[i].cbMaxToken;
|
2006-05-18 04:41:16 +02:00
|
|
|
FreeContextBuffer(packages);
|
2006-05-15 16:04:25 +02:00
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
2008-01-23 17:32:45 +01:00
|
|
|
RpcAuthInfo *new_auth_info;
|
2007-03-26 19:16:34 +02:00
|
|
|
r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
|
2008-01-23 17:32:45 +01:00
|
|
|
AuthIdentity, &new_auth_info);
|
|
|
|
if (r == RPC_S_OK)
|
|
|
|
{
|
2008-01-23 17:32:54 +01:00
|
|
|
new_auth_info->server_principal_name = RPCRT4_strdupAtoW((char *)ServerPrincName);
|
|
|
|
if (new_auth_info->server_principal_name)
|
|
|
|
{
|
|
|
|
if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
|
|
|
|
bind->AuthInfo = new_auth_info;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RpcAuthInfo_Release(new_auth_info);
|
|
|
|
r = ERROR_OUTOFMEMORY;
|
|
|
|
}
|
2008-01-23 17:32:45 +01:00
|
|
|
}
|
|
|
|
else
|
2006-05-18 04:40:42 +02:00
|
|
|
FreeCredentialsHandle(&cred);
|
2008-01-23 17:32:45 +01:00
|
|
|
return r;
|
2006-05-15 16:04:25 +02:00
|
|
|
}
|
2006-05-18 04:40:42 +02:00
|
|
|
else
|
2006-05-18 04:41:16 +02:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("AcquireCredentialsHandleA failed with error 0x%08x\n", r);
|
2006-05-18 04:41:16 +02:00
|
|
|
return RPC_S_SEC_PKG_ERROR;
|
|
|
|
}
|
2006-04-26 15:44:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingSetAuthInfoExW (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel,
|
|
|
|
ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr,
|
2006-04-26 15:44:07 +02:00
|
|
|
RPC_SECURITY_QOS *SecurityQos )
|
|
|
|
{
|
2009-02-16 09:54:10 +01:00
|
|
|
RpcBinding* bind = Binding;
|
2006-05-18 04:41:34 +02:00
|
|
|
SECURITY_STATUS r;
|
|
|
|
CredHandle cred;
|
|
|
|
TimeStamp exp;
|
|
|
|
ULONG package_count;
|
|
|
|
ULONG i;
|
|
|
|
PSecPkgInfoW packages;
|
2007-03-26 19:16:34 +02:00
|
|
|
ULONG cbMaxToken;
|
2006-05-18 04:41:34 +02:00
|
|
|
|
2009-02-16 09:54:10 +01:00
|
|
|
TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w(ServerPrincName),
|
2006-05-18 04:41:34 +02:00
|
|
|
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
|
|
|
|
|
2007-01-19 13:59:35 +01:00
|
|
|
if (SecurityQos)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
|
2009-01-07 12:22:02 +01:00
|
|
|
TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
|
2007-01-19 13:59:35 +01:00
|
|
|
SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
|
|
|
|
if (SecurityQos->Version >= 2)
|
|
|
|
{
|
|
|
|
const RPC_SECURITY_QOS_V2_W *SecurityQos2 = (const RPC_SECURITY_QOS_V2_W *)SecurityQos;
|
2009-01-04 01:49:37 +01:00
|
|
|
TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
|
2007-01-19 13:59:35 +01:00
|
|
|
if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
|
2009-01-04 01:49:37 +01:00
|
|
|
TRACE(", { %p, 0x%x, %d, %d, %p, %s }",
|
2007-01-19 13:59:35 +01:00
|
|
|
SecurityQos2->u.HttpCredentials->TransportCredentials,
|
|
|
|
SecurityQos2->u.HttpCredentials->Flags,
|
|
|
|
SecurityQos2->u.HttpCredentials->AuthenticationTarget,
|
|
|
|
SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
|
|
|
|
SecurityQos2->u.HttpCredentials->AuthnSchemes,
|
|
|
|
debugstr_w(SecurityQos2->u.HttpCredentials->ServerCertificateSubject));
|
|
|
|
}
|
|
|
|
TRACE("}\n");
|
|
|
|
status = RpcQualityOfService_Create(SecurityQos, TRUE, &bind->QOS);
|
|
|
|
if (status != RPC_S_OK)
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bind->QOS) RpcQualityOfService_Release(bind->QOS);
|
|
|
|
bind->QOS = NULL;
|
|
|
|
}
|
|
|
|
|
2006-11-21 14:09:44 +01:00
|
|
|
if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
|
|
|
|
AuthnSvc = RPC_C_AUTHN_WINNT;
|
|
|
|
|
|
|
|
/* FIXME: the mapping should probably be retrieved using SSPI somehow */
|
|
|
|
if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
|
|
|
|
AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
|
|
|
|
|
|
|
|
if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
|
|
|
|
{
|
|
|
|
if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
|
|
|
|
bind->AuthInfo = NULL;
|
|
|
|
return RPC_S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
|
2006-05-18 04:41:34 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("unknown AuthnLevel %u\n", AuthnLevel);
|
2006-05-18 04:41:34 +02:00
|
|
|
return RPC_S_UNKNOWN_AUTHN_LEVEL;
|
|
|
|
}
|
|
|
|
|
2008-06-23 09:52:23 +02:00
|
|
|
/* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
|
|
|
|
if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
|
2006-05-18 04:41:34 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
|
2006-05-18 04:41:34 +02:00
|
|
|
return RPC_S_UNKNOWN_AUTHZ_SERVICE;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = EnumerateSecurityPackagesW(&package_count, &packages);
|
|
|
|
if (r != SEC_E_OK)
|
|
|
|
{
|
2008-06-23 09:51:47 +02:00
|
|
|
ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", r);
|
2006-05-18 04:41:34 +02:00
|
|
|
return RPC_S_SEC_PKG_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < package_count; i++)
|
|
|
|
if (packages[i].wRPCID == AuthnSvc)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == package_count)
|
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
|
2006-05-18 04:41:34 +02:00
|
|
|
FreeContextBuffer(packages);
|
|
|
|
return RPC_S_UNKNOWN_AUTHN_SERVICE;
|
|
|
|
}
|
|
|
|
|
2007-02-06 10:18:02 +01:00
|
|
|
TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), AuthnSvc);
|
2008-01-23 17:32:54 +01:00
|
|
|
r = AcquireCredentialsHandleW(NULL, packages[i].Name, SECPKG_CRED_OUTBOUND, NULL,
|
2006-05-18 04:41:34 +02:00
|
|
|
AuthIdentity, NULL, NULL, &cred, &exp);
|
2007-03-26 19:16:34 +02:00
|
|
|
cbMaxToken = packages[i].cbMaxToken;
|
2006-05-18 04:41:34 +02:00
|
|
|
FreeContextBuffer(packages);
|
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
2008-01-23 17:32:45 +01:00
|
|
|
RpcAuthInfo *new_auth_info;
|
2007-03-26 19:16:34 +02:00
|
|
|
r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
|
2008-01-23 17:32:45 +01:00
|
|
|
AuthIdentity, &new_auth_info);
|
|
|
|
if (r == RPC_S_OK)
|
|
|
|
{
|
2008-01-23 17:32:54 +01:00
|
|
|
new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName);
|
2008-03-10 17:42:06 +01:00
|
|
|
if (!ServerPrincName || new_auth_info->server_principal_name)
|
2008-01-23 17:32:54 +01:00
|
|
|
{
|
|
|
|
if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
|
|
|
|
bind->AuthInfo = new_auth_info;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RpcAuthInfo_Release(new_auth_info);
|
|
|
|
r = ERROR_OUTOFMEMORY;
|
|
|
|
}
|
2008-01-23 17:32:45 +01:00
|
|
|
}
|
|
|
|
else
|
2006-05-18 04:41:34 +02:00
|
|
|
FreeCredentialsHandle(&cred);
|
2008-01-23 17:32:45 +01:00
|
|
|
return r;
|
2006-05-18 04:41:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-06-23 09:51:47 +02:00
|
|
|
ERR("AcquireCredentialsHandleW failed with error 0x%08x\n", r);
|
2006-05-18 04:41:34 +02:00
|
|
|
return RPC_S_SEC_PKG_ERROR;
|
|
|
|
}
|
2006-04-26 15:44:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingSetAuthInfoA (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingSetAuthInfoA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, ULONG AuthnLevel,
|
|
|
|
ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr )
|
2006-04-26 15:44:07 +02:00
|
|
|
{
|
2007-02-06 10:18:02 +01:00
|
|
|
TRACE("%p %s %u %u %p %u\n", Binding, debugstr_a((const char*)ServerPrincName),
|
2006-04-26 15:44:07 +02:00
|
|
|
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
|
2006-05-12 12:19:48 +02:00
|
|
|
return RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
|
2006-04-26 15:44:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingSetAuthInfoW (RPCRT4.@)
|
|
|
|
*/
|
|
|
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
2007-02-06 10:18:02 +01:00
|
|
|
RpcBindingSetAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel,
|
|
|
|
ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr )
|
2006-04-26 15:44:07 +02:00
|
|
|
{
|
2009-02-16 09:54:10 +01:00
|
|
|
TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w(ServerPrincName),
|
2006-04-26 15:44:07 +02:00
|
|
|
AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
|
2006-05-12 12:19:48 +02:00
|
|
|
return RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
|
2006-04-26 15:44:07 +02:00
|
|
|
}
|
2006-05-01 11:38:18 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RpcBindingSetOption (RPCRT4.@)
|
|
|
|
*/
|
2008-06-09 23:36:19 +02:00
|
|
|
RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Option, ULONG_PTR OptionValue)
|
2006-05-01 11:38:18 +02:00
|
|
|
{
|
2008-06-09 23:36:19 +02:00
|
|
|
FIXME("(%p, %d, %ld): stub\n", BindingHandle, Option, OptionValue);
|
2006-05-01 11:38:18 +02:00
|
|
|
return RPC_S_OK;
|
|
|
|
}
|