ReactOS  0.4.14-dev-614-gbfd8a84
rpc_binding.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wine/winternl.h"
#include "rpc.h"
#include "rpcndr.h"
#include "wine/debug.h"
#include "rpc_binding.h"
#include "rpc_assoc.h"
Include dependency graph for rpc_binding.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (rpc)
 
LPSTR RPCRT4_strndupA (LPCSTR src, INT slen)
 
LPSTR RPCRT4_strdupWtoA (LPCWSTR src)
 
LPWSTR RPCRT4_strdupAtoW (LPCSTR src)
 
static LPWSTR RPCRT4_strndupAtoW (LPCSTR src, INT slen)
 
LPWSTR RPCRT4_strndupW (LPCWSTR src, INT slen)
 
void RPCRT4_strfree (LPSTR src)
 
static RPC_STATUS RPCRT4_AllocBinding (RpcBinding **Binding, BOOL server)
 
static RPC_STATUS RPCRT4_CreateBindingA (RpcBinding **Binding, BOOL server, LPCSTR Protseq)
 
static RPC_STATUS RPCRT4_CreateBindingW (RpcBinding **Binding, BOOL server, LPCWSTR Protseq)
 
static RPC_STATUS RPCRT4_CompleteBindingA (RpcBinding *Binding, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCSTR NetworkOptions)
 
static RPC_STATUS RPCRT4_CompleteBindingW (RpcBinding *Binding, LPCWSTR NetworkAddr, LPCWSTR Endpoint, LPCWSTR NetworkOptions)
 
RPC_STATUS RPCRT4_ResolveBinding (RpcBinding *Binding, LPCSTR Endpoint)
 
RPC_STATUS RPCRT4_SetBindingObject (RpcBinding *Binding, const UUID *ObjectUuid)
 
RPC_STATUS RPCRT4_MakeBinding (RpcBinding **Binding, RpcConnection *Connection)
 
void RPCRT4_AddRefBinding (RpcBinding *Binding)
 
RPC_STATUS RPCRT4_ReleaseBinding (RpcBinding *Binding)
 
RPC_STATUS RPCRT4_OpenBinding (RpcBinding *Binding, RpcConnection **Connection, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId, BOOL *from_cache)
 
RPC_STATUS RPCRT4_CloseBinding (RpcBinding *Binding, RpcConnection *Connection)
 
static LPSTR RPCRT4_strconcatA (LPSTR dst, LPCSTR src)
 
static LPWSTR RPCRT4_strconcatW (LPWSTR dst, LPCWSTR src)
 
static RPC_CSTR escape_string_binding_component (RPC_CSTR string_binding, const unsigned char *component)
 
static RPC_WSTR escape_string_binding_componentW (RPC_WSTR string_binding, const WCHAR *component)
 
static const unsigned charstring_binding_find_delimiter (const unsigned char *string_binding, unsigned char delim)
 
static const WCHARstring_binding_find_delimiterW (const WCHAR *string_binding, WCHAR delim)
 
static RPC_CSTR unescape_string_binding_component (const unsigned char *string_binding, int len)
 
static RPC_WSTR unescape_string_binding_componentW (const WCHAR *string_binding, int len)
 
RPC_STATUS WINAPI RpcStringBindingComposeA (RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr, RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR *StringBinding)
 
RPC_STATUS WINAPI RpcStringBindingComposeW (RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
 
RPC_STATUS WINAPI RpcStringBindingParseA (RPC_CSTR StringBinding, RPC_CSTR *ObjUuid, RPC_CSTR *Protseq, RPC_CSTR *NetworkAddr, RPC_CSTR *Endpoint, RPC_CSTR *Options)
 
RPC_STATUS WINAPI RpcStringBindingParseW (RPC_WSTR StringBinding, RPC_WSTR *ObjUuid, RPC_WSTR *Protseq, RPC_WSTR *NetworkAddr, RPC_WSTR *Endpoint, RPC_WSTR *Options)
 
RPC_STATUS WINAPI RpcBindingFree (RPC_BINDING_HANDLE *Binding)
 
RPC_STATUS WINAPI RpcBindingVectorFree (RPC_BINDING_VECTOR **BindingVector)
 
RPC_STATUS WINAPI RpcBindingInqObject (RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
 
RPC_STATUS WINAPI RpcBindingSetObject (RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
 
RPC_STATUS WINAPI RpcBindingFromStringBindingA (RPC_CSTR StringBinding, RPC_BINDING_HANDLE *Binding)
 
RPC_STATUS WINAPI RpcBindingFromStringBindingW (RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
 
RPC_STATUS WINAPI RpcBindingToStringBindingA (RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding)
 
RPC_STATUS WINAPI RpcBindingToStringBindingW (RPC_BINDING_HANDLE Binding, RPC_WSTR *StringBinding)
 
RPC_STATUS WINAPI I_RpcBindingInqTransportType (RPC_BINDING_HANDLE Binding, unsigned int *Type)
 
RPC_STATUS WINAPI I_RpcBindingSetAsync (RPC_BINDING_HANDLE Binding, RPC_BLOCKING_FN BlockingFn)
 
RPC_STATUS RPC_ENTRY RpcBindingCopy (RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE *DestinationBinding)
 
RPC_STATUS RPC_ENTRY RpcBindingReset (RPC_BINDING_HANDLE Binding)
 
RPC_STATUS WINAPI RpcImpersonateClient (RPC_BINDING_HANDLE BindingHandle)
 
RPC_STATUS WINAPI RpcRevertToSelfEx (RPC_BINDING_HANDLE BindingHandle)
 
static BOOL has_nt_auth_identity (ULONG AuthnLevel)
 
RPC_STATUS RpcAuthInfo_Create (ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret)
 
ULONG RpcAuthInfo_AddRef (RpcAuthInfo *AuthInfo)
 
ULONG RpcAuthInfo_Release (RpcAuthInfo *AuthInfo)
 
BOOL RpcAuthInfo_IsEqual (const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2)
 
static RPC_STATUS RpcQualityOfService_Create (const RPC_SECURITY_QOS *qos_src, BOOL unicode, RpcQualityOfService **qos_dst)
 
ULONG RpcQualityOfService_AddRef (RpcQualityOfService *qos)
 
ULONG RpcQualityOfService_Release (RpcQualityOfService *qos)
 
BOOL RpcQualityOfService_IsEqual (const RpcQualityOfService *qos1, const RpcQualityOfService *qos2)
 
RPC_STATUS WINAPI RpcRevertToSelf (void)
 
RPC_STATUS WINAPI RpcMgmtSetComTimeout (RPC_BINDING_HANDLE BindingHandle, unsigned int Timeout)
 
RPCRTAPI RPC_STATUS RPC_ENTRY 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)
 
RPCRTAPI RPC_STATUS RPC_ENTRY 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)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthInfoA (RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthInfoW (RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientA (RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientW (RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExA (RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc, ULONG Flags)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExW (RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc, ULONG Flags)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingServerFromClient (RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE *ServerBinding)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoExA (RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr, RPC_SECURITY_QOS *SecurityQos)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoExW (RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr, RPC_SECURITY_QOS *SecurityQos)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoA (RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr)
 
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoW (RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr)
 
RPC_STATUS WINAPI RpcBindingSetOption (RPC_BINDING_HANDLE BindingHandle, ULONG Option, ULONG_PTR OptionValue)
 
RPC_STATUS WINAPI I_RpcBindingInqLocalClientPID (RPC_BINDING_HANDLE ClientBinding, ULONG *ClientPID)
 

Function Documentation

◆ escape_string_binding_component()

static RPC_CSTR escape_string_binding_component ( RPC_CSTR  string_binding,
const unsigned char component 
)
static

Definition at line 338 of file rpc_binding.c.

340 {
341  for (; *component; component++) {
342  switch (*component) {
343  case '@':
344  case ':':
345  case '[':
346  case ']':
347  case '\\':
348  *string_binding++ = '\\';
349  *string_binding++ = *component;
350  break;
351  default:
352  *string_binding++ = *component;
353  break;
354  }
355  }
356  return string_binding;
357 }

Referenced by RpcStringBindingComposeA().

◆ escape_string_binding_componentW()

static RPC_WSTR escape_string_binding_componentW ( RPC_WSTR  string_binding,
const WCHAR component 
)
static

Definition at line 359 of file rpc_binding.c.

361 {
362  for (; *component; component++) {
363  switch (*component) {
364  case '@':
365  case ':':
366  case '[':
367  case ']':
368  case '\\':
369  *string_binding++ = '\\';
370  *string_binding++ = *component;
371  break;
372  default:
373  *string_binding++ = *component;
374  break;
375  }
376  }
377  return string_binding;
378 }

Referenced by RpcStringBindingComposeW().

◆ has_nt_auth_identity()

static BOOL has_nt_auth_identity ( ULONG  AuthnLevel)
inlinestatic

Definition at line 1100 of file rpc_binding.c.

1101 {
1102  switch (AuthnLevel)
1103  {
1105  case RPC_C_AUTHN_WINNT:
1107  return TRUE;
1108  default:
1109  return FALSE;
1110  }
1111 }
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
#define TRUE
Definition: types.h:120
#define RPC_C_AUTHN_GSS_NEGOTIATE
Definition: rpcdce.h:157
#define RPC_C_AUTHN_GSS_KERBEROS
Definition: rpcdce.h:160

Referenced by RpcAuthInfo_Create(), and RpcAuthInfo_IsEqual().

◆ I_RpcBindingInqLocalClientPID()

RPC_STATUS WINAPI I_RpcBindingInqLocalClientPID ( RPC_BINDING_HANDLE  ClientBinding,
ULONG ClientPID 
)

Definition at line 1983 of file rpc_binding.c.

1984 {
1985  FIXME("%p %p: stub\n", ClientBinding, ClientPID);
1986  return RPC_S_INVALID_BINDING;
1987 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013

◆ I_RpcBindingInqTransportType()

RPC_STATUS WINAPI I_RpcBindingInqTransportType ( RPC_BINDING_HANDLE  Binding,
unsigned int Type 
)

Definition at line 957 of file rpc_binding.c.

958 {
959 
960  FIXME( "(%p,%p): stub\n", Binding, Type);
962  return RPC_S_OK;
963 }
Type
Definition: Type.h:6
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRANSPORT_TYPE_LPC
Definition: rpcdcep.h:137
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ I_RpcBindingSetAsync()

RPC_STATUS WINAPI I_RpcBindingSetAsync ( RPC_BINDING_HANDLE  Binding,
RPC_BLOCKING_FN  BlockingFn 
)

Definition at line 971 of file rpc_binding.c.

972 {
974 
975  TRACE( "(%p,%p): stub\n", Binding, BlockingFn );
976 
977  bind->BlockingFn = BlockingFn;
978 
979  return RPC_S_OK;
980 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define TRACE(s)
Definition: solgame.cpp:4
static IBinding Binding
Definition: htmldoc.c:1268
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ RpcAuthInfo_AddRef()

ULONG RpcAuthInfo_AddRef ( RpcAuthInfo AuthInfo)

Definition at line 1179 of file rpc_binding.c.

1180 {
1181  return InterlockedIncrement(&AuthInfo->refs);
1182 }
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by RpcBindingCopy(), and RPCRT4_CreateConnection().

◆ RpcAuthInfo_Create()

RPC_STATUS RpcAuthInfo_Create ( ULONG  AuthnLevel,
ULONG  AuthnSvc,
CredHandle  cred,
TimeStamp  exp,
ULONG  cbMaxToken,
RPC_AUTH_IDENTITY_HANDLE  identity,
RpcAuthInfo **  ret 
)

Definition at line 1113 of file rpc_binding.c.

1118 {
1119  RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo));
1120  if (!AuthInfo)
1121  return RPC_S_OUT_OF_MEMORY;
1122 
1123  AuthInfo->refs = 1;
1124  AuthInfo->AuthnLevel = AuthnLevel;
1125  AuthInfo->AuthnSvc = AuthnSvc;
1126  AuthInfo->cred = cred;
1127  AuthInfo->exp = exp;
1128  AuthInfo->cbMaxToken = cbMaxToken;
1129  AuthInfo->identity = identity;
1130  AuthInfo->server_principal_name = NULL;
1131 
1132  /* duplicate the SEC_WINNT_AUTH_IDENTITY structure, if applicable, to
1133  * enable better matching in RpcAuthInfo_IsEqual */
1134  if (identity && has_nt_auth_identity(AuthnSvc))
1135  {
1136  const SEC_WINNT_AUTH_IDENTITY_W *nt_identity = identity;
1137  AuthInfo->nt_identity = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo->nt_identity));
1138  if (!AuthInfo->nt_identity)
1139  {
1140  HeapFree(GetProcessHeap(), 0, AuthInfo);
1141  return RPC_S_OUT_OF_MEMORY;
1142  }
1143 
1145  if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1146  AuthInfo->nt_identity->User = RPCRT4_strndupW(nt_identity->User, nt_identity->UserLength);
1147  else
1148  AuthInfo->nt_identity->User = RPCRT4_strndupAtoW((const char *)nt_identity->User, nt_identity->UserLength);
1149  AuthInfo->nt_identity->UserLength = nt_identity->UserLength;
1150  if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1151  AuthInfo->nt_identity->Domain = RPCRT4_strndupW(nt_identity->Domain, nt_identity->DomainLength);
1152  else
1153  AuthInfo->nt_identity->Domain = RPCRT4_strndupAtoW((const char *)nt_identity->Domain, nt_identity->DomainLength);
1154  AuthInfo->nt_identity->DomainLength = nt_identity->DomainLength;
1155  if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1156  AuthInfo->nt_identity->Password = RPCRT4_strndupW(nt_identity->Password, nt_identity->PasswordLength);
1157  else
1158  AuthInfo->nt_identity->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength);
1159  AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength;
1160 
1161  if ((nt_identity->User && !AuthInfo->nt_identity->User) ||
1162  (nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
1163  (nt_identity->Password && !AuthInfo->nt_identity->Password))
1164  {
1165  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
1166  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
1167  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
1168  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
1169  HeapFree(GetProcessHeap(), 0, AuthInfo);
1170  return RPC_S_OUT_OF_MEMORY;
1171  }
1172  }
1173  else
1174  AuthInfo->nt_identity = NULL;
1175  *ret = AuthInfo;
1176  return RPC_S_OK;
1177 }
unsigned short * Domain
Definition: rpcdce.h:225
unsigned short * User
Definition: rpcdce.h:223
unsigned short * Password
Definition: rpcdce.h:227
LPWSTR server_principal_name
Definition: rpc_binding.h:50
ULONG cbMaxToken
Definition: rpc_binding.h:44
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
CredHandle cred
Definition: rpc_binding.h:42
smooth NULL
Definition: ftsmooth.c:416
static BOOL has_nt_auth_identity(ULONG AuthnLevel)
Definition: rpc_binding.c:1100
ULONG AuthnLevel
Definition: rpc_binding.h:40
static LPWSTR RPCRT4_strndupAtoW(LPCSTR src, INT slen)
Definition: rpc_binding.c:80
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SEC_WINNT_AUTH_IDENTITY_UNICODE
Definition: rpcdce.h:310
static const struct d3drm_matrix identity
Definition: frame.c:26
int ret
RPC_AUTH_IDENTITY_HANDLE * identity
Definition: rpc_binding.h:46
TimeStamp exp
Definition: rpc_binding.h:43
SEC_WINNT_AUTH_IDENTITY_W * nt_identity
Definition: rpc_binding.h:49
DWORD exp
Definition: msg.c:16038
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:91
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
ULONG AuthnSvc
Definition: rpc_binding.h:41

Referenced by RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), and RPCRT4_ServerConnectionAuth().

◆ RpcAuthInfo_IsEqual()

BOOL RpcAuthInfo_IsEqual ( const RpcAuthInfo AuthInfo1,
const RpcAuthInfo AuthInfo2 
)

Definition at line 1205 of file rpc_binding.c.

1206 {
1207  if (AuthInfo1 == AuthInfo2)
1208  return TRUE;
1209 
1210  if (!AuthInfo1 || !AuthInfo2)
1211  return FALSE;
1212 
1213  if ((AuthInfo1->AuthnLevel != AuthInfo2->AuthnLevel) ||
1214  (AuthInfo1->AuthnSvc != AuthInfo2->AuthnSvc))
1215  return FALSE;
1216 
1217  if (AuthInfo1->identity == AuthInfo2->identity)
1218  return TRUE;
1219 
1220  if (!AuthInfo1->identity || !AuthInfo2->identity)
1221  return FALSE;
1222 
1223  if (has_nt_auth_identity(AuthInfo1->AuthnSvc))
1224  {
1225  const SEC_WINNT_AUTH_IDENTITY_W *identity1 = AuthInfo1->nt_identity;
1226  const SEC_WINNT_AUTH_IDENTITY_W *identity2 = AuthInfo2->nt_identity;
1227  /* compare user names */
1228  if (identity1->UserLength != identity2->UserLength ||
1229  memcmp(identity1->User, identity2->User, identity1->UserLength))
1230  return FALSE;
1231  /* compare domain names */
1232  if (identity1->DomainLength != identity2->DomainLength ||
1233  memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
1234  return FALSE;
1235  /* compare passwords */
1236  if (identity1->PasswordLength != identity2->PasswordLength ||
1237  memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
1238  return FALSE;
1239  }
1240  else
1241  return FALSE;
1242 
1243  return TRUE;
1244 }
unsigned short * Domain
Definition: rpcdce.h:225
#define TRUE
Definition: types.h:120
unsigned short * User
Definition: rpcdce.h:223
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned short * Password
Definition: rpcdce.h:227
static BOOL has_nt_auth_identity(ULONG AuthnLevel)
Definition: rpc_binding.c:1100
ULONG AuthnLevel
Definition: rpc_binding.h:40
RPC_AUTH_IDENTITY_HANDLE * identity
Definition: rpc_binding.h:46
SEC_WINNT_AUTH_IDENTITY_W * nt_identity
Definition: rpc_binding.h:49
ULONG AuthnSvc
Definition: rpc_binding.h:41

Referenced by RpcAssoc_GetIdleConnection().

◆ RpcAuthInfo_Release()

ULONG RpcAuthInfo_Release ( RpcAuthInfo AuthInfo)

Definition at line 1184 of file rpc_binding.c.

1185 {
1186  ULONG refs = InterlockedDecrement(&AuthInfo->refs);
1187 
1188  if (!refs)
1189  {
1190  FreeCredentialsHandle(&AuthInfo->cred);
1191  if (AuthInfo->nt_identity)
1192  {
1193  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
1194  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
1195  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
1196  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
1197  }
1199  HeapFree(GetProcessHeap(), 0, AuthInfo);
1200  }
1201 
1202  return refs;
1203 }
unsigned short * Domain
Definition: rpcdce.h:225
unsigned short * User
Definition: rpcdce.h:223
unsigned short * Password
Definition: rpcdce.h:227
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
LPWSTR server_principal_name
Definition: rpc_binding.h:50
CredHandle cred
Definition: rpc_binding.h:42
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
SEC_WINNT_AUTH_IDENTITY_W * nt_identity
Definition: rpc_binding.h:49
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by get_epm_handle_client(), RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), RPCRT4_ReleaseBinding(), RPCRT4_ReleaseConnection(), and RPCRT4_ServerConnectionAuth().

◆ RpcBindingCopy()

RPC_STATUS RPC_ENTRY RpcBindingCopy ( RPC_BINDING_HANDLE  SourceBinding,
RPC_BINDING_HANDLE DestinationBinding 
)

Definition at line 985 of file rpc_binding.c.

988 {
989  RpcBinding *DestBinding;
990  RpcBinding *SrcBinding = SourceBinding;
992 
993  TRACE("(%p, %p)\n", SourceBinding, DestinationBinding);
994 
995  status = RPCRT4_AllocBinding(&DestBinding, SrcBinding->server);
996  if (status != RPC_S_OK) return status;
997 
998  DestBinding->ObjectUuid = SrcBinding->ObjectUuid;
999  DestBinding->BlockingFn = SrcBinding->BlockingFn;
1000  DestBinding->Protseq = RPCRT4_strndupA(SrcBinding->Protseq, -1);
1001  DestBinding->NetworkAddr = RPCRT4_strndupA(SrcBinding->NetworkAddr, -1);
1002  DestBinding->Endpoint = RPCRT4_strndupA(SrcBinding->Endpoint, -1);
1003  DestBinding->NetworkOptions = RPCRT4_strdupW(SrcBinding->NetworkOptions);
1004  DestBinding->CookieAuth = RPCRT4_strdupW(SrcBinding->CookieAuth);
1005  if (SrcBinding->Assoc) SrcBinding->Assoc->refs++;
1006  DestBinding->Assoc = SrcBinding->Assoc;
1007 
1008  if (SrcBinding->AuthInfo) RpcAuthInfo_AddRef(SrcBinding->AuthInfo);
1009  DestBinding->AuthInfo = SrcBinding->AuthInfo;
1010  if (SrcBinding->QOS) RpcQualityOfService_AddRef(SrcBinding->QOS);
1011  DestBinding->QOS = SrcBinding->QOS;
1012 
1013  *DestinationBinding = DestBinding;
1014  return RPC_S_OK;
1015 }
struct _RpcAssoc * Assoc
Definition: rpc_binding.h:137
LPSTR Protseq
Definition: rpc_binding.h:130
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding **Binding, BOOL server)
Definition: rpc_binding.c:109
long RPC_STATUS
Definition: rpc.h:52
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1179
LPWSTR NetworkOptions
Definition: rpc_binding.h:133
RpcQualityOfService * QOS
Definition: rpc_binding.h:141
LPSTR Endpoint
Definition: rpc_binding.h:132
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR RPCRT4_strndupA(LPCSTR src, INT slen)
Definition: rpc_binding.c:45
RPC_BLOCKING_FN BlockingFn
Definition: rpc_binding.h:134
LPWSTR CookieAuth
Definition: rpc_binding.h:142
UUID ObjectUuid
Definition: rpc_binding.h:129
LPSTR NetworkAddr
Definition: rpc_binding.h:131
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos)
Definition: rpc_binding.c:1356
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:140
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by get_epm_handle_client(), and ndr_update_context_handle().

◆ RpcBindingFree()

RPC_STATUS WINAPI RpcBindingFree ( RPC_BINDING_HANDLE Binding)

Definition at line 783 of file rpc_binding.c.

784 {
786  TRACE("(%p) = %p\n", Binding, *Binding);
787  if (*Binding)
789  else
791  if (status == RPC_S_OK) *Binding = NULL;
792  return status;
793 }
long RPC_STATUS
Definition: rpc.h:52
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:254
#define TRACE(s)
Definition: solgame.cpp:4
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by ATSVC_HANDLE_unbind(), BROWSER_IDENTIFY_HANDLE_unbind(), client(), ClientRpcChannelBuffer_Release(), CreateJob(), DNSRSLVR_HANDLE_unbind(), DsSetupUnbind(), epm_register(), EVENTLOG_HANDLE_A_unbind(), EVENTLOG_HANDLE_W_unbind(), get_irot_handle(), listen_test_client_thread(), LOGONSRV_HANDLE_unbind(), main(), ndr_update_context_handle(), NetpUnbind(), PLSAPR_SERVER_NAME_unbind(), PnpUnbindRpc(), PREGISTRY_SERVER_NAME_unbind(), PSAMPR_SERVER_NAME_unbind(), RPC_CreateClientChannel(), RpcBindingVectorFree(), RpcEpResolveBinding(), RpcEpUnregister(), RpcSmDestroyClientContext(), RunningObjectTableImpl_Destroy(), s_context_handle_test(), ScDestroyStatusBinding(), SRVSVC_HANDLE_unbind(), SVCCTL_HANDLEA_unbind(), SVCCTL_HANDLEW_unbind(), test_endpoint_mapper(), test_ndr_buffer(), test_reconnect(), test_rpc_ncacn_ip_tcp(), test_RpcBindingFree(), test_RpcStringBindingFromBinding(), WINSPOOL_HANDLE_unbind(), WKSSVC_IDENTIFY_HANDLE_unbind(), WKSSVC_IMPERSONATE_HANDLE_unbind(), and WLANSVC_HANDLE_unbind().

◆ RpcBindingFromStringBindingA()

RPC_STATUS WINAPI RpcBindingFromStringBindingA ( RPC_CSTR  StringBinding,
RPC_BINDING_HANDLE Binding 
)

Definition at line 836 of file rpc_binding.c.

837 {
838  RPC_STATUS ret;
839  RpcBinding* bind = NULL;
840  RPC_CSTR ObjectUuid, Protseq, NetworkAddr, Endpoint, Options;
841  UUID Uuid;
842 
843  TRACE("(%s,%p)\n", debugstr_a((char*)StringBinding), Binding);
844 
845  ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq,
846  &NetworkAddr, &Endpoint, &Options);
847  if (ret != RPC_S_OK) return ret;
848 
849  ret = UuidFromStringA(ObjectUuid, &Uuid);
850 
851  if (ret == RPC_S_OK)
852  ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq);
853  if (ret == RPC_S_OK) {
854  ret = RPCRT4_SetBindingObject(bind, &Uuid);
855  if (ret == RPC_S_OK)
856  ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint, (char*)Options);
857 
858  if (ret == RPC_S_OK)
860  else
862  }
863 
865  RpcStringFreeA(&Endpoint);
866  RpcStringFreeA(&NetworkAddr);
867  RpcStringFreeA(&Protseq);
868  RpcStringFreeA(&ObjectUuid);
869 
870  return ret;
871 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
static RPC_STATUS RPCRT4_CreateBindingA(RpcBinding **Binding, BOOL server, LPCSTR Protseq)
Definition: rpc_binding.c:122
RPC_STATUS WINAPI RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR *ObjUuid, RPC_CSTR *Protseq, RPC_CSTR *NetworkAddr, RPC_CSTR *Endpoint, RPC_CSTR *Options)
Definition: rpc_binding.c:564
static RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding *Binding, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCSTR NetworkOptions)
Definition: rpc_binding.c:148
enum OPTION_FLAGS Options
Definition: stats.c:44
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:158
long RPC_STATUS
Definition: rpc.h:52
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:254
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid)
Definition: rpc_binding.c:224
I_RPC_HANDLE RPC_BINDING_HANDLE
Definition: rpcdce.h:50
RPC_STATUS WINAPI UuidFromStringA(RPC_CSTR s, UUID *uuid)
Definition: rpcrt4_main.c:572
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by client(), EVENTLOG_HANDLE_A_bind(), get_epm_handle_server(), listen_test_client_thread(), SVCCTL_HANDLEA_bind(), test_endpoint_mapper(), test_ndr_buffer(), test_reconnect(), test_rpc_ncacn_ip_tcp(), and test_RpcStringBindingFromBinding().

◆ RpcBindingFromStringBindingW()

RPC_STATUS WINAPI RpcBindingFromStringBindingW ( RPC_WSTR  StringBinding,
RPC_BINDING_HANDLE Binding 
)

Definition at line 876 of file rpc_binding.c.

877 {
878  RPC_STATUS ret;
879  RpcBinding* bind = NULL;
880  RPC_WSTR ObjectUuid, Protseq, NetworkAddr, Endpoint, Options;
881  UUID Uuid;
882 
883  TRACE("(%s,%p)\n", debugstr_w(StringBinding), Binding);
884 
885  ret = RpcStringBindingParseW(StringBinding, &ObjectUuid, &Protseq,
886  &NetworkAddr, &Endpoint, &Options);
887  if (ret != RPC_S_OK) return ret;
888 
889  ret = UuidFromStringW(ObjectUuid, &Uuid);
890 
891  if (ret == RPC_S_OK)
892  ret = RPCRT4_CreateBindingW(&bind, FALSE, Protseq);
893  if (ret == RPC_S_OK) {
894  ret = RPCRT4_SetBindingObject(bind, &Uuid);
895  if (ret == RPC_S_OK)
896  ret = RPCRT4_CompleteBindingW(bind, NetworkAddr, Endpoint, Options);
897 
898  if (ret == RPC_S_OK)
900  else
902  }
903 
905  RpcStringFreeW(&Endpoint);
906  RpcStringFreeW(&NetworkAddr);
907  RpcStringFreeW(&Protseq);
908  RpcStringFreeW(&ObjectUuid);
909 
910  return ret;
911 }
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
static RPC_STATUS RPCRT4_CreateBindingW(RpcBinding **Binding, BOOL server, LPCWSTR Protseq)
Definition: rpc_binding.c:135
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
enum OPTION_FLAGS Options
Definition: stats.c:44
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:612
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:254
RPC_STATUS WINAPI RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR *ObjUuid, RPC_WSTR *Protseq, RPC_WSTR *NetworkAddr, RPC_WSTR *Endpoint, RPC_WSTR *Options)
Definition: rpc_binding.c:674
#define TRACE(s)
Definition: solgame.cpp:4
int ret
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid)
Definition: rpc_binding.c:224
I_RPC_HANDLE RPC_BINDING_HANDLE
Definition: rpcdce.h:50
static RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding *Binding, LPCWSTR NetworkAddr, LPCWSTR Endpoint, LPCWSTR NetworkOptions)
Definition: rpc_binding.c:176
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by ATSVC_HANDLE_bind(), BROWSER_IDENTIFY_HANDLE_bind(), DNSRSLVR_HANDLE_bind(), DsSetupBind(), EVENTLOG_HANDLE_W_bind(), get_irot_handle(), LOGONSRV_HANDLE_bind(), NetpBind(), PLSAPR_SERVER_NAME_bind(), PnpBindRpc(), PREGISTRY_SERVER_NAME_bind(), PSAMPR_SERVER_NAME_bind(), RPC_CreateClientChannel(), ScCreateStatusBinding(), SRVSVC_HANDLE_bind(), SVCCTL_HANDLEW_bind(), WINSPOOL_HANDLE_bind(), WKSSVC_IDENTIFY_HANDLE_bind(), WKSSVC_IMPERSONATE_HANDLE_bind(), and WLANSVC_HANDLE_bind().

◆ RpcBindingInqAuthClientA()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientA ( RPC_BINDING_HANDLE  ClientBinding,
RPC_AUTHZ_HANDLE Privs,
RPC_CSTR ServerPrincName,
ULONG AuthnLevel,
ULONG AuthnSvc,
ULONG AuthzSvc 
)

Definition at line 1568 of file rpc_binding.c.

1571 {
1572  return RpcBindingInqAuthClientExA(ClientBinding, Privs, ServerPrincName, AuthnLevel,
1573  AuthnSvc, AuthzSvc, 0);
1574 }
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc, ULONG Flags)
Definition: rpc_binding.c:1592

Referenced by s_authinfo_test().

◆ RpcBindingInqAuthClientExA()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExA ( RPC_BINDING_HANDLE  ClientBinding,
RPC_AUTHZ_HANDLE Privs,
RPC_CSTR ServerPrincName,
ULONG AuthnLevel,
ULONG AuthnSvc,
ULONG AuthzSvc,
ULONG  Flags 
)

Definition at line 1592 of file rpc_binding.c.

1595 {
1597  RPC_WSTR principal;
1598 
1599  TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
1600  AuthnSvc, AuthzSvc, Flags);
1601 
1602  status = RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName ? &principal : NULL,
1603  AuthnLevel, AuthnSvc, AuthzSvc, Flags);
1604  if (status == RPC_S_OK && ServerPrincName)
1605  {
1606  *ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
1607  if (!*ServerPrincName && principal) status = RPC_S_OUT_OF_MEMORY;
1608  RpcStringFreeW(&principal);
1609  }
1610 
1611  return status;
1612 }
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:58
long RPC_STATUS
Definition: rpc.h:52
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc, ULONG Flags)
Definition: rpc_binding.c:1618
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by RpcBindingInqAuthClientA(), and s_authinfo_test().

◆ RpcBindingInqAuthClientExW()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExW ( RPC_BINDING_HANDLE  ClientBinding,
RPC_AUTHZ_HANDLE Privs,
RPC_WSTR ServerPrincName,
ULONG AuthnLevel,
ULONG AuthnSvc,
ULONG AuthzSvc,
ULONG  Flags 
)

Definition at line 1618 of file rpc_binding.c.

1621 {
1622  RpcBinding *bind;
1623 
1624  TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
1625  AuthnSvc, AuthzSvc, Flags);
1626 
1627  if (!ClientBinding) ClientBinding = I_RpcGetCurrentCallHandle();
1628  if (!ClientBinding) return RPC_S_INVALID_BINDING;
1629 
1630  bind = ClientBinding;
1631  if (!bind->FromConn) return RPC_S_INVALID_BINDING;
1632 
1633  return rpcrt4_conn_inquire_auth_client(bind->FromConn, Privs,
1634  ServerPrincName, AuthnLevel,
1635  AuthnSvc, AuthzSvc, Flags);
1636 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
#define TRACE(s)
Definition: solgame.cpp:4
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1743
static RPC_STATUS rpcrt4_conn_inquire_auth_client(RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
Definition: rpc_binding.h:253

Referenced by RpcBindingInqAuthClientExA(), and RpcBindingInqAuthClientW().

◆ RpcBindingInqAuthClientW()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientW ( RPC_BINDING_HANDLE  ClientBinding,
RPC_AUTHZ_HANDLE Privs,
RPC_WSTR ServerPrincName,
ULONG AuthnLevel,
ULONG AuthnSvc,
ULONG AuthzSvc 
)

Definition at line 1580 of file rpc_binding.c.

1583 {
1584  return RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName, AuthnLevel,
1585  AuthnSvc, AuthzSvc, 0);
1586 }
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc, ULONG Flags)
Definition: rpc_binding.c:1618

◆ RpcBindingInqAuthInfoA()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthInfoA ( RPC_BINDING_HANDLE  Binding,
RPC_CSTR ServerPrincName,
ULONG AuthnLevel,
ULONG AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
ULONG AuthzSvc 
)

Definition at line 1546 of file rpc_binding.c.

1548 {
1549  return RpcBindingInqAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity,
1550  AuthzSvc, 0, NULL);
1551 }
smooth NULL
Definition: ftsmooth.c:416
RPCRTAPI RPC_STATUS RPC_ENTRY 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)
Definition: rpc_binding.c:1478

Referenced by test_rpc_ncacn_ip_tcp().

◆ RpcBindingInqAuthInfoExA()

RPCRTAPI RPC_STATUS RPC_ENTRY 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 
)

Definition at line 1478 of file rpc_binding.c.

1481 {
1483  RPC_WSTR principal;
1484 
1485  TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
1486  AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
1487 
1488  status = RpcBindingInqAuthInfoExW(Binding, ServerPrincName ? &principal : NULL, AuthnLevel,
1489  AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
1490  if (status == RPC_S_OK && ServerPrincName)
1491  {
1492  *ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
1493  RpcStringFreeW(&principal);
1494  if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
1495  }
1496 
1497  return status;
1498 }
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:58
long RPC_STATUS
Definition: rpc.h:52
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
RPCRTAPI RPC_STATUS RPC_ENTRY 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)
Definition: rpc_binding.c:1504
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by RpcBindingInqAuthInfoA().

◆ RpcBindingInqAuthInfoExW()

RPCRTAPI RPC_STATUS RPC_ENTRY 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 
)

Definition at line 1504 of file rpc_binding.c.

1507 {
1508  RpcBinding *bind = Binding;
1509 
1510  TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
1511  AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
1512 
1513  if (!bind->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH;
1514 
1515  if (SecurityQOS)
1516  {
1517  FIXME("QOS not implemented\n");
1518  return RPC_S_INVALID_BINDING;
1519  }
1520 
1521  if (ServerPrincName)
1522  {
1523  if (bind->AuthInfo->server_principal_name)
1524  {
1525  *ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name);
1526  if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
1527  }
1528  else *ServerPrincName = NULL;
1529  }
1530  if (AuthnLevel) *AuthnLevel = bind->AuthInfo->AuthnLevel;
1531  if (AuthnSvc) *AuthnSvc = bind->AuthInfo->AuthnSvc;
1532  if (AuthIdentity) *AuthIdentity = bind->AuthInfo->identity;
1533  if (AuthzSvc)
1534  {
1535  FIXME("authorization service not implemented\n");
1536  *AuthzSvc = RPC_C_AUTHZ_NONE;
1537  }
1538 
1539  return RPC_S_OK;
1540 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static IBinding Binding
Definition: htmldoc.c:1268
#define RPC_S_BINDING_HAS_NO_AUTH
Definition: winerror.h:1054
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
#define RPC_C_AUTHZ_NONE
Definition: rpcdce.h:167
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcBindingInqAuthInfoExA(), and RpcBindingInqAuthInfoW().

◆ RpcBindingInqAuthInfoW()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthInfoW ( RPC_BINDING_HANDLE  Binding,
RPC_WSTR ServerPrincName,
ULONG AuthnLevel,
ULONG AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
ULONG AuthzSvc 
)

Definition at line 1557 of file rpc_binding.c.

1559 {
1560  return RpcBindingInqAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity,
1561  AuthzSvc, 0, NULL);
1562 }
smooth NULL
Definition: ftsmooth.c:416
RPCRTAPI RPC_STATUS RPC_ENTRY 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)
Definition: rpc_binding.c:1504

◆ RpcBindingInqObject()

RPC_STATUS WINAPI RpcBindingInqObject ( RPC_BINDING_HANDLE  Binding,
UUID ObjectUuid 
)

Definition at line 812 of file rpc_binding.c.

813 {
815 
816  TRACE("(%p,%p) = %s\n", Binding, ObjectUuid, debugstr_guid(&bind->ObjectUuid));
817  *ObjectUuid = bind->ObjectUuid;
818  return RPC_S_OK;
819 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static IBinding Binding
Definition: htmldoc.c:1268
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by ClientRpcChannelBuffer_GetBuffer(), and dispatch_rpc().

◆ RpcBindingReset()

RPC_STATUS RPC_ENTRY RpcBindingReset ( RPC_BINDING_HANDLE  Binding)

Definition at line 1020 of file rpc_binding.c.

1021 {
1022  RpcBinding *bind = Binding;
1023 
1024  TRACE("(%p)\n", Binding);
1025 
1026  RPCRT4_strfree(bind->Endpoint);
1027  bind->Endpoint = NULL;
1028  if (bind->Assoc) RpcAssoc_Release(bind->Assoc);
1029  bind->Assoc = NULL;
1030 
1031  return RPC_S_OK;
1032 }
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:187
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static IBinding Binding
Definition: htmldoc.c:1268
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by test_endpoint_mapper().

◆ RpcBindingServerFromClient()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingServerFromClient ( RPC_BINDING_HANDLE  ClientBinding,
RPC_BINDING_HANDLE ServerBinding 
)

Definition at line 1642 of file rpc_binding.c.

1643 {
1644  RpcBinding* bind = ClientBinding;
1645  RpcBinding* NewBinding;
1646 
1647  if (!bind)
1649 
1650  if (!bind->server)
1651  return RPC_S_INVALID_BINDING;
1652 
1653  RPCRT4_AllocBinding(&NewBinding, TRUE);
1654  NewBinding->Protseq = RPCRT4_strdupA(bind->Protseq);
1655  NewBinding->NetworkAddr = RPCRT4_strdupA(bind->NetworkAddr);
1656 
1657  *ServerBinding = NewBinding;
1658 
1659  return RPC_S_OK;
1660 }
#define TRUE
Definition: types.h:120
LPSTR Protseq
Definition: rpc_binding.h:130
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding **Binding, BOOL server)
Definition: rpc_binding.c:109
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1743
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
LPSTR NetworkAddr
Definition: rpc_binding.h:131
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by CreateJob(), and s_context_handle_test().

◆ RpcBindingSetAuthInfoA()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoA ( RPC_BINDING_HANDLE  Binding,
RPC_CSTR  ServerPrincName,
ULONG  AuthnLevel,
ULONG  AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE  AuthIdentity,
ULONG  AuthzSvr 
)

Definition at line 1929 of file rpc_binding.c.

1931 {
1932  TRACE("%p %s %u %u %p %u\n", Binding, debugstr_a((const char*)ServerPrincName),
1933  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
1934  return RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
1935 }
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr, RPC_SECURITY_QOS *SecurityQos)
Definition: rpc_binding.c:1666
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

Referenced by test_rpc_ncacn_ip_tcp().

◆ RpcBindingSetAuthInfoExA()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoExA ( RPC_BINDING_HANDLE  Binding,
RPC_CSTR  ServerPrincName,
ULONG  AuthnLevel,
ULONG  AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE  AuthIdentity,
ULONG  AuthzSvr,
RPC_SECURITY_QOS SecurityQos 
)

Definition at line 1666 of file rpc_binding.c.

1670 {
1671  RpcBinding* bind = Binding;
1673  CredHandle cred;
1674  TimeStamp exp;
1675  ULONG package_count;
1676  ULONG i;
1677  PSecPkgInfoA packages;
1678  ULONG cbMaxToken;
1679 
1680  TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_a((const char*)ServerPrincName),
1681  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
1682 
1683  if (SecurityQos)
1684  {
1686 
1687  TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
1688  SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
1689  if (SecurityQos->Version >= 2)
1690  {
1691  const RPC_SECURITY_QOS_V2_A *SecurityQos2 = (const RPC_SECURITY_QOS_V2_A *)SecurityQos;
1692  TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
1694  TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
1695  SecurityQos2->u.HttpCredentials->TransportCredentials,
1696  SecurityQos2->u.HttpCredentials->Flags,
1697  SecurityQos2->u.HttpCredentials->AuthenticationTarget,
1698  SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
1699  SecurityQos2->u.HttpCredentials->AuthnSchemes,
1700  SecurityQos2->u.HttpCredentials->AuthnSchemes ? *SecurityQos2->u.HttpCredentials->AuthnSchemes : 0,
1701  SecurityQos2->u.HttpCredentials->ServerCertificateSubject);
1702  }
1703  TRACE("}\n");
1704  status = RpcQualityOfService_Create(SecurityQos, FALSE, &bind->QOS);
1705  if (status != RPC_S_OK)
1706  return status;
1707  }
1708  else
1709  {
1710  if (bind->QOS) RpcQualityOfService_Release(bind->QOS);
1711  bind->QOS = NULL;
1712  }
1713 
1714  if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
1715  AuthnSvc = RPC_C_AUTHN_WINNT;
1716 
1717  /* FIXME: the mapping should probably be retrieved using SSPI somehow */
1718  if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
1719  AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
1720 
1721  if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
1722  {
1723  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1724  bind->AuthInfo = NULL;
1725  return RPC_S_OK;
1726  }
1727 
1728  if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
1729  {
1730  FIXME("unknown AuthnLevel %u\n", AuthnLevel);
1732  }
1733 
1734  /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
1735  if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
1736  {
1737  FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
1739  }
1740 
1741  r = EnumerateSecurityPackagesA(&package_count, &packages);
1742  if (r != SEC_E_OK)
1743  {
1744  ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", r);
1745  return RPC_S_SEC_PKG_ERROR;
1746  }
1747 
1748  for (i = 0; i < package_count; i++)
1749  if (packages[i].wRPCID == AuthnSvc)
1750  break;
1751 
1752  if (i == package_count)
1753  {
1754  FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
1755  FreeContextBuffer(packages);
1757  }
1758 
1759  TRACE("found package %s for service %u\n", packages[i].Name, AuthnSvc);
1761  AuthIdentity, NULL, NULL, &cred, &exp);
1762  cbMaxToken = packages[i].cbMaxToken;
1763  FreeContextBuffer(packages);
1764  if (r == ERROR_SUCCESS)
1765  {
1766  RpcAuthInfo *new_auth_info;
1767  r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
1768  AuthIdentity, &new_auth_info);
1769  if (r == RPC_S_OK)
1770  {
1771  new_auth_info->server_principal_name = RPCRT4_strdupAtoW((char *)ServerPrincName);
1772  if (!ServerPrincName || new_auth_info->server_principal_name)
1773  {
1774  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1775  bind->AuthInfo = new_auth_info;
1776  }
1777  else
1778  {
1779  RpcAuthInfo_Release(new_auth_info);
1781  }
1782  }
1783  else
1784  FreeCredentialsHandle(&cred);
1785  return r;
1786  }
1787  else
1788  {
1789  ERR("AcquireCredentialsHandleA failed with error 0x%08x\n", r);
1790  return RPC_S_SEC_PKG_ERROR;
1791  }
1792 }
SEC_WINNT_AUTH_IDENTITY_A * TransportCredentials
Definition: rpcdce.h:255
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:278
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1184
ULONG ImpersonationType
Definition: rpcdce.h:267
#define ERROR_SUCCESS
Definition: deptool.c:10
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
union _RPC_SECURITY_QOS_V2_A::@3108 u
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define RPC_C_AUTHN_LEVEL_DEFAULT
Definition: rpcdce.h:145
SECURITY_STATUS WINAPI EnumerateSecurityPackagesA(PULONG pcPackages, PSecPkgInfoA *ppPackageInfo)
Definition: sspi.c:855
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
RPC_HTTP_TRANSPORT_CREDENTIALS_A * HttpCredentials
Definition: rpcdce.h:292
#define RPC_C_AUTHN_DEFAULT
Definition: rpcdce.h:165
LPWSTR server_principal_name
Definition: rpc_binding.h:50
ULONG Capabilities
Definition: rpcdce.h:265
#define RPC_S_UNKNOWN_AUTHN_LEVEL
Definition: winerror.h:1056
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1361
long RPC_STATUS
Definition: rpc.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret)
Definition: rpc_binding.c:1113
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_SEC_PKG_ERROR
Definition: winerror.h:1132
smooth NULL
Definition: ftsmooth.c:416
ULONG IdentityTracking
Definition: rpcdce.h:266
LONG SECURITY_STATUS
Definition: sspi.h:34
#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY
Definition: rpcdce.h:151
#define TRACE(s)
Definition: solgame.cpp:4
SECURITY_STATUS WINAPI AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: wrapper.c:59
#define debugstr_a
Definition: kernel32.h:31
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:69
#define RPC_C_AUTHN_NONE
Definition: rpcdce.h:153
#define RPC_S_UNKNOWN_AUTHN_SERVICE
Definition: winerror.h:1055
#define SEC_E_OK
Definition: winerror.h:2356
static IBinding Binding
Definition: htmldoc.c:1268
#define ERR(fmt,...)
Definition: debug.h:109
static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BOOL unicode, RpcQualityOfService **qos_dst)
Definition: rpc_binding.c:1246
DWORD exp
Definition: msg.c:16038
unsigned char * ServerCertificateSubject
Definition: rpcdce.h:260
#define RPC_S_UNKNOWN_AUTHZ_SERVICE
Definition: winerror.h:1058
unsigned int ULONG
Definition: retypes.h:1
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_C_AUTHN_LEVEL_NONE
Definition: rpcdce.h:146
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:289
#define RPC_S_OK
Definition: rpcnterr.h:22
ULONG cbMaxToken
Definition: sspi.h:94
Definition: ps.c:97

Referenced by RpcBindingSetAuthInfoA().

◆ RpcBindingSetAuthInfoExW()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoExW ( RPC_BINDING_HANDLE  Binding,
RPC_WSTR  ServerPrincName,
ULONG  AuthnLevel,
ULONG  AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE  AuthIdentity,
ULONG  AuthzSvr,
RPC_SECURITY_QOS SecurityQos 
)

Definition at line 1798 of file rpc_binding.c.

1801 {
1802  RpcBinding* bind = Binding;
1804  CredHandle cred;
1805  TimeStamp exp;
1806  ULONG package_count;
1807  ULONG i;
1808  PSecPkgInfoW packages;
1809  ULONG cbMaxToken;
1810 
1811  TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w(ServerPrincName),
1812  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
1813 
1814  if (SecurityQos)
1815  {
1817 
1818  TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
1819  SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
1820  if (SecurityQos->Version >= 2)
1821  {
1822  const RPC_SECURITY_QOS_V2_W *SecurityQos2 = (const RPC_SECURITY_QOS_V2_W *)SecurityQos;
1823  TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
1825  TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
1826  SecurityQos2->u.HttpCredentials->TransportCredentials,
1827  SecurityQos2->u.HttpCredentials->Flags,
1828  SecurityQos2->u.HttpCredentials->AuthenticationTarget,
1829  SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
1830  SecurityQos2->u.HttpCredentials->AuthnSchemes,
1831  SecurityQos2->u.HttpCredentials->AuthnSchemes ? *SecurityQos2->u.HttpCredentials->AuthnSchemes : 0,
1833  }
1834  TRACE("}\n");
1835  status = RpcQualityOfService_Create(SecurityQos, TRUE, &bind->QOS);
1836  if (status != RPC_S_OK)
1837  return status;
1838  }
1839  else
1840  {
1841  if (bind->QOS) RpcQualityOfService_Release(bind->QOS);
1842  bind->QOS = NULL;
1843  }
1844 
1845  if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
1846  AuthnSvc = RPC_C_AUTHN_WINNT;
1847 
1848  /* FIXME: the mapping should probably be retrieved using SSPI somehow */
1849  if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
1850  AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
1851 
1852  if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
1853  {
1854  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1855  bind->AuthInfo = NULL;
1856  return RPC_S_OK;
1857  }
1858 
1859  if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
1860  {
1861  FIXME("unknown AuthnLevel %u\n", AuthnLevel);
1863  }
1864 
1865  /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
1866  if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
1867  {
1868  FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
1870  }
1871 
1872  r = EnumerateSecurityPackagesW(&package_count, &packages);
1873  if (r != SEC_E_OK)
1874  {
1875  ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", r);
1876  return RPC_S_SEC_PKG_ERROR;
1877  }
1878 
1879  for (i = 0; i < package_count; i++)
1880  if (packages[i].wRPCID == AuthnSvc)
1881  break;
1882 
1883  if (i == package_count)
1884  {
1885  FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
1886  FreeContextBuffer(packages);
1888  }
1889 
1890  TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), AuthnSvc);
1892  AuthIdentity, NULL, NULL, &cred, &exp);
1893  cbMaxToken = packages[i].cbMaxToken;
1894  FreeContextBuffer(packages);
1895  if (r == ERROR_SUCCESS)
1896  {
1897  RpcAuthInfo *new_auth_info;
1898  r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
1899  AuthIdentity, &new_auth_info);
1900  if (r == RPC_S_OK)
1901  {
1902  new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName);
1903  if (!ServerPrincName || new_auth_info->server_principal_name)
1904  {
1905  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1906  bind->AuthInfo = new_auth_info;
1907  }
1908  else
1909  {
1910  RpcAuthInfo_Release(new_auth_info);
1912  }
1913  }
1914  else
1915  FreeCredentialsHandle(&cred);
1916  return r;
1917  }
1918  else
1919  {
1920  ERR("AcquireCredentialsHandleW failed with error 0x%08x\n", r);
1921  return RPC_S_SEC_PKG_ERROR;
1922  }
1923 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
#define TRUE
Definition: types.h:120
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:278
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1184
ULONG ImpersonationType
Definition: rpcdce.h:267
#define ERROR_SUCCESS
Definition: deptool.c:10
SECURITY_STATUS WINAPI AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: wrapper.c:105
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define RPC_C_AUTHN_LEVEL_DEFAULT
Definition: rpcdce.h:145
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages, PSecPkgInfoW *ppPackageInfo)
Definition: sspi.c:709
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
#define RPC_C_AUTHN_DEFAULT
Definition: rpcdce.h:165
LPWSTR server_principal_name
Definition: rpc_binding.h:50
ULONG Capabilities
Definition: rpcdce.h:265
unsigned short * ServerCertificateSubject
Definition: rpcdce.h:250
#define RPC_S_UNKNOWN_AUTHN_LEVEL
Definition: winerror.h:1056
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1361
long RPC_STATUS
Definition: rpc.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
ULONG cbMaxToken
Definition: sspi.h:104
#define debugstr_w
Definition: kernel32.h:32
RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret)
Definition: rpc_binding.c:1113
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_SEC_PKG_ERROR
Definition: winerror.h:1132
smooth NULL
Definition: ftsmooth.c:416
ULONG IdentityTracking
Definition: rpcdce.h:266
LONG SECURITY_STATUS
Definition: sspi.h:34
#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY
Definition: rpcdce.h:151
#define TRACE(s)
Definition: solgame.cpp:4
#define RPC_C_AUTHN_NONE
Definition: rpcdce.h:153
#define RPC_S_UNKNOWN_AUTHN_SERVICE
Definition: winerror.h:1055
#define SEC_E_OK
Definition: winerror.h:2356
static IBinding Binding
Definition: htmldoc.c:1268
#define ERR(fmt,...)
Definition: debug.h:109
static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BOOL unicode, RpcQualityOfService **qos_dst)
Definition: rpc_binding.c:1246
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
DWORD exp
Definition: msg.c:16038
#define RPC_S_UNKNOWN_AUTHZ_SERVICE
Definition: winerror.h:1058
unsigned int ULONG
Definition: retypes.h:1
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_C_AUTHN_LEVEL_NONE
Definition: rpcdce.h:146
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by RpcBindingSetAuthInfoW().

◆ RpcBindingSetAuthInfoW()

RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoW ( RPC_BINDING_HANDLE  Binding,
RPC_WSTR  ServerPrincName,
ULONG  AuthnLevel,
ULONG  AuthnSvc,
RPC_AUTH_IDENTITY_HANDLE  AuthIdentity,
ULONG  AuthzSvr 
)

Definition at line 1941 of file rpc_binding.c.

1943 {
1944  TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w(ServerPrincName),
1945  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
1946  return RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
1947 }
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr, RPC_SECURITY_QOS *SecurityQos)
Definition: rpc_binding.c:1798
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

◆ RpcBindingSetObject()

RPC_STATUS WINAPI RpcBindingSetObject ( RPC_BINDING_HANDLE  Binding,
UUID ObjectUuid 
)

Definition at line 824 of file rpc_binding.c.

825 {
827 
828  TRACE("(%p,%s)\n", Binding, debugstr_guid(ObjectUuid));
829  if (bind->server) return RPC_S_WRONG_KIND_OF_BINDING;
830  return RPCRT4_SetBindingObject(Binding, ObjectUuid);
831 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define RPC_S_WRONG_KIND_OF_BINDING
Definition: winerror.h:1012
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static IBinding Binding
Definition: htmldoc.c:1268
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid)
Definition: rpc_binding.c:224

Referenced by RPC_CreateClientChannel().

◆ RpcBindingSetOption()

RPC_STATUS WINAPI RpcBindingSetOption ( RPC_BINDING_HANDLE  BindingHandle,
ULONG  Option,
ULONG_PTR  OptionValue 
)

Definition at line 1952 of file rpc_binding.c.

1953 {
1954  TRACE("(%p, %d, %ld)\n", BindingHandle, Option, OptionValue);
1955 
1956  switch (Option)
1957  {
1958  case RPC_C_OPT_COOKIE_AUTH:
1959  {
1961  RpcBinding *binding = BindingHandle;
1962  int len = MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, NULL, 0);
1963  WCHAR *str;
1964 
1965  if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return RPC_S_OUT_OF_MEMORY;
1966  MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, str, len);
1967  str[len] = 0;
1968  HeapFree(GetProcessHeap(), 0, binding->CookieAuth);
1969  binding->CookieAuth = str;
1970  break;
1971  }
1972  default:
1973  FIXME("option %u not supported\n", Option);
1974  break;
1975  }
1976  return RPC_S_OK;
1977 }
#define RPC_C_OPT_COOKIE_AUTH
Definition: rpcdcep.h:127
#define CP_ACP
Definition: compat.h:99
_In_ ULONG _Out_ HANDLE * BindingHandle
Definition: tdikrnl.h:1146
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
LPWSTR CookieAuth
Definition: rpc_binding.h:142
Definition: cookie.c:33
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ RpcBindingToStringBindingA()

RPC_STATUS WINAPI RpcBindingToStringBindingA ( RPC_BINDING_HANDLE  Binding,
RPC_CSTR StringBinding 
)

Definition at line 916 of file rpc_binding.c.

917 {
918  RPC_STATUS ret;
920  RPC_CSTR ObjectUuid;
921 
922  TRACE("(%p,%p)\n", Binding, StringBinding);
923 
924  if (UuidIsNil(&bind->ObjectUuid, &ret))
925  ObjectUuid = NULL;
926  else
927  {
928  ret = UuidToStringA(&bind->ObjectUuid, &ObjectUuid);
929  if (ret != RPC_S_OK) return ret;
930  }
931 
932  ret = RpcStringBindingComposeA(ObjectUuid, (unsigned char*)bind->Protseq, (unsigned char*) bind->NetworkAddr,
933  (unsigned char*) bind->Endpoint, NULL, StringBinding);
934 
935  RpcStringFreeA(&ObjectUuid);
936 
937  return ret;
938 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
RPC_STATUS WINAPI RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr, RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR *StringBinding)
Definition: rpc_binding.c:457
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:158
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:266
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, RPC_CSTR *StringUuid)
Definition: rpcrt4_main.c:512
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static IBinding Binding
Definition: htmldoc.c:1268
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcBindingToStringBindingW(), s_context_handle_test(), test_RpcServerUseProtseq(), and test_RpcStringBindingFromBinding().

◆ RpcBindingToStringBindingW()

RPC_STATUS WINAPI RpcBindingToStringBindingW ( RPC_BINDING_HANDLE  Binding,
RPC_WSTR StringBinding 
)

Definition at line 943 of file rpc_binding.c.

944 {
945  RPC_STATUS ret;
946  unsigned char *str = NULL;
947  TRACE("(%p,%p)\n", Binding, StringBinding);
949  *StringBinding = RPCRT4_strdupAtoW((char*)str);
951  return ret;
952 }
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:158
long RPC_STATUS
Definition: rpc.h:52
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding)
Definition: rpc_binding.c:916
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:69
int ret

Referenced by CreateJob().

◆ RpcBindingVectorFree()

RPC_STATUS WINAPI RpcBindingVectorFree ( RPC_BINDING_VECTOR **  BindingVector)

Definition at line 798 of file rpc_binding.c.

799 {
800  ULONG c;
801 
802  TRACE("(%p)\n", BindingVector);
803  for (c=0; c<(*BindingVector)->Count; c++) RpcBindingFree(&(*BindingVector)->BindingH[c]);
804  HeapFree(GetProcessHeap(), 0, *BindingVector);
805  *BindingVector = NULL;
806  return RPC_S_OK;
807 }
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:783
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by test_endpoint_mapper(), and test_RpcServerUseProtseq().

◆ RpcImpersonateClient()

RPC_STATUS WINAPI RpcImpersonateClient ( RPC_BINDING_HANDLE  BindingHandle)

Definition at line 1052 of file rpc_binding.c.

1053 {
1054  RpcBinding *bind;
1055 
1056  TRACE("(%p)\n", BindingHandle);
1057 
1059  if (!BindingHandle) return RPC_S_INVALID_BINDING;
1060 
1061  bind = BindingHandle;
1062  if (bind->FromConn)
1063  return rpcrt4_conn_impersonate_client(bind->FromConn);
1065 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
static RPC_STATUS rpcrt4_conn_impersonate_client(RpcConnection *conn)
Definition: rpc_binding.h:241
#define RPC_S_WRONG_KIND_OF_BINDING
Definition: winerror.h:1012
_In_ ULONG _Out_ HANDLE * BindingHandle
Definition: tdikrnl.h:1146
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
#define TRACE(s)
Definition: solgame.cpp:4
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1743

Referenced by _RpcAddJob(), _RpcClosePrinter(), _RpcEndDocPrinter(), _RpcEndPagePrinter(), _RpcEnumJobs(), _RpcEnumMonitors(), _RpcEnumPorts(), _RpcEnumPrinters(), _RpcEnumPrintProcessorDatatypes(), _RpcEnumPrintProcessors(), _RpcGetJob(), _RpcGetPrinter(), _RpcGetPrinterDataEx(), _RpcGetPrinterDriver(), _RpcGetPrintProcessorDirectory(), _RpcOpenPrinter(), _RpcReadPrinter(), _RpcScheduleJob(), _RpcSetJob(), _RpcSetPrinterDataEx(), _RpcSpoolerInit(), _RpcStartDocPrinter(), _RpcStartPagePrinter(), _RpcWritePrinter(), LsarSetSecurityObject(), RSetServiceObjectSecurity(), and s_authinfo_test().

◆ RpcMgmtSetComTimeout()

RPC_STATUS WINAPI RpcMgmtSetComTimeout ( RPC_BINDING_HANDLE  BindingHandle,
unsigned int  Timeout 
)

Definition at line 1468 of file rpc_binding.c.

1469 {
1470  FIXME("(%p, %d): stub\n", BindingHandle, Timeout);
1471  return RPC_S_OK;
1472 }
_In_ ULONG _Out_ HANDLE * BindingHandle
Definition: tdikrnl.h:1146
#define FIXME(fmt,...)
Definition: debug.h:110
static ULONG Timeout
Definition: ping.c:61
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ RpcQualityOfService_AddRef()

ULONG RpcQualityOfService_AddRef ( RpcQualityOfService qos)

Definition at line 1356 of file rpc_binding.c.

1357 {
1358  return InterlockedIncrement(&qos->refs);
1359 }
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by RpcBindingCopy(), and RPCRT4_CreateConnection().

◆ RpcQualityOfService_Create()

static RPC_STATUS RpcQualityOfService_Create ( const RPC_SECURITY_QOS qos_src,
BOOL  unicode,
RpcQualityOfService **  qos_dst 
)
static

Definition at line 1246 of file rpc_binding.c.

1247 {
1248  RpcQualityOfService *qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos));
1249 
1250  if (!qos)
1251  return RPC_S_OUT_OF_RESOURCES;
1252 
1253  qos->refs = 1;
1254  qos->qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos->qos));
1255  if (!qos->qos) goto error;
1256  qos->qos->Version = qos_src->Version;
1257  qos->qos->Capabilities = qos_src->Capabilities;
1258  qos->qos->IdentityTracking = qos_src->IdentityTracking;
1259  qos->qos->ImpersonationType = qos_src->ImpersonationType;
1260  qos->qos->AdditionalSecurityInfoType = 0;
1261 
1262  if (qos_src->Version >= 2)
1263  {
1264  const RPC_SECURITY_QOS_V2_W *qos_src2 = (const RPC_SECURITY_QOS_V2_W *)qos_src;
1267  {
1268  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_src = qos_src2->u.HttpCredentials;
1269  RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_dst;
1270 
1271  http_credentials_dst = HeapAlloc(GetProcessHeap(), 0, sizeof(*http_credentials_dst));
1272  qos->qos->u.HttpCredentials = http_credentials_dst;
1273  if (!http_credentials_dst) goto error;
1274  http_credentials_dst->TransportCredentials = NULL;
1275  http_credentials_dst->Flags = http_credentials_src->Flags;
1276  http_credentials_dst->AuthenticationTarget = http_credentials_src->AuthenticationTarget;
1277  http_credentials_dst->NumberOfAuthnSchemes = http_credentials_src->NumberOfAuthnSchemes;
1278  http_credentials_dst->AuthnSchemes = NULL;
1279  http_credentials_dst->ServerCertificateSubject = NULL;
1280  if (http_credentials_src->TransportCredentials)
1281  {
1282  SEC_WINNT_AUTH_IDENTITY_W *cred_dst;
1283  cred_dst = http_credentials_dst->TransportCredentials = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cred_dst));
1284  if (!cred_dst) goto error;
1286  if (unicode)
1287  {
1288  const SEC_WINNT_AUTH_IDENTITY_W *cred_src = http_credentials_src->TransportCredentials;
1289  cred_dst->UserLength = cred_src->UserLength;
1290  cred_dst->PasswordLength = cred_src->PasswordLength;
1291  cred_dst->DomainLength = cred_src->DomainLength;
1292  cred_dst->User = RPCRT4_strndupW(cred_src->User, cred_src->UserLength);
1293  cred_dst->Password = RPCRT4_strndupW(cred_src->Password, cred_src->PasswordLength);
1294  cred_dst->Domain = RPCRT4_strndupW(cred_src->Domain, cred_src->DomainLength);
1295  }
1296  else
1297  {
1298  const SEC_WINNT_AUTH_IDENTITY_A *cred_src = (const SEC_WINNT_AUTH_IDENTITY_A *)http_credentials_src->TransportCredentials;
1299  cred_dst->UserLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, NULL, 0);
1300  cred_dst->DomainLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, NULL, 0);
1301  cred_dst->PasswordLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, NULL, 0);
1302  cred_dst->User = HeapAlloc(GetProcessHeap(), 0, cred_dst->UserLength * sizeof(WCHAR));
1303  cred_dst->Password = HeapAlloc(GetProcessHeap(), 0, cred_dst->PasswordLength * sizeof(WCHAR));
1304  cred_dst->Domain = HeapAlloc(GetProcessHeap(), 0, cred_dst->DomainLength * sizeof(WCHAR));
1305  if (!cred_dst->Password || !cred_dst->Domain) goto error;
1306  MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, cred_dst->User, cred_dst->UserLength);
1307  MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, cred_dst->Domain, cred_dst->DomainLength);
1308  MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, cred_dst->Password, cred_dst->PasswordLength);
1309  }
1310  }
1311  if (http_credentials_src->NumberOfAuthnSchemes)
1312  {
1313  http_credentials_dst->AuthnSchemes = HeapAlloc(GetProcessHeap(), 0, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
1314  if (!http_credentials_dst->AuthnSchemes) goto error;
1315  memcpy(http_credentials_dst->AuthnSchemes, http_credentials_src->AuthnSchemes, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
1316  }
1317  if (http_credentials_src->ServerCertificateSubject)
1318  {
1319  if (unicode)
1320  http_credentials_dst->ServerCertificateSubject =
1321  RPCRT4_strndupW(http_credentials_src->ServerCertificateSubject,
1322  lstrlenW(http_credentials_src->ServerCertificateSubject));
1323  else
1324  http_credentials_dst->ServerCertificateSubject =
1325  RPCRT4_strdupAtoW((char *)http_credentials_src->ServerCertificateSubject);
1326  if (!http_credentials_dst->ServerCertificateSubject) goto error;
1327  }
1328  }
1329  }
1330  *qos_dst = qos;
1331  return RPC_S_OK;
1332 
1333 error:
1334  if (qos->qos)
1335  {
1337  qos->qos->u.HttpCredentials)
1338  {
1340  {
1345  }
1349  }
1350  HeapFree(GetProcessHeap(), 0, qos->qos);
1351  }
1352  HeapFree(GetProcessHeap(), 0, qos);
1353  return RPC_S_OUT_OF_RESOURCES;
1354 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
unsigned short * Domain
Definition: rpcdce.h:225
unsigned short * User
Definition: rpcdce.h:223
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
ULONG ImpersonationType
Definition: rpcdce.h:267
#define error(str)
Definition: mkdosfs.c:1605
unsigned short * Password
Definition: rpcdce.h:227
#define CP_ACP
Definition: compat.h:99
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
#define lstrlenW
Definition: compat.h:415
ULONG Capabilities
Definition: rpcdce.h:265
unsigned short * ServerCertificateSubject
Definition: rpcdce.h:250
smooth NULL
Definition: ftsmooth.c:416
ULONG IdentityTracking
Definition: rpcdce.h:266
unsigned char * Password
Definition: rpcdce.h:238
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SEC_WINNT_AUTH_IDENTITY_UNICODE
Definition: rpcdce.h:310
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:69
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MultiByteToWideChar
Definition: compat.h:100
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
unsigned char * Domain
Definition: rpcdce.h:236
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:91
#define HeapFree(x, y, z)
Definition: compat.h:402
unsigned char * User
Definition: rpcdce.h:234
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcBindingSetAuthInfoExA(), and RpcBindingSetAuthInfoExW().

◆ RpcQualityOfService_IsEqual()

BOOL RpcQualityOfService_IsEqual ( const RpcQualityOfService qos1,
const RpcQualityOfService qos2 
)

Definition at line 1386 of file rpc_binding.c.

1387 {
1388  if (qos1 == qos2)
1389  return TRUE;
1390 
1391  if (!qos1 || !qos2)
1392  return FALSE;
1393 
1394  TRACE("qos1 = { %d %d %d %d }, qos2 = { %d %d %d %d }\n",
1395  qos1->qos->Capabilities, qos1->qos->IdentityTracking,
1397  qos2->qos->Capabilities, qos2->qos->IdentityTracking,
1399 
1400  if ((qos1->qos->Capabilities != qos2->qos->Capabilities) ||
1401  (qos1->qos->IdentityTracking != qos2->qos->IdentityTracking) ||
1402  (qos1->qos->ImpersonationType != qos2->qos->ImpersonationType) ||
1404  return FALSE;
1405 
1407  {
1408  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials1 = qos1->qos->u.HttpCredentials;
1409  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials2 = qos2->qos->u.HttpCredentials;
1410 
1411  if (http_credentials1->Flags != http_credentials2->Flags)
1412  return FALSE;
1413 
1414  if (http_credentials1->AuthenticationTarget != http_credentials2->AuthenticationTarget)
1415  return FALSE;
1416 
1417  if (http_credentials1->NumberOfAuthnSchemes != http_credentials2->NumberOfAuthnSchemes)
1418  return FALSE;
1419 
1420  if ((!http_credentials1->AuthnSchemes && http_credentials2->AuthnSchemes) ||
1421  (http_credentials1->AuthnSchemes && !http_credentials2->AuthnSchemes))
1422  return FALSE;
1423 
1424  if (memcmp(http_credentials1->AuthnSchemes, http_credentials2->AuthnSchemes,
1425  http_credentials1->NumberOfAuthnSchemes * sizeof(http_credentials1->AuthnSchemes[0])))
1426  return FALSE;
1427 
1428  /* server certificate subject not currently used */
1429 
1430  if (http_credentials1->TransportCredentials != http_credentials2->TransportCredentials)
1431  {
1432  const SEC_WINNT_AUTH_IDENTITY_W *identity1 = http_credentials1->TransportCredentials;
1433  const SEC_WINNT_AUTH_IDENTITY_W *identity2 = http_credentials2->TransportCredentials;
1434 
1435  if (!identity1 || !identity2)
1436  return FALSE;
1437 
1438  /* compare user names */
1439  if (identity1->UserLength != identity2->UserLength ||
1440  memcmp(identity1->User, identity2->User, identity1->UserLength))
1441  return FALSE;
1442  /* compare domain names */
1443  if (identity1->DomainLength != identity2->DomainLength ||
1444  memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
1445  return FALSE;
1446  /* compare passwords */
1447  if (identity1->PasswordLength != identity2->PasswordLength ||
1448  memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
1449  return FALSE;
1450  }
1451  }
1452 
1453  return TRUE;
1454 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
unsigned short * Domain
Definition: rpcdce.h:225
#define TRUE
Definition: types.h:120
unsigned short * User
Definition: rpcdce.h:223
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned short * Password
Definition: rpcdce.h:227
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
#define TRACE(s)
Definition: solgame.cpp:4
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195

Referenced by RpcAssoc_GetIdleConnection().

◆ RpcQualityOfService_Release()

ULONG RpcQualityOfService_Release ( RpcQualityOfService qos)

Definition at line 1361 of file rpc_binding.c.

1362 {
1363  ULONG refs = InterlockedDecrement(&qos->refs);
1364 
1365  if (!refs)
1366  {
1368  {
1370  {
1375  }
1379  }
1380  HeapFree(GetProcessHeap(), 0, qos->qos);
1381  HeapFree(GetProcessHeap(), 0, qos);
1382  }
1383  return refs;
1384 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
unsigned short * Domain
Definition: rpcdce.h:225
unsigned short * User
Definition: rpcdce.h:223
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
unsigned short * Password
Definition: rpcdce.h:227
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
unsigned short * ServerCertificateSubject
Definition: rpcdce.h:250
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
unsigned int ULONG
Definition: retypes.h:1
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), RPCRT4_ReleaseBinding(), and RPCRT4_ReleaseConnection().

◆ RpcRevertToSelf()

◆ RpcRevertToSelfEx()

RPC_STATUS WINAPI RpcRevertToSelfEx ( RPC_BINDING_HANDLE  BindingHandle)

Definition at line 1085 of file rpc_binding.c.

1086 {
1087  RpcBinding *bind;
1088 
1089  TRACE("(%p)\n", BindingHandle);
1090 
1092  if (!BindingHandle) return RPC_S_INVALID_BINDING;
1093 
1094  bind = BindingHandle;
1095  if (bind->FromConn)
1096  return rpcrt4_conn_revert_to_self(bind->FromConn);
1098 }
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define RPC_S_WRONG_KIND_OF_BINDING
Definition: winerror.h:1012
_In_ ULONG _Out_ HANDLE * BindingHandle
Definition: tdikrnl.h:1146
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
static RPC_STATUS rpcrt4_conn_revert_to_self(RpcConnection *conn)
Definition: rpc_binding.h:247
#define TRACE(s)
Definition: solgame.cpp:4
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1743

Referenced by RpcRevertToSelf().

◆ RPCRT4_AddRefBinding()

void RPCRT4_AddRefBinding ( RpcBinding Binding)

Definition at line 249 of file rpc_binding.c.

250 {
252 }
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by I_RpcNegotiateTransferSyntax().

◆ RPCRT4_AllocBinding()

static RPC_STATUS RPCRT4_AllocBinding ( RpcBinding **  Binding,
BOOL  server 
)
static

Definition at line 109 of file rpc_binding.c.

110 {
111  RpcBinding* NewBinding;
112 
113  NewBinding = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcBinding));
114  NewBinding->refs = 1;
115  NewBinding->server = server;
116 
117  *Binding = NewBinding;
118 
119  return RPC_S_OK;
120 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcBindingCopy(), RpcBindingServerFromClient(), RPCRT4_CreateBindingA(), RPCRT4_CreateBindingW(), and RPCRT4_MakeBinding().

◆ RPCRT4_CloseBinding()

RPC_STATUS RPCRT4_CloseBinding ( RpcBinding Binding,
RpcConnection Connection 
)

Definition at line 293 of file rpc_binding.c.

294 {
295  TRACE("(Binding == ^%p)\n", Binding);
296  if (!Connection) return RPC_S_OK;
297  if (Binding->server) {
298  /* don't destroy a connection that is cached in the binding */
299  if (Binding->FromConn != Connection)
300  RPCRT4_ReleaseConnection(Connection);
301  }
302  else {
303  RpcAssoc_ReleaseIdleConnection(Binding->Assoc, Connection);
304  }
305  return RPC_S_OK;
306 }
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
Definition: rpc_assoc.c:437
#define TRACE(s)
Definition: solgame.cpp:4
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by I_RpcFreeBuffer().

◆ RPCRT4_CompleteBindingA()

static RPC_STATUS RPCRT4_CompleteBindingA ( RpcBinding Binding,
LPCSTR  NetworkAddr,
LPCSTR  Endpoint,
LPCSTR  NetworkOptions 
)
static

Definition at line 148 of file rpc_binding.c.

150 {
152 
153  TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
154  debugstr_a(NetworkAddr), debugstr_a(Endpoint), debugstr_a(NetworkOptions));
155 
156  RPCRT4_strfree(Binding->NetworkAddr);
157  Binding->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
158  RPCRT4_strfree(Binding->Endpoint);
159  Binding->Endpoint = RPCRT4_strdupA(Endpoint);
160  HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
161  Binding->NetworkOptions = RPCRT4_strdupAtoW(NetworkOptions);
162 
163  /* only attempt to get an association if the binding is complete */
164  if (Endpoint && Endpoint[0] != '\0')
165  {
166  status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
167  Binding->Endpoint, Binding->NetworkOptions,
168  &Binding->Assoc);
169  if (status != RPC_S_OK)
170  return status;
171  }
172 
173  return RPC_S_OK;
174 }
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:98
long RPC_STATUS
Definition: rpc.h:52
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define debugstr_a
Definition: kernel32.h:31
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:69
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by RpcBindingFromStringBindingA().

◆ RPCRT4_CompleteBindingW()

static RPC_STATUS RPCRT4_CompleteBindingW ( RpcBinding Binding,
LPCWSTR  NetworkAddr,
LPCWSTR  Endpoint,
LPCWSTR  NetworkOptions 
)
static

Definition at line 176 of file rpc_binding.c.

178 {
180 
181  TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
182  debugstr_w(NetworkAddr), debugstr_w(Endpoint), debugstr_w(NetworkOptions));
183 
184  RPCRT4_strfree(Binding->NetworkAddr);
185  Binding->NetworkAddr = RPCRT4_strdupWtoA(NetworkAddr);
186  RPCRT4_strfree(Binding->Endpoint);
187  Binding->Endpoint = RPCRT4_strdupWtoA(Endpoint);
188  HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
189  Binding->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
190 
191  /* only attempt to get an association if the binding is complete */
192  if (Endpoint && Endpoint[0] != '\0')
193  {
194  status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
195  Binding->Endpoint, Binding->NetworkOptions,
196  &Binding->Assoc);
197  if (status != RPC_S_OK)
198  return status;
199  }
200 
201  return RPC_S_OK;
202 }
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:98
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:58
long RPC_STATUS
Definition: rpc.h:52
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by RpcBindingFromStringBindingW().

◆ RPCRT4_CreateBindingA()

static RPC_STATUS RPCRT4_CreateBindingA ( RpcBinding **  Binding,
BOOL  server,
LPCSTR  Protseq 
)
static

Definition at line 122 of file rpc_binding.c.

123 {
124  RpcBinding* NewBinding;
125 
126  RPCRT4_AllocBinding(&NewBinding, server);
127  NewBinding->Protseq = RPCRT4_strdupA(Protseq);
128 
129  TRACE("binding: %p\n", NewBinding);
130  *Binding = NewBinding;
131 
132  return RPC_S_OK;
133 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
LPSTR Protseq
Definition: rpc_binding.h:130
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding **Binding, BOOL server)
Definition: rpc_binding.c:109
#define TRACE(s)
Definition: solgame.cpp:4
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcBindingFromStringBindingA().

◆ RPCRT4_CreateBindingW()

static RPC_STATUS RPCRT4_CreateBindingW ( RpcBinding **  Binding,
BOOL  server,
LPCWSTR  Protseq 
)
static

Definition at line 135 of file rpc_binding.c.

136 {
137  RpcBinding* NewBinding;
138 
139  RPCRT4_AllocBinding(&NewBinding, server);
140  NewBinding->Protseq = RPCRT4_strdupWtoA(Protseq);
141 
142  TRACE("binding: %p\n", NewBinding);
143  *Binding = NewBinding;
144 
145  return RPC_S_OK;
146 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
LPSTR Protseq
Definition: rpc_binding.h:130
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding **Binding, BOOL server)
Definition: rpc_binding.c:109
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:58
#define TRACE(s)
Definition: solgame.cpp:4
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcBindingFromStringBindingW().

◆ RPCRT4_MakeBinding()

RPC_STATUS RPCRT4_MakeBinding ( RpcBinding **  Binding,
RpcConnection Connection 
)

Definition at line 232 of file rpc_binding.c.

233 {
234  RpcBinding* NewBinding;
235  TRACE("(RpcBinding == ^%p, Connection == ^%p)\n", Binding, Connection);
236 
237  RPCRT4_AllocBinding(&NewBinding, Connection->server);
238  NewBinding->Protseq = RPCRT4_strdupA(rpcrt4_conn_get_name(Connection));
239  NewBinding->NetworkAddr = RPCRT4_strdupA(Connection->NetworkAddr);
240  NewBinding->Endpoint = RPCRT4_strdupA(Connection->Endpoint);
241  NewBinding->FromConn = Connection;
242 
243  TRACE("binding: %p\n", NewBinding);
244  *Binding = NewBinding;
245 
246  return RPC_S_OK;
247 }
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:183
LPSTR Protseq
Definition: rpc_binding.h:130
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding **Binding, BOOL server)
Definition: rpc_binding.c:109
LPSTR Endpoint
Definition: rpc_binding.h:132
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR NetworkAddr
Definition: rpc_binding.h:67
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
RpcConnection * FromConn
Definition: rpc_binding.h:136
LPSTR NetworkAddr
Definition: rpc_binding.h:131
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by process_bind_packet_no_send(), and RpcServerInqBindings().

◆ RPCRT4_OpenBinding()

RPC_STATUS RPCRT4_OpenBinding ( RpcBinding Binding,
RpcConnection **  Connection,
const RPC_SYNTAX_IDENTIFIER TransferSyntax,
const RPC_SYNTAX_IDENTIFIER InterfaceId,
BOOL from_cache 
)

Definition at line 272 of file rpc_binding.c.

275 {
276  TRACE("(Binding == ^%p)\n", Binding);
277 
278  if (!Binding->server) {
279  return RpcAssoc_GetClientConnection(Binding->Assoc, InterfaceId,
280  TransferSyntax, Binding->AuthInfo, Binding->QOS, Binding->CookieAuth, Connection, from_cache);
281  } else {
282  /* we already have a connection with acceptable binding, so use it */
283  if (Binding->FromConn) {
284  *Connection = Binding->FromConn;
285  return RPC_S_OK;
286  } else {
287  ERR("no connection in binding\n");
288  return RPC_S_INTERNAL_ERROR;
289  }
290  }
291 }
#define TRACE(s)
Definition: solgame.cpp:4
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth, RpcConnection **Connection, BOOL *from_cache)
Definition: rpc_assoc.c:390
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by I_RpcNegotiateTransferSyntax(), and I_RpcSend().

◆ RPCRT4_ReleaseBinding()

RPC_STATUS RPCRT4_ReleaseBinding ( RpcBinding Binding)

Definition at line 254 of file rpc_binding.c.

255 {
256  if (InterlockedDecrement(&Binding->refs))
257  return RPC_S_OK;
258 
259  TRACE("binding: %p\n", Binding);
260  if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
261  RPCRT4_strfree(Binding->Endpoint);
262  RPCRT4_strfree(Binding->NetworkAddr);
263  RPCRT4_strfree(Binding->Protseq);
264  HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
265  HeapFree(GetProcessHeap(), 0, Binding->CookieAuth);
266  if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo);
269  return RPC_S_OK;
270 }
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:187
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1184
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1361
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by I_RpcFreeBuffer(), RpcBindingFree(), RpcBindingFromStringBindingA(), RpcBindingFromStringBindingW(), and RPCRT4_ReleaseConnection().

◆ RPCRT4_ResolveBinding()

RPC_STATUS RPCRT4_ResolveBinding ( RpcBinding Binding,
LPCSTR  Endpoint 
)

Definition at line 204 of file rpc_binding.c.

205 {
207 
208  TRACE("(RpcBinding == ^%p, EndPoint == \"%s\"\n", Binding, Endpoint);
209 
210  RPCRT4_strfree(Binding->Endpoint);
211  Binding->Endpoint = RPCRT4_strdupA(Endpoint);
212 
213  if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
214  Binding->Assoc = NULL;
215  status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
216  Binding->Endpoint, Binding->NetworkOptions,
217  &Binding->Assoc);
218  if (status != RPC_S_OK)
219  return status;
220 
221  return RPC_S_OK;
222 }
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:187
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:98
long RPC_STATUS
Definition: rpc.h:52
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by get_epm_handle_client(), and RpcEpResolveBinding().

◆ RPCRT4_SetBindingObject()

RPC_STATUS RPCRT4_SetBindingObject ( RpcBinding Binding,
const UUID ObjectUuid 
)

Definition at line 224 of file rpc_binding.c.

225 {
226  TRACE("(*RpcBinding == ^%p, UUID == %s)\n", Binding, debugstr_guid(ObjectUuid));
227  if (ObjectUuid) Binding->ObjectUuid = *ObjectUuid;
228  else UuidCreateNil(&Binding->ObjectUuid);
229  return RPC_S_OK;
230 }
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
RPC_STATUS WINAPI UuidCreateNil(UUID *Uuid)
Definition: rpcrt4_main.c:282
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by process_request_packet(), RpcBindingFromStringBindingA(), RpcBindingFromStringBindingW(), and RpcBindingSetObject().

◆ RPCRT4_strconcatA()

static LPSTR RPCRT4_strconcatA ( LPSTR  dst,
LPCSTR  src 
)
static

Definition at line 308 of file rpc_binding.c.

309 {
310  DWORD len = strlen(dst), slen = strlen(src);
311  LPSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(CHAR));
312  if (!ndst)
313  {
314  HeapFree(GetProcessHeap(), 0, dst);
315  return NULL;
316  }
317  ndst[len] = ',';
318  memcpy(ndst+len+1, src, slen+1);
319  return ndst;
320 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define HeapReAlloc
Definition: compat.h:401
GLenum GLenum dst
Definition: glext.h:6340
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RpcStringBindingParseA().

◆ RPCRT4_strconcatW()

static LPWSTR RPCRT4_strconcatW ( LPWSTR  dst,
LPCWSTR  src 
)
static

Definition at line 322 of file rpc_binding.c.

323 {
324  DWORD len = lstrlenW(dst), slen = lstrlenW(src);
325  LPWSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(WCHAR));
326  if (!ndst)
327  {
328  HeapFree(GetProcessHeap(), 0, dst);
329  return NULL;
330  }
331  ndst[len] = ',';
332  memcpy(ndst+len+1, src, (slen+1)*sizeof(WCHAR));
333  return ndst;
334 }
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define HeapReAlloc
Definition: compat.h:401
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RpcStringBindingParseW().

◆ RPCRT4_strdupAtoW()

LPWSTR RPCRT4_strdupAtoW ( LPCSTR  src)

Definition at line 69 of file rpc_binding.c.

70 {
71  DWORD len;
72  LPWSTR s;
73  if (!src) return NULL;
74  len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
75  s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
76  MultiByteToWideChar(CP_ACP, 0, src, -1, s, len);
77  return s;
78 }
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RpcBindingSetAuthInfoExA(), RpcBindingToStringBindingW(), RpcQualityOfService_Create(), RPCRT4_CompleteBindingA(), RpcServerRegisterAuthInfoA(), and UuidToStringW().

◆ RPCRT4_strdupWtoA()

LPSTR RPCRT4_strdupWtoA ( LPCWSTR  src)

Definition at line 58 of file rpc_binding.c.

59 {
60  DWORD len;
61  LPSTR s;
62  if (!src) return NULL;
63  len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
64  s = HeapAlloc(GetProcessHeap(), 0, len);
66  return s;
67 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340

Referenced by RpcBindingInqAuthClientExA(), RpcBindingInqAuthInfoExA(), RpcEpRegisterNoReplaceW(), RpcEpRegisterW(), RPCRT4_CompleteBindingW(), RPCRT4_CreateBindingW(), RpcServerInqDefaultPrincNameA(), RpcServerUseProtseqEpExW(), and RpcServerUseProtseqW().

◆ RPCRT4_strfree()

void RPCRT4_strfree ( LPSTR  src)

◆ RPCRT4_strndupA()

LPSTR RPCRT4_strndupA ( LPCSTR  src,
INT  slen 
)

Definition at line 45 of file rpc_binding.c.

46 {
47  DWORD len;
48  LPSTR s;
49  if (!src) return NULL;
50  if (slen == -1) slen = strlen(src);
51  len = slen;
52  s = HeapAlloc(GetProcessHeap(), 0, len+1);
53  memcpy(s, src, len);
54  s[len] = 0;
55  return s;
56 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340

Referenced by RpcBindingCopy().

◆ RPCRT4_strndupAtoW()

static LPWSTR RPCRT4_strndupAtoW ( LPCSTR  src,
INT  slen 
)
static

Definition at line 80 of file rpc_binding.c.

81 {
82  DWORD len;
83  LPWSTR s;
84  if (!src) return NULL;
85  len = MultiByteToWideChar(CP_ACP, 0, src, slen, NULL, 0);
86  s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
87  MultiByteToWideChar(CP_ACP, 0, src, slen, s, len);
88  return s;
89 }
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RpcAuthInfo_Create().

◆ RPCRT4_strndupW()

LPWSTR RPCRT4_strndupW ( LPCWSTR  src,
INT  slen 
)

Definition at line 91 of file rpc_binding.c.

92 {
93  DWORD len;
94  LPWSTR s;
95  if (!src) return NULL;
96  if (slen == -1) slen = lstrlenW(src);
97  len = slen;
98  s = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
99  memcpy(s, src, len*sizeof(WCHAR));
100  s[len] = 0;
101  return s;
102 }
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RpcAuthInfo_Create(), RpcQualityOfService_Create(), and rpcrt4_http_internet_connect().

◆ RpcStringBindingComposeA()

RPC_STATUS WINAPI RpcStringBindingComposeA ( RPC_CSTR  ObjUuid,
RPC_CSTR  Protseq,
RPC_CSTR  NetworkAddr,
RPC_CSTR  Endpoint,
RPC_CSTR  Options,
RPC_CSTR StringBinding 
)

Definition at line 457 of file rpc_binding.c.

460 {
461  DWORD len = 1;
462  RPC_CSTR data;
463 
464  TRACE( "(%s,%s,%s,%s,%s,%p)\n",
465  debugstr_a( (char*)ObjUuid ), debugstr_a( (char*)Protseq ),
466  debugstr_a( (char*)NetworkAddr ), debugstr_a( (char*)Endpoint ),
467  debugstr_a( (char*)Options ), StringBinding );
468 
469  /* overestimate for each component for escaping of delimiters */
470  if (ObjUuid && *ObjUuid) len += strlen((char*)ObjUuid) * 2 + 1;
471  if (Protseq && *Protseq) len += strlen((char*)Protseq) * 2 + 1;
472  if (NetworkAddr && *NetworkAddr) len += strlen((char*)NetworkAddr) * 2;
473  if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) * 2 + 2;
474  if (Options && *Options) len += strlen((char*)Options) * 2 + 2;
475 
476  data = HeapAlloc(GetProcessHeap(), 0, len);
477  *StringBinding = data;
478 
479  if (ObjUuid && *ObjUuid) {
481  *data++ = '@';
482  }
483  if (Protseq && *Protseq) {
485  *data++ = ':';
486  }
487  if (NetworkAddr && *NetworkAddr)
488  data = escape_string_binding_component(data, NetworkAddr);
489 
490  if ((Endpoint && *Endpoint) ||
491  (Options && *Options)) {
492  *data++ = '[';
493  if (Endpoint && *Endpoint) {
495  if (Options && *Options) *data++ = ',';
496  }
497  if (Options && *Options) {
499  }
500  *data++ = ']';
501  }
502  *data = 0;
503 
504  return RPC_S_OK;
505 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
enum OPTION_FLAGS Options
Definition: stats.c:44
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
static RPC_CSTR escape_string_binding_component(RPC_CSTR string_binding, const unsigned char *component)
Definition: rpc_binding.c:338
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by client(), EVENTLOG_HANDLE_A_bind(), RpcBindingToStringBindingA(), SVCCTL_HANDLEA_bind(), test_endpoint_mapper(), test_ndr_buffer(), test_reconnect(), test_rpc_ncacn_ip_tcp(), test_RpcStringBindingFromBinding(), and test_server_listening().

◆ RpcStringBindingComposeW()

RPC_STATUS WINAPI RpcStringBindingComposeW ( RPC_WSTR  ObjUuid,
RPC_WSTR  Protseq,
RPC_WSTR  NetworkAddr,
RPC_WSTR  Endpoint,
RPC_WSTR  Options,
RPC_WSTR StringBinding 
)

Definition at line 510 of file rpc_binding.c.

513 {
514  DWORD len = 1;
515  RPC_WSTR data;
516 
517  TRACE("(%s,%s,%s,%s,%s,%p)\n",
518  debugstr_w( ObjUuid ), debugstr_w( Protseq ),
519  debugstr_w( NetworkAddr ), debugstr_w( Endpoint ),
520  debugstr_w( Options ), StringBinding);
521 
522  /* overestimate for each component for escaping of delimiters */
523  if (ObjUuid && *ObjUuid) len += lstrlenW(ObjUuid) * 2 + 1;
524  if (Protseq && *Protseq) len += lstrlenW(Protseq) * 2 + 1;
525  if (NetworkAddr && *NetworkAddr) len += lstrlenW(NetworkAddr) * 2;
526  if (Endpoint && *Endpoint) len += lstrlenW(Endpoint) * 2 + 2;
527  if (Options && *Options) len += lstrlenW(Options) * 2 + 2;
528 
529  data = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
530  *StringBinding = data;
531 
532  if (ObjUuid && *ObjUuid) {
534  *data++ = '@';
535  }
536  if (Protseq && *Protseq) {
538  *data++ = ':';
539  }
540  if (NetworkAddr && *NetworkAddr) {
542  }
543  if ((Endpoint && *Endpoint) ||
544  (Options && *Options)) {
545  *data++ = '[';
546  if (Endpoint && *Endpoint) {
548  if (Options && *Options) *data++ = ',';
549  }
550  if (Options && *Options) {
552  }
553  *data++ = ']';
554  }
555  *data = 0;
556 
557  return RPC_S_OK;
558 }
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
enum OPTION_FLAGS Options
Definition: stats.c:44
#define lstrlenW
Definition: compat.h:415
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static RPC_WSTR escape_string_binding_componentW(RPC_WSTR string_binding, const WCHAR *component)
Definition: rpc_binding.c:359
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by ATSVC_HANDLE_bind(), BROWSER_IDENTIFY_HANDLE_bind(), DNSRSLVR_HANDLE_bind(), DsSetupBind(), EVENTLOG_HANDLE_W_bind(), get_irot_handle(), LOGONSRV_HANDLE_bind(), NetpBind(), PLSAPR_SERVER_NAME_bind(), PnpBindRpc(), PREGISTRY_SERVER_NAME_bind(), PSAMPR_SERVER_NAME_bind(), RPC_CreateClientChannel(), ScCreateStatusBinding(), SRVSVC_HANDLE_bind(), SVCCTL_HANDLEW_bind(), WINSPOOL_HANDLE_bind(), WKSSVC_IDENTIFY_HANDLE_bind(), WKSSVC_IMPERSONATE_HANDLE_bind(), and WLANSVC_HANDLE_bind().

◆ RpcStringBindingParseA()

RPC_STATUS WINAPI RpcStringBindingParseA ( RPC_CSTR  StringBinding,
RPC_CSTR ObjUuid,
RPC_CSTR Protseq,
RPC_CSTR NetworkAddr,
RPC_CSTR Endpoint,
RPC_CSTR Options 
)

Definition at line 564 of file rpc_binding.c.

567 {
568  const unsigned char *data, *next;
569  static const char ep_opt[] = "endpoint=";
570  BOOL endpoint_already_found = FALSE;
571 
572  TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a((char*)StringBinding),
573  ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
574 
575  if (ObjUuid) *ObjUuid = NULL;
576  if (Protseq) *Protseq = NULL;
577  if (NetworkAddr) *NetworkAddr = NULL;
578  if (Endpoint) *Endpoint = NULL;
579  if (Options) *Options = NULL;
580 
581  data = StringBinding;
582 
584  if (next) {
585  UUID uuid;
588  status = UuidFromStringA(str_uuid, &uuid);
589  if (status != RPC_S_OK) {
590  HeapFree(GetProcessHeap(), 0, str_uuid);
591  return status;
592  }
593  if (ObjUuid)
594  *ObjUuid = str_uuid;
595  else
596  HeapFree(GetProcessHeap(), 0, str_uuid);
597  data = next+1;
598  }
599 
601  if (next) {
602  if (Protseq) *Protseq = unescape_string_binding_component(data, next - data);
603  data = next+1;
604  }
605 
607  if (next) {
608  const unsigned char *close;
609  RPC_CSTR opt;
610 
611  if (NetworkAddr) *NetworkAddr = unescape_string_binding_component(data, next - data);
612  data = next+1;
614  if (!close) goto fail;
615 
616  /* tokenize options */
617  while (data < close) {
619  if (!next || next > close) next = close;
620  /* FIXME: this is kind of inefficient */
622  data = next+1;
623 
624  /* parse option */
626  if (!next) {
627  /* not an option, must be an endpoint */
628  if (endpoint_already_found) goto fail;
629  if (Endpoint) *Endpoint = opt;
630  else HeapFree(GetProcessHeap(), 0, opt);
631  endpoint_already_found = TRUE;
632  } else {
633  if (strncmp((const char *)opt, ep_opt, strlen(ep_opt)) == 0) {
634  /* endpoint option */
635  if (endpoint_already_found) goto fail;
636  if (Endpoint) *Endpoint = unescape_string_binding_component(next+1, -1);
637  HeapFree(GetProcessHeap(), 0, opt);
638  endpoint_already_found = TRUE;
639  } else {
640  /* network option */
641  if (Options) {
642  if (*Options) {
643  /* FIXME: this is kind of inefficient */
644  *Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, (char *)opt);
645  HeapFree(GetProcessHeap(), 0, opt);
646  } else
647  *Options = opt;
648  } else
649  HeapFree(GetProcessHeap(), 0, opt);
650  }
651  }
652  }
653 
654  data = close+1;
655  if (*data) goto fail;
656  }
657  else if (NetworkAddr)
658  *NetworkAddr = unescape_string_binding_component(data, -1);
659 
660  return RPC_S_OK;
661 
662 fail:
663  if (ObjUuid) RpcStringFreeA(ObjUuid);
664  if (Protseq) RpcStringFreeA(Protseq);
665  if (NetworkAddr) RpcStringFreeA(NetworkAddr);
666  if (Endpoint) RpcStringFreeA(Endpoint);
669 }
#define TRUE
Definition: types.h:120
static RPC_CSTR unescape_string_binding_component(const unsigned char *string_binding, int len)
Definition: rpc_binding.c:410
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
enum OPTION_FLAGS Options
Definition: stats.c:44
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:158
long RPC_STATUS
Definition: rpc.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
static LPSTR RPCRT4_strconcatA(LPSTR dst, LPCSTR src)
Definition: rpc_binding.c:308
smooth NULL
Definition: ftsmooth.c:416
static const unsigned char * string_binding_find_delimiter(const unsigned char *string_binding, unsigned char delim)
Definition: rpc_binding.c:380
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define debugstr_a
Definition: kernel32.h:31
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define close
Definition: acwin.h:98
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: msctf.idl:510
RPC_STATUS WINAPI UuidFromStringA(RPC_CSTR s, UUID *uuid)
Definition: rpcrt4_main.c:572
#define RPC_S_INVALID_STRING_BINDING
Definition: winerror.h:1011
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by RpcBindingFromStringBindingA(), s_context_handle_test(), and test_RpcStringBindingParseA().

◆ RpcStringBindingParseW()

RPC_STATUS WINAPI RpcStringBindingParseW ( RPC_WSTR  StringBinding,
RPC_WSTR ObjUuid,
RPC_WSTR Protseq,
RPC_WSTR NetworkAddr,
RPC_WSTR Endpoint,
RPC_WSTR Options 
)

Definition at line 674 of file rpc_binding.c.

677 {
678  const WCHAR *data, *next;
679  static const WCHAR ep_opt[] = {'e','n','d','p','o','i','n','t','=',0};
680  BOOL endpoint_already_found = FALSE;
681 
682  TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_w(StringBinding),
683  ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
684 
685  if (ObjUuid) *ObjUuid = NULL;
686  if (Protseq) *Protseq = NULL;
687  if (NetworkAddr) *NetworkAddr = NULL;
688  if (Endpoint) *Endpoint = NULL;
689  if (Options) *Options = NULL;
690 
691  data = StringBinding;
692 
694  if (next) {
695  UUID uuid;
698  status = UuidFromStringW(str_uuid, &uuid);
699  if (status != RPC_S_OK) {
700  HeapFree(GetProcessHeap(), 0, str_uuid);
701  return status;
702  }
703  if (ObjUuid)
704  *ObjUuid = str_uuid;
705  else
706  HeapFree(GetProcessHeap(), 0, str_uuid);
707  data = next+1;
708  }
709 
711  if (next) {
712  if (Protseq) *Protseq = unescape_string_binding_componentW(data, next - data);
713  data = next+1;
714  }
715 
717  if (next) {
718  const WCHAR *close;
719  RPC_WSTR opt;
720 
721  if (NetworkAddr) *NetworkAddr = unescape_string_binding_componentW(data, next - data);
722  data = next+1;
724  if (!close) goto fail;
725 
726  /* tokenize options */
727  while (data < close) {
729  if (!next || next > close) next = close;
730  /* FIXME: this is kind of inefficient */
732  data = next+1;
733 
734  /* parse option */
736  if (!next) {
737  /* not an option, must be an endpoint */
738  if (endpoint_already_found) goto fail;
739  if (Endpoint) *Endpoint = opt;
740  else HeapFree(GetProcessHeap(), 0, opt);
741  endpoint_already_found = TRUE;
742  } else {
743  if (wcsncmp(opt, ep_opt, lstrlenW(ep_opt)) == 0) {
744  /* endpoint option */
745  if (endpoint_already_found) goto fail;
746  if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
747  HeapFree(GetProcessHeap(), 0, opt);
748  endpoint_already_found = TRUE;
749  } else {
750  /* network option */
751  if (Options) {
752  if (*Options) {
753  /* FIXME: this is kind of inefficient */
755  HeapFree(GetProcessHeap(), 0, opt);
756  } else
757  *Options = opt;
758  } else
759  HeapFree(GetProcessHeap(), 0, opt);
760  }
761  }
762  }
763 
764  data = close+1;
765  if (*data) goto fail;
766  } else if (NetworkAddr)
767  *NetworkAddr = unescape_string_binding_componentW(data, -1);
768 
769  return RPC_S_OK;
770 
771 fail:
772  if (ObjUuid) RpcStringFreeW(ObjUuid);
773  if (Protseq) RpcStringFreeW(Protseq);
774  if (NetworkAddr) RpcStringFreeW(NetworkAddr);
775  if (Endpoint) RpcStringFreeW(Endpoint);
778 }
static const WCHAR * string_binding_find_delimiterW(const WCHAR *string_binding, WCHAR delim)
Definition: rpc_binding.c:395
#define TRUE
Definition: types.h:120
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
enum OPTION_FLAGS Options
Definition: stats.c:44
#define lstrlenW
Definition: compat.h:415
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:612
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define close
Definition: acwin.h:98
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: msctf.idl:510
static RPC_WSTR unescape_string_binding_componentW(const WCHAR *string_binding, int len)
Definition: rpc_binding.c:432
#define RPC_S_INVALID_STRING_BINDING
Definition: winerror.h:1011
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
static LPWSTR RPCRT4_strconcatW(LPWSTR dst, LPCWSTR src)
Definition: rpc_binding.c:322
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by CreateJob(), and RpcBindingFromStringBindingW().

◆ string_binding_find_delimiter()

static const unsigned char* string_binding_find_delimiter ( const unsigned char string_binding,
unsigned char  delim 
)
static

Definition at line 380 of file rpc_binding.c.

382 {
383  const unsigned char *next;
384  for (next = string_binding; *next; next++) {
385  if (*next == '\\') {
386  next++;
387  continue;
388  }
389  if (*next == delim)
390  return next;
391  }
392  return NULL;
393 }
smooth NULL
Definition: ftsmooth.c:416
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by RpcStringBindingParseA().

◆ string_binding_find_delimiterW()

static const WCHAR* string_binding_find_delimiterW ( const WCHAR string_binding,
WCHAR  delim 
)
static

Definition at line 395 of file rpc_binding.c.

397 {
398  const WCHAR *next;
399  for (next = string_binding; *next; next++) {
400  if (*next == '\\') {
401  next++;
402  continue;
403  }
404  if (*next == delim)
405  return next;
406  }
407  return NULL;
408 }
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by RpcStringBindingParseW().

◆ unescape_string_binding_component()

static RPC_CSTR unescape_string_binding_component ( const unsigned char string_binding,
int  len 
)
static

Definition at line 410 of file rpc_binding.c.

412 {
413  RPC_CSTR component, p;
414 
415  if (len == -1) len = strlen((const char *)string_binding);
416 
417  component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
418  if (!component) return NULL;
419  for (p = component; len > 0; string_binding++, len--) {
420  if (*string_binding == '\\') {
421  string_binding++;
422  len--;
423  *p++ = *string_binding;
424  } else {
425  *p++ = *string_binding;
426  }
427  }
428  *p = '\0';
429  return component;
430 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by RpcStringBindingParseA().

◆ unescape_string_binding_componentW()

static RPC_WSTR unescape_string_binding_componentW ( const WCHAR string_binding,
int  len 
)
static

Definition at line 432 of file rpc_binding.c.

434 {
435  RPC_WSTR component, p;
436 
437  if (len == -1) len = lstrlenW(string_binding);
438 
439  component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
440  if (!component) return NULL;
441  for (p = component; len > 0; string_binding++, len--) {
442  if (*string_binding == '\\') {
443  string_binding++;
444  len--;
445  *p++ = *string_binding;
446  } else {
447  *p++ = *string_binding;
448  }
449  }
450  *p = '\0';
451  return component;
452 }
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by RpcStringBindingParseW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( rpc  )