ReactOS  0.4.13-dev-73-gcfe54aa
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 "wine/unicode.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 339 of file rpc_binding.c.

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

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 360 of file rpc_binding.c.

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

Referenced by RpcStringBindingComposeW().

◆ has_nt_auth_identity()

static BOOL has_nt_auth_identity ( ULONG  AuthnLevel)
inlinestatic

Definition at line 1101 of file rpc_binding.c.

1102 {
1103  switch (AuthnLevel)
1104  {
1106  case RPC_C_AUTHN_WINNT:
1108  return TRUE;
1109  default:
1110  return FALSE;
1111  }
1112 }
#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 1984 of file rpc_binding.c.

1985 {
1986  FIXME("%p %p: stub\n", ClientBinding, ClientPID);
1987  return RPC_S_INVALID_BINDING;
1988 }
#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 958 of file rpc_binding.c.

959 {
960 
961  FIXME( "(%p,%p): stub\n", Binding, Type);
963  return RPC_S_OK;
964 }
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 972 of file rpc_binding.c.

973 {
975 
976  TRACE( "(%p,%p): stub\n", Binding, BlockingFn );
977 
978  bind->BlockingFn = BlockingFn;
979 
980  return RPC_S_OK;
981 }
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 1180 of file rpc_binding.c.

1181 {
1182  return InterlockedIncrement(&AuthInfo->refs);
1183 }
#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 1114 of file rpc_binding.c.

1119 {
1120  RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo));
1121  if (!AuthInfo)
1122  return RPC_S_OUT_OF_MEMORY;
1123 
1124  AuthInfo->refs = 1;
1125  AuthInfo->AuthnLevel = AuthnLevel;
1126  AuthInfo->AuthnSvc = AuthnSvc;
1127  AuthInfo->cred = cred;
1128  AuthInfo->exp = exp;
1129  AuthInfo->cbMaxToken = cbMaxToken;
1130  AuthInfo->identity = identity;
1131  AuthInfo->server_principal_name = NULL;
1132 
1133  /* duplicate the SEC_WINNT_AUTH_IDENTITY structure, if applicable, to
1134  * enable better matching in RpcAuthInfo_IsEqual */
1135  if (identity && has_nt_auth_identity(AuthnSvc))
1136  {
1137  const SEC_WINNT_AUTH_IDENTITY_W *nt_identity = identity;
1138  AuthInfo->nt_identity = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo->nt_identity));
1139  if (!AuthInfo->nt_identity)
1140  {
1141  HeapFree(GetProcessHeap(), 0, AuthInfo);
1142  return RPC_S_OUT_OF_MEMORY;
1143  }
1144 
1146  if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1147  AuthInfo->nt_identity->User = RPCRT4_strndupW(nt_identity->User, nt_identity->UserLength);
1148  else
1149  AuthInfo->nt_identity->User = RPCRT4_strndupAtoW((const char *)nt_identity->User, nt_identity->UserLength);
1150  AuthInfo->nt_identity->UserLength = nt_identity->UserLength;
1151  if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1152  AuthInfo->nt_identity->Domain = RPCRT4_strndupW(nt_identity->Domain, nt_identity->DomainLength);
1153  else
1154  AuthInfo->nt_identity->Domain = RPCRT4_strndupAtoW((const char *)nt_identity->Domain, nt_identity->DomainLength);
1155  AuthInfo->nt_identity->DomainLength = nt_identity->DomainLength;
1156  if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1157  AuthInfo->nt_identity->Password = RPCRT4_strndupW(nt_identity->Password, nt_identity->PasswordLength);
1158  else
1159  AuthInfo->nt_identity->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength);
1160  AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength;
1161 
1162  if ((nt_identity->User && !AuthInfo->nt_identity->User) ||
1163  (nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
1164  (nt_identity->Password && !AuthInfo->nt_identity->Password))
1165  {
1166  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
1167  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
1168  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
1169  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
1170  HeapFree(GetProcessHeap(), 0, AuthInfo);
1171  return RPC_S_OUT_OF_MEMORY;
1172  }
1173  }
1174  else
1175  AuthInfo->nt_identity = NULL;
1176  *ret = AuthInfo;
1177  return RPC_S_OK;
1178 }
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
static D3DRMMATRIX4D identity
Definition: frame.c:29
#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:1101
ULONG AuthnLevel
Definition: rpc_binding.h:40
static LPWSTR RPCRT4_strndupAtoW(LPCSTR src, INT slen)
Definition: rpc_binding.c:81
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SEC_WINNT_AUTH_IDENTITY_UNICODE
Definition: rpcdce.h:310
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:15681
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:92
#define HeapFree(x, y, z)
Definition: compat.h:394
#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 1206 of file rpc_binding.c.

1207 {
1208  if (AuthInfo1 == AuthInfo2)
1209  return TRUE;
1210 
1211  if (!AuthInfo1 || !AuthInfo2)
1212  return FALSE;
1213 
1214  if ((AuthInfo1->AuthnLevel != AuthInfo2->AuthnLevel) ||
1215  (AuthInfo1->AuthnSvc != AuthInfo2->AuthnSvc))
1216  return FALSE;
1217 
1218  if (AuthInfo1->identity == AuthInfo2->identity)
1219  return TRUE;
1220 
1221  if (!AuthInfo1->identity || !AuthInfo2->identity)
1222  return FALSE;
1223 
1224  if (has_nt_auth_identity(AuthInfo1->AuthnSvc))
1225  {
1226  const SEC_WINNT_AUTH_IDENTITY_W *identity1 = AuthInfo1->nt_identity;
1227  const SEC_WINNT_AUTH_IDENTITY_W *identity2 = AuthInfo2->nt_identity;
1228  /* compare user names */
1229  if (identity1->UserLength != identity2->UserLength ||
1230  memcmp(identity1->User, identity2->User, identity1->UserLength))
1231  return FALSE;
1232  /* compare domain names */
1233  if (identity1->DomainLength != identity2->DomainLength ||
1234  memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
1235  return FALSE;
1236  /* compare passwords */
1237  if (identity1->PasswordLength != identity2->PasswordLength ||
1238  memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
1239  return FALSE;
1240  }
1241  else
1242  return FALSE;
1243 
1244  return TRUE;
1245 }
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:1101
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 1185 of file rpc_binding.c.

1186 {
1187  ULONG refs = InterlockedDecrement(&AuthInfo->refs);
1188 
1189  if (!refs)
1190  {
1191  FreeCredentialsHandle(&AuthInfo->cred);
1192  if (AuthInfo->nt_identity)
1193  {
1194  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
1195  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
1196  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
1197  HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
1198  }
1200  HeapFree(GetProcessHeap(), 0, AuthInfo);
1201  }
1202 
1203  return refs;
1204 }
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:395
#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:394

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 986 of file rpc_binding.c.

989 {
990  RpcBinding *DestBinding;
991  RpcBinding *SrcBinding = SourceBinding;
993 
994  TRACE("(%p, %p)\n", SourceBinding, DestinationBinding);
995 
996  status = RPCRT4_AllocBinding(&DestBinding, SrcBinding->server);
997  if (status != RPC_S_OK) return status;
998 
999  DestBinding->ObjectUuid = SrcBinding->ObjectUuid;
1000  DestBinding->BlockingFn = SrcBinding->BlockingFn;
1001  DestBinding->Protseq = RPCRT4_strndupA(SrcBinding->Protseq, -1);
1002  DestBinding->NetworkAddr = RPCRT4_strndupA(SrcBinding->NetworkAddr, -1);
1003  DestBinding->Endpoint = RPCRT4_strndupA(SrcBinding->Endpoint, -1);
1004  DestBinding->NetworkOptions = RPCRT4_strdupW(SrcBinding->NetworkOptions);
1005  DestBinding->CookieAuth = RPCRT4_strdupW(SrcBinding->CookieAuth);
1006  if (SrcBinding->Assoc) SrcBinding->Assoc->refs++;
1007  DestBinding->Assoc = SrcBinding->Assoc;
1008 
1009  if (SrcBinding->AuthInfo) RpcAuthInfo_AddRef(SrcBinding->AuthInfo);
1010  DestBinding->AuthInfo = SrcBinding->AuthInfo;
1011  if (SrcBinding->QOS) RpcQualityOfService_AddRef(SrcBinding->QOS);
1012  DestBinding->QOS = SrcBinding->QOS;
1013 
1014  *DestinationBinding = DestBinding;
1015  return RPC_S_OK;
1016 }
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:110
long RPC_STATUS
Definition: rpc.h:52
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1180
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:46
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:1357
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 784 of file rpc_binding.c.

785 {
787  TRACE("(%p) = %p\n", Binding, *Binding);
788  if (*Binding)
790  else
792  if (status == RPC_S_OK) *Binding = NULL;
793  return status;
794 }
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:255
#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(), 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(), 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 837 of file rpc_binding.c.

838 {
839  RPC_STATUS ret;
840  RpcBinding* bind = NULL;
841  RPC_CSTR ObjectUuid, Protseq, NetworkAddr, Endpoint, Options;
842  UUID Uuid;
843 
844  TRACE("(%s,%p)\n", debugstr_a((char*)StringBinding), Binding);
845 
846  ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq,
847  &NetworkAddr, &Endpoint, &Options);
848  if (ret != RPC_S_OK) return ret;
849 
850  ret = UuidFromStringA(ObjectUuid, &Uuid);
851 
852  if (ret == RPC_S_OK)
853  ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq);
854  if (ret == RPC_S_OK) {
855  ret = RPCRT4_SetBindingObject(bind, &Uuid);
856  if (ret == RPC_S_OK)
857  ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint, (char*)Options);
858 
859  if (ret == RPC_S_OK)
861  else
863  }
864 
866  RpcStringFreeA(&Endpoint);
867  RpcStringFreeA(&NetworkAddr);
868  RpcStringFreeA(&Protseq);
869  RpcStringFreeA(&ObjectUuid);
870 
871  return ret;
872 }
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:123
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:565
static RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding *Binding, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCSTR NetworkOptions)
Definition: rpc_binding.c:149
enum OPTION_FLAGS Options
Definition: stats.c:44
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:161
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:255
#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:225
I_RPC_HANDLE RPC_BINDING_HANDLE
Definition: rpcdce.h:50
RPC_STATUS WINAPI UuidFromStringA(RPC_CSTR s, UUID *uuid)
Definition: rpcrt4_main.c:575
#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 877 of file rpc_binding.c.

878 {
879  RPC_STATUS ret;
880  RpcBinding* bind = NULL;
881  RPC_WSTR ObjectUuid, Protseq, NetworkAddr, Endpoint, Options;
882  UUID Uuid;
883 
884  TRACE("(%s,%p)\n", debugstr_w(StringBinding), Binding);
885 
886  ret = RpcStringBindingParseW(StringBinding, &ObjectUuid, &Protseq,
887  &NetworkAddr, &Endpoint, &Options);
888  if (ret != RPC_S_OK) return ret;
889 
890  ret = UuidFromStringW(ObjectUuid, &Uuid);
891 
892  if (ret == RPC_S_OK)
893  ret = RPCRT4_CreateBindingW(&bind, FALSE, Protseq);
894  if (ret == RPC_S_OK) {
895  ret = RPCRT4_SetBindingObject(bind, &Uuid);
896  if (ret == RPC_S_OK)
897  ret = RPCRT4_CompleteBindingW(bind, NetworkAddr, Endpoint, Options);
898 
899  if (ret == RPC_S_OK)
901  else
903  }
904 
906  RpcStringFreeW(&Endpoint);
907  RpcStringFreeW(&NetworkAddr);
908  RpcStringFreeW(&Protseq);
909  RpcStringFreeW(&ObjectUuid);
910 
911  return ret;
912 }
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
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:136
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:615
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:255
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:675
#define TRACE(s)
Definition: solgame.cpp:4
int ret
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid)
Definition: rpc_binding.c:225
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:177
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by ATSVC_HANDLE_bind(), BROWSER_IDENTIFY_HANDLE_bind(), DsSetupBind(), EVENTLOG_HANDLE_W_bind(), get_irot_handle(), LOGONSRV_HANDLE_bind(), 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 1569 of file rpc_binding.c.

1572 {
1573  return RpcBindingInqAuthClientExA(ClientBinding, Privs, ServerPrincName, AuthnLevel,
1574  AuthnSvc, AuthzSvc, 0);
1575 }
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:1593

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 1593 of file rpc_binding.c.

1596 {
1598  RPC_WSTR principal;
1599 
1600  TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
1601  AuthnSvc, AuthzSvc, Flags);
1602 
1603  status = RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName ? &principal : NULL,
1604  AuthnLevel, AuthnSvc, AuthzSvc, Flags);
1605  if (status == RPC_S_OK && ServerPrincName)
1606  {
1607  *ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
1608  if (!*ServerPrincName && principal) status = RPC_S_OUT_OF_MEMORY;
1609  RpcStringFreeW(&principal);
1610  }
1611 
1612  return status;
1613 }
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:59
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:1619
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 1619 of file rpc_binding.c.

1622 {
1623  RpcBinding *bind;
1624 
1625  TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
1626  AuthnSvc, AuthzSvc, Flags);
1627 
1628  if (!ClientBinding) ClientBinding = I_RpcGetCurrentCallHandle();
1629  if (!ClientBinding) return RPC_S_INVALID_BINDING;
1630 
1631  bind = ClientBinding;
1632  if (!bind->FromConn) return RPC_S_INVALID_BINDING;
1633 
1634  return rpcrt4_conn_inquire_auth_client(bind->FromConn, Privs,
1635  ServerPrincName, AuthnLevel,
1636  AuthnSvc, AuthzSvc, Flags);
1637 }
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:1746
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 1581 of file rpc_binding.c.

1584 {
1585  return RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName, AuthnLevel,
1586  AuthnSvc, AuthzSvc, 0);
1587 }
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:1619

◆ 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 1547 of file rpc_binding.c.

1549 {
1550  return RpcBindingInqAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity,
1551  AuthzSvc, 0, NULL);
1552 }
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:1479

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 1479 of file rpc_binding.c.

1482 {
1484  RPC_WSTR principal;
1485 
1486  TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
1487  AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
1488 
1489  status = RpcBindingInqAuthInfoExW(Binding, ServerPrincName ? &principal : NULL, AuthnLevel,
1490  AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
1491  if (status == RPC_S_OK && ServerPrincName)
1492  {
1493  *ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
1494  RpcStringFreeW(&principal);
1495  if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
1496  }
1497 
1498  return status;
1499 }
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:59
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:1505
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 1505 of file rpc_binding.c.

1508 {
1509  RpcBinding *bind = Binding;
1510 
1511  TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
1512  AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
1513 
1514  if (!bind->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH;
1515 
1516  if (SecurityQOS)
1517  {
1518  FIXME("QOS not implemented\n");
1519  return RPC_S_INVALID_BINDING;
1520  }
1521 
1522  if (ServerPrincName)
1523  {
1524  if (bind->AuthInfo->server_principal_name)
1525  {
1526  *ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name);
1527  if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
1528  }
1529  else *ServerPrincName = NULL;
1530  }
1531  if (AuthnLevel) *AuthnLevel = bind->AuthInfo->AuthnLevel;
1532  if (AuthnSvc) *AuthnSvc = bind->AuthInfo->AuthnSvc;
1533  if (AuthIdentity) *AuthIdentity = bind->AuthInfo->identity;
1534  if (AuthzSvc)
1535  {
1536  FIXME("authorization service not implemented\n");
1537  *AuthzSvc = RPC_C_AUTHZ_NONE;
1538  }
1539 
1540  return RPC_S_OK;
1541 }
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 1558 of file rpc_binding.c.

1560 {
1561  return RpcBindingInqAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity,
1562  AuthzSvc, 0, NULL);
1563 }
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:1505

◆ RpcBindingInqObject()

RPC_STATUS WINAPI RpcBindingInqObject ( RPC_BINDING_HANDLE  Binding,
UUID ObjectUuid 
)

Definition at line 813 of file rpc_binding.c.

814 {
816 
817  TRACE("(%p,%p) = %s\n", Binding, ObjectUuid, debugstr_guid(&bind->ObjectUuid));
818  *ObjectUuid = bind->ObjectUuid;
819  return RPC_S_OK;
820 }
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 1021 of file rpc_binding.c.

1022 {
1023  RpcBinding *bind = Binding;
1024 
1025  TRACE("(%p)\n", Binding);
1026 
1027  RPCRT4_strfree(bind->Endpoint);
1028  bind->Endpoint = NULL;
1029  if (bind->Assoc) RpcAssoc_Release(bind->Assoc);
1030  bind->Assoc = NULL;
1031 
1032  return RPC_S_OK;
1033 }
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:188
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:105
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 1643 of file rpc_binding.c.

1644 {
1645  RpcBinding* bind = ClientBinding;
1646  RpcBinding* NewBinding;
1647 
1648  if (!bind)
1650 
1651  if (!bind->server)
1652  return RPC_S_INVALID_BINDING;
1653 
1654  RPCRT4_AllocBinding(&NewBinding, TRUE);
1655  NewBinding->Protseq = RPCRT4_strdupA(bind->Protseq);
1656  NewBinding->NetworkAddr = RPCRT4_strdupA(bind->NetworkAddr);
1657 
1658  *ServerBinding = NewBinding;
1659 
1660  return RPC_S_OK;
1661 }
#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:110
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1746
#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 1930 of file rpc_binding.c.

1932 {
1933  TRACE("%p %s %u %u %p %u\n", Binding, debugstr_a((const char*)ServerPrincName),
1934  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
1935  return RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
1936 }
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:1667
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 1667 of file rpc_binding.c.

1671 {
1672  RpcBinding* bind = Binding;
1674  CredHandle cred;
1675  TimeStamp exp;
1676  ULONG package_count;
1677  ULONG i;
1678  PSecPkgInfoA packages;
1679  ULONG cbMaxToken;
1680 
1681  TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_a((const char*)ServerPrincName),
1682  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
1683 
1684  if (SecurityQos)
1685  {
1687 
1688  TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
1689  SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
1690  if (SecurityQos->Version >= 2)
1691  {
1692  const RPC_SECURITY_QOS_V2_A *SecurityQos2 = (const RPC_SECURITY_QOS_V2_A *)SecurityQos;
1693  TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
1695  TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
1696  SecurityQos2->u.HttpCredentials->TransportCredentials,
1697  SecurityQos2->u.HttpCredentials->Flags,
1698  SecurityQos2->u.HttpCredentials->AuthenticationTarget,
1699  SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
1700  SecurityQos2->u.HttpCredentials->AuthnSchemes,
1701  SecurityQos2->u.HttpCredentials->AuthnSchemes ? *SecurityQos2->u.HttpCredentials->AuthnSchemes : 0,
1702  SecurityQos2->u.HttpCredentials->ServerCertificateSubject);
1703  }
1704  TRACE("}\n");
1705  status = RpcQualityOfService_Create(SecurityQos, FALSE, &bind->QOS);
1706  if (status != RPC_S_OK)
1707  return status;
1708  }
1709  else
1710  {
1711  if (bind->QOS) RpcQualityOfService_Release(bind->QOS);
1712  bind->QOS = NULL;
1713  }
1714 
1715  if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
1716  AuthnSvc = RPC_C_AUTHN_WINNT;
1717 
1718  /* FIXME: the mapping should probably be retrieved using SSPI somehow */
1719  if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
1720  AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
1721 
1722  if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
1723  {
1724  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1725  bind->AuthInfo = NULL;
1726  return RPC_S_OK;
1727  }
1728 
1729  if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
1730  {
1731  FIXME("unknown AuthnLevel %u\n", AuthnLevel);
1733  }
1734 
1735  /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
1736  if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
1737  {
1738  FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
1740  }
1741 
1742  r = EnumerateSecurityPackagesA(&package_count, &packages);
1743  if (r != SEC_E_OK)
1744  {
1745  ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", r);
1746  return RPC_S_SEC_PKG_ERROR;
1747  }
1748 
1749  for (i = 0; i < package_count; i++)
1750  if (packages[i].wRPCID == AuthnSvc)
1751  break;
1752 
1753  if (i == package_count)
1754  {
1755  FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
1756  FreeContextBuffer(packages);
1758  }
1759 
1760  TRACE("found package %s for service %u\n", packages[i].Name, AuthnSvc);
1762  AuthIdentity, NULL, NULL, &cred, &exp);
1763  cbMaxToken = packages[i].cbMaxToken;
1764  FreeContextBuffer(packages);
1765  if (r == ERROR_SUCCESS)
1766  {
1767  RpcAuthInfo *new_auth_info;
1768  r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
1769  AuthIdentity, &new_auth_info);
1770  if (r == RPC_S_OK)
1771  {
1772  new_auth_info->server_principal_name = RPCRT4_strdupAtoW((char *)ServerPrincName);
1773  if (!ServerPrincName || new_auth_info->server_principal_name)
1774  {
1775  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1776  bind->AuthInfo = new_auth_info;
1777  }
1778  else
1779  {
1780  RpcAuthInfo_Release(new_auth_info);
1782  }
1783  }
1784  else
1785  FreeCredentialsHandle(&cred);
1786  return r;
1787  }
1788  else
1789  {
1790  ERR("AcquireCredentialsHandleA failed with error 0x%08x\n", r);
1791  return RPC_S_SEC_PKG_ERROR;
1792  }
1793 }
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:277
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1185
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
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:1362
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:1114
#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:70
#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:1247
DWORD exp
Definition: msg.c:15681
unsigned char * ServerCertificateSubject
Definition: rpcdce.h:260
#define RPC_S_UNKNOWN_AUTHZ_SERVICE
Definition: winerror.h:1058
unsigned int ULONG
Definition: retypes.h:1
union _RPC_SECURITY_QOS_V2_A::@3076 u
#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 1799 of file rpc_binding.c.

1802 {
1803  RpcBinding* bind = Binding;
1805  CredHandle cred;
1806  TimeStamp exp;
1807  ULONG package_count;
1808  ULONG i;
1809  PSecPkgInfoW packages;
1810  ULONG cbMaxToken;
1811 
1812  TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w(ServerPrincName),
1813  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
1814 
1815  if (SecurityQos)
1816  {
1818 
1819  TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
1820  SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
1821  if (SecurityQos->Version >= 2)
1822  {
1823  const RPC_SECURITY_QOS_V2_W *SecurityQos2 = (const RPC_SECURITY_QOS_V2_W *)SecurityQos;
1824  TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
1826  TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
1827  SecurityQos2->u.HttpCredentials->TransportCredentials,
1828  SecurityQos2->u.HttpCredentials->Flags,
1829  SecurityQos2->u.HttpCredentials->AuthenticationTarget,
1830  SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
1831  SecurityQos2->u.HttpCredentials->AuthnSchemes,
1832  SecurityQos2->u.HttpCredentials->AuthnSchemes ? *SecurityQos2->u.HttpCredentials->AuthnSchemes : 0,
1834  }
1835  TRACE("}\n");
1836  status = RpcQualityOfService_Create(SecurityQos, TRUE, &bind->QOS);
1837  if (status != RPC_S_OK)
1838  return status;
1839  }
1840  else
1841  {
1842  if (bind->QOS) RpcQualityOfService_Release(bind->QOS);
1843  bind->QOS = NULL;
1844  }
1845 
1846  if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
1847  AuthnSvc = RPC_C_AUTHN_WINNT;
1848 
1849  /* FIXME: the mapping should probably be retrieved using SSPI somehow */
1850  if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
1851  AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
1852 
1853  if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
1854  {
1855  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1856  bind->AuthInfo = NULL;
1857  return RPC_S_OK;
1858  }
1859 
1860  if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
1861  {
1862  FIXME("unknown AuthnLevel %u\n", AuthnLevel);
1864  }
1865 
1866  /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
1867  if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
1868  {
1869  FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
1871  }
1872 
1873  r = EnumerateSecurityPackagesW(&package_count, &packages);
1874  if (r != SEC_E_OK)
1875  {
1876  ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", r);
1877  return RPC_S_SEC_PKG_ERROR;
1878  }
1879 
1880  for (i = 0; i < package_count; i++)
1881  if (packages[i].wRPCID == AuthnSvc)
1882  break;
1883 
1884  if (i == package_count)
1885  {
1886  FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
1887  FreeContextBuffer(packages);
1889  }
1890 
1891  TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), AuthnSvc);
1893  AuthIdentity, NULL, NULL, &cred, &exp);
1894  cbMaxToken = packages[i].cbMaxToken;
1895  FreeContextBuffer(packages);
1896  if (r == ERROR_SUCCESS)
1897  {
1898  RpcAuthInfo *new_auth_info;
1899  r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
1900  AuthIdentity, &new_auth_info);
1901  if (r == RPC_S_OK)
1902  {
1903  new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName);
1904  if (!ServerPrincName || new_auth_info->server_principal_name)
1905  {
1906  if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
1907  bind->AuthInfo = new_auth_info;
1908  }
1909  else
1910  {
1911  RpcAuthInfo_Release(new_auth_info);
1913  }
1914  }
1915  else
1916  FreeCredentialsHandle(&cred);
1917  return r;
1918  }
1919  else
1920  {
1921  ERR("AcquireCredentialsHandleW failed with error 0x%08x\n", r);
1922  return RPC_S_SEC_PKG_ERROR;
1923  }
1924 }
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
#define TRUE
Definition: types.h:120
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:277
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1185
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:1362
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:1114
#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
union _RPC_SECURITY_QOS_V2_W::@3075 u
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:1247
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
DWORD exp
Definition: msg.c:15681
#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 1942 of file rpc_binding.c.

1944 {
1945  TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w(ServerPrincName),
1946  AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
1947  return RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
1948 }
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:1799
#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 825 of file rpc_binding.c.

826 {
828 
829  TRACE("(%p,%s)\n", Binding, debugstr_guid(ObjectUuid));
830  if (bind->server) return RPC_S_WRONG_KIND_OF_BINDING;
831  return RPCRT4_SetBindingObject(Binding, ObjectUuid);
832 }
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:225

Referenced by RPC_CreateClientChannel().

◆ RpcBindingSetOption()

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

Definition at line 1953 of file rpc_binding.c.

1954 {
1955  TRACE("(%p, %d, %ld)\n", BindingHandle, Option, OptionValue);
1956 
1957  switch (Option)
1958  {
1959  case RPC_C_OPT_COOKIE_AUTH:
1960  {
1962  RpcBinding *binding = BindingHandle;
1963  int len = MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, NULL, 0);
1964  WCHAR *str;
1965 
1966  if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return RPC_S_OUT_OF_MEMORY;
1967  MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, str, len);
1968  str[len] = 0;
1969  HeapFree(GetProcessHeap(), 0, binding->CookieAuth);
1970  binding->CookieAuth = str;
1971  break;
1972  }
1973  default:
1974  FIXME("option %u not supported\n", Option);
1975  break;
1976  }
1977  return RPC_S_OK;
1978 }
#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:395
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
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ RpcBindingToStringBindingA()

RPC_STATUS WINAPI RpcBindingToStringBindingA ( RPC_BINDING_HANDLE  Binding,
RPC_CSTR StringBinding 
)

Definition at line 917 of file rpc_binding.c.

918 {
919  RPC_STATUS ret;
921  RPC_CSTR ObjectUuid;
922 
923  TRACE("(%p,%p)\n", Binding, StringBinding);
924 
925  if (UuidIsNil(&bind->ObjectUuid, &ret))
926  ObjectUuid = NULL;
927  else
928  {
929  ret = UuidToStringA(&bind->ObjectUuid, &ObjectUuid);
930  if (ret != RPC_S_OK) return ret;
931  }
932 
933  ret = RpcStringBindingComposeA(ObjectUuid, (unsigned char*)bind->Protseq, (unsigned char*) bind->NetworkAddr,
934  (unsigned char*) bind->Endpoint, NULL, StringBinding);
935 
936  RpcStringFreeA(&ObjectUuid);
937 
938  return ret;
939 }
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:458
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:161
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:269
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, RPC_CSTR *StringUuid)
Definition: rpcrt4_main.c:515
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 944 of file rpc_binding.c.

945 {
946  RPC_STATUS ret;
947  unsigned char *str = NULL;
948  TRACE("(%p,%p)\n", Binding, StringBinding);
950  *StringBinding = RPCRT4_strdupAtoW((char*)str);
952  return ret;
953 }
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:161
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:917
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:70
int ret

Referenced by CreateJob().

◆ RpcBindingVectorFree()

RPC_STATUS WINAPI RpcBindingVectorFree ( RPC_BINDING_VECTOR **  BindingVector)

Definition at line 799 of file rpc_binding.c.

800 {
801  ULONG c;
802 
803  TRACE("(%p)\n", BindingVector);
804  for (c=0; c<(*BindingVector)->Count; c++) RpcBindingFree(&(*BindingVector)->BindingH[c]);
805  HeapFree(GetProcessHeap(), 0, *BindingVector);
806  *BindingVector = NULL;
807  return RPC_S_OK;
808 }
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:394
#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 1053 of file rpc_binding.c.

1054 {
1055  RpcBinding *bind;
1056 
1057  TRACE("(%p)\n", BindingHandle);
1058 
1060  if (!BindingHandle) return RPC_S_INVALID_BINDING;
1061 
1062  bind = BindingHandle;
1063  if (bind->FromConn)
1064  return rpcrt4_conn_impersonate_client(bind->FromConn);
1066 }
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:1746

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 1469 of file rpc_binding.c.

1470 {
1471  FIXME("(%p, %d): stub\n", BindingHandle, Timeout);
1472  return RPC_S_OK;
1473 }
_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 1357 of file rpc_binding.c.

1358 {
1359  return InterlockedIncrement(&qos->refs);
1360 }
#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 1247 of file rpc_binding.c.

1248 {
1249  RpcQualityOfService *qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos));
1250 
1251  if (!qos)
1252  return RPC_S_OUT_OF_RESOURCES;
1253 
1254  qos->refs = 1;
1255  qos->qos = HeapAlloc(GetProcessHeap(), 0, sizeof(*qos->qos));
1256  if (!qos->qos) goto error;
1257  qos->qos->Version = qos_src->Version;
1258  qos->qos->Capabilities = qos_src->Capabilities;
1259  qos->qos->IdentityTracking = qos_src->IdentityTracking;
1260  qos->qos->ImpersonationType = qos_src->ImpersonationType;
1261  qos->qos->AdditionalSecurityInfoType = 0;
1262 
1263  if (qos_src->Version >= 2)
1264  {
1265  const RPC_SECURITY_QOS_V2_W *qos_src2 = (const RPC_SECURITY_QOS_V2_W *)qos_src;
1268  {
1269  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_src = qos_src2->u.HttpCredentials;
1270  RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials_dst;
1271 
1272  http_credentials_dst = HeapAlloc(GetProcessHeap(), 0, sizeof(*http_credentials_dst));
1273  qos->qos->u.HttpCredentials = http_credentials_dst;
1274  if (!http_credentials_dst) goto error;
1275  http_credentials_dst->TransportCredentials = NULL;
1276  http_credentials_dst->Flags = http_credentials_src->Flags;
1277  http_credentials_dst->AuthenticationTarget = http_credentials_src->AuthenticationTarget;
1278  http_credentials_dst->NumberOfAuthnSchemes = http_credentials_src->NumberOfAuthnSchemes;
1279  http_credentials_dst->AuthnSchemes = NULL;
1280  http_credentials_dst->ServerCertificateSubject = NULL;
1281  if (http_credentials_src->TransportCredentials)
1282  {
1283  SEC_WINNT_AUTH_IDENTITY_W *cred_dst;
1284  cred_dst = http_credentials_dst->TransportCredentials = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cred_dst));
1285  if (!cred_dst) goto error;
1287  if (unicode)
1288  {
1289  const SEC_WINNT_AUTH_IDENTITY_W *cred_src = http_credentials_src->TransportCredentials;
1290  cred_dst->UserLength = cred_src->UserLength;
1291  cred_dst->PasswordLength = cred_src->PasswordLength;
1292  cred_dst->DomainLength = cred_src->DomainLength;
1293  cred_dst->User = RPCRT4_strndupW(cred_src->User, cred_src->UserLength);
1294  cred_dst->Password = RPCRT4_strndupW(cred_src->Password, cred_src->PasswordLength);
1295  cred_dst->Domain = RPCRT4_strndupW(cred_src->Domain, cred_src->DomainLength);
1296  }
1297  else
1298  {
1299  const SEC_WINNT_AUTH_IDENTITY_A *cred_src = (const SEC_WINNT_AUTH_IDENTITY_A *)http_credentials_src->TransportCredentials;
1300  cred_dst->UserLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, NULL, 0);
1301  cred_dst->DomainLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, NULL, 0);
1302  cred_dst->PasswordLength = MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, NULL, 0);
1303  cred_dst->User = HeapAlloc(GetProcessHeap(), 0, cred_dst->UserLength * sizeof(WCHAR));
1304  cred_dst->Password = HeapAlloc(GetProcessHeap(), 0, cred_dst->PasswordLength * sizeof(WCHAR));
1305  cred_dst->Domain = HeapAlloc(GetProcessHeap(), 0, cred_dst->DomainLength * sizeof(WCHAR));
1306  if (!cred_dst->Password || !cred_dst->Domain) goto error;
1307  MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, cred_dst->User, cred_dst->UserLength);
1308  MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, cred_dst->Domain, cred_dst->DomainLength);
1309  MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, cred_dst->Password, cred_dst->PasswordLength);
1310  }
1311  }
1312  if (http_credentials_src->NumberOfAuthnSchemes)
1313  {
1314  http_credentials_dst->AuthnSchemes = HeapAlloc(GetProcessHeap(), 0, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
1315  if (!http_credentials_dst->AuthnSchemes) goto error;
1316  memcpy(http_credentials_dst->AuthnSchemes, http_credentials_src->AuthnSchemes, http_credentials_src->NumberOfAuthnSchemes * sizeof(*http_credentials_dst->AuthnSchemes));
1317  }
1318  if (http_credentials_src->ServerCertificateSubject)
1319  {
1320  if (unicode)
1321  http_credentials_dst->ServerCertificateSubject =
1322  RPCRT4_strndupW(http_credentials_src->ServerCertificateSubject,
1323  strlenW(http_credentials_src->ServerCertificateSubject));
1324  else
1325  http_credentials_dst->ServerCertificateSubject =
1326  RPCRT4_strdupAtoW((char *)http_credentials_src->ServerCertificateSubject);
1327  if (!http_credentials_dst->ServerCertificateSubject) goto error;
1328  }
1329  }
1330  }
1331  *qos_dst = qos;
1332  return RPC_S_OK;
1333 
1334 error:
1335  if (qos->qos)
1336  {
1338  qos->qos->u.HttpCredentials)
1339  {
1341  {
1346  }
1350  }
1351  HeapFree(GetProcessHeap(), 0, qos->qos);
1352  }
1353  HeapFree(GetProcessHeap(), 0, qos);
1354  return RPC_S_OUT_OF_RESOURCES;
1355 }
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
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#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
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
union _RPC_SECURITY_QOS_V2_W::@3075 u
#define GetProcessHeap()
Definition: compat.h:395
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:70
#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:92
#define HeapFree(x, y, z)
Definition: compat.h:394
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 1387 of file rpc_binding.c.

1388 {
1389  if (qos1 == qos2)
1390  return TRUE;
1391 
1392  if (!qos1 || !qos2)
1393  return FALSE;
1394 
1395  TRACE("qos1 = { %d %d %d %d }, qos2 = { %d %d %d %d }\n",
1396  qos1->qos->Capabilities, qos1->qos->IdentityTracking,
1398  qos2->qos->Capabilities, qos2->qos->IdentityTracking,
1400 
1401  if ((qos1->qos->Capabilities != qos2->qos->Capabilities) ||
1402  (qos1->qos->IdentityTracking != qos2->qos->IdentityTracking) ||
1403  (qos1->qos->ImpersonationType != qos2->qos->ImpersonationType) ||
1405  return FALSE;
1406 
1408  {
1409  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials1 = qos1->qos->u.HttpCredentials;
1410  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials2 = qos2->qos->u.HttpCredentials;
1411 
1412  if (http_credentials1->Flags != http_credentials2->Flags)
1413  return FALSE;
1414 
1415  if (http_credentials1->AuthenticationTarget != http_credentials2->AuthenticationTarget)
1416  return FALSE;
1417 
1418  if (http_credentials1->NumberOfAuthnSchemes != http_credentials2->NumberOfAuthnSchemes)
1419  return FALSE;
1420 
1421  if ((!http_credentials1->AuthnSchemes && http_credentials2->AuthnSchemes) ||
1422  (http_credentials1->AuthnSchemes && !http_credentials2->AuthnSchemes))
1423  return FALSE;
1424 
1425  if (memcmp(http_credentials1->AuthnSchemes, http_credentials2->AuthnSchemes,
1426  http_credentials1->NumberOfAuthnSchemes * sizeof(http_credentials1->AuthnSchemes[0])))
1427  return FALSE;
1428 
1429  /* server certificate subject not currently used */
1430 
1431  if (http_credentials1->TransportCredentials != http_credentials2->TransportCredentials)
1432  {
1433  const SEC_WINNT_AUTH_IDENTITY_W *identity1 = http_credentials1->TransportCredentials;
1434  const SEC_WINNT_AUTH_IDENTITY_W *identity2 = http_credentials2->TransportCredentials;
1435 
1436  if (!identity1 || !identity2)
1437  return FALSE;
1438 
1439  /* compare user names */
1440  if (identity1->UserLength != identity2->UserLength ||
1441  memcmp(identity1->User, identity2->User, identity1->UserLength))
1442  return FALSE;
1443  /* compare domain names */
1444  if (identity1->DomainLength != identity2->DomainLength ||
1445  memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
1446  return FALSE;
1447  /* compare passwords */
1448  if (identity1->PasswordLength != identity2->PasswordLength ||
1449  memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
1450  return FALSE;
1451  }
1452  }
1453 
1454  return TRUE;
1455 }
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
union _RPC_SECURITY_QOS_V2_W::@3075 u
#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 1362 of file rpc_binding.c.

1363 {
1364  ULONG refs = InterlockedDecrement(&qos->refs);
1365 
1366  if (!refs)
1367  {
1369  {
1371  {
1376  }
1380  }
1381  HeapFree(GetProcessHeap(), 0, qos->qos);
1382  HeapFree(GetProcessHeap(), 0, qos);
1383  }
1384  return refs;
1385 }
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
union _RPC_SECURITY_QOS_V2_W::@3075 u
#define GetProcessHeap()
Definition: compat.h:395
#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:394

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

◆ RpcRevertToSelf()

◆ RpcRevertToSelfEx()

RPC_STATUS WINAPI RpcRevertToSelfEx ( RPC_BINDING_HANDLE  BindingHandle)

Definition at line 1086 of file rpc_binding.c.

1087 {
1088  RpcBinding *bind;
1089 
1090  TRACE("(%p)\n", BindingHandle);
1091 
1093  if (!BindingHandle) return RPC_S_INVALID_BINDING;
1094 
1095  bind = BindingHandle;
1096  if (bind->FromConn)
1097  return rpcrt4_conn_revert_to_self(bind->FromConn);
1099 }
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:1746

Referenced by RpcRevertToSelf().

◆ RPCRT4_AddRefBinding()

void RPCRT4_AddRefBinding ( RpcBinding Binding)

Definition at line 250 of file rpc_binding.c.

251 {
253 }
#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 110 of file rpc_binding.c.

111 {
112  RpcBinding* NewBinding;
113 
114  NewBinding = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcBinding));
115  NewBinding->refs = 1;
116  NewBinding->server = server;
117 
118  *Binding = NewBinding;
119 
120  return RPC_S_OK;
121 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define GetProcessHeap()
Definition: compat.h:395
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 294 of file rpc_binding.c.

295 {
296  TRACE("(Binding == ^%p)\n", Binding);
297  if (!Connection) return RPC_S_OK;
298  if (Binding->server) {
299  /* don't destroy a connection that is cached in the binding */
300  if (Binding->FromConn != Connection)
301  RPCRT4_ReleaseConnection(Connection);
302  }
303  else {
304  RpcAssoc_ReleaseIdleConnection(Binding->Assoc, Connection);
305  }
306  return RPC_S_OK;
307 }
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
Definition: rpc_assoc.c:438
#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 149 of file rpc_binding.c.

151 {
153 
154  TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
155  debugstr_a(NetworkAddr), debugstr_a(Endpoint), debugstr_a(NetworkOptions));
156 
157  RPCRT4_strfree(Binding->NetworkAddr);
158  Binding->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
159  RPCRT4_strfree(Binding->Endpoint);
160  Binding->Endpoint = RPCRT4_strdupA(Endpoint);
161  HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
162  Binding->NetworkOptions = RPCRT4_strdupAtoW(NetworkOptions);
163 
164  /* only attempt to get an association if the binding is complete */
165  if (Endpoint && Endpoint[0] != '\0')
166  {
167  status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
168  Binding->Endpoint, Binding->NetworkOptions,
169  &Binding->Assoc);
170  if (status != RPC_S_OK)
171  return status;
172  }
173 
174  return RPC_S_OK;
175 }
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:99
long RPC_STATUS
Definition: rpc.h:52
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:105
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define debugstr_a
Definition: kernel32.h:31
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:70
#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:394
#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 177 of file rpc_binding.c.

179 {
181 
182  TRACE("(RpcBinding == ^%p, NetworkAddr == %s, EndPoint == %s, NetworkOptions == %s)\n", Binding,
183  debugstr_w(NetworkAddr), debugstr_w(Endpoint), debugstr_w(NetworkOptions));
184 
185  RPCRT4_strfree(Binding->NetworkAddr);
186  Binding->NetworkAddr = RPCRT4_strdupWtoA(NetworkAddr);
187  RPCRT4_strfree(Binding->Endpoint);
188  Binding->Endpoint = RPCRT4_strdupWtoA(Endpoint);
189  HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
190  Binding->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
191 
192  /* only attempt to get an association if the binding is complete */
193  if (Endpoint && Endpoint[0] != '\0')
194  {
195  status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
196  Binding->Endpoint, Binding->NetworkOptions,
197  &Binding->Assoc);
198  if (status != RPC_S_OK)
199  return status;
200  }
201 
202  return RPC_S_OK;
203 }
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:99
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:59
long RPC_STATUS
Definition: rpc.h:52
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:105
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#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:394
#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 123 of file rpc_binding.c.

124 {
125  RpcBinding* NewBinding;
126 
127  RPCRT4_AllocBinding(&NewBinding, server);
128  NewBinding->Protseq = RPCRT4_strdupA(Protseq);
129 
130  TRACE("binding: %p\n", NewBinding);
131  *Binding = NewBinding;
132 
133  return RPC_S_OK;
134 }
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:110
#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 136 of file rpc_binding.c.

137 {
138  RpcBinding* NewBinding;
139 
140  RPCRT4_AllocBinding(&NewBinding, server);
141  NewBinding->Protseq = RPCRT4_strdupWtoA(Protseq);
142 
143  TRACE("binding: %p\n", NewBinding);
144  *Binding = NewBinding;
145 
146  return RPC_S_OK;
147 }
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:110
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:59
#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 233 of file rpc_binding.c.

234 {
235  RpcBinding* NewBinding;
236  TRACE("(RpcBinding == ^%p, Connection == ^%p)\n", Binding, Connection);
237 
238  RPCRT4_AllocBinding(&NewBinding, Connection->server);
239  NewBinding->Protseq = RPCRT4_strdupA(rpcrt4_conn_get_name(Connection));
240  NewBinding->NetworkAddr = RPCRT4_strdupA(Connection->NetworkAddr);
241  NewBinding->Endpoint = RPCRT4_strdupA(Connection->Endpoint);
242  NewBinding->FromConn = Connection;
243 
244  TRACE("binding: %p\n", NewBinding);
245  *Binding = NewBinding;
246 
247  return RPC_S_OK;
248 }
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:110
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 273 of file rpc_binding.c.

276 {
277  TRACE("(Binding == ^%p)\n", Binding);
278 
279  if (!Binding->server) {
280  return RpcAssoc_GetClientConnection(Binding->Assoc, InterfaceId,
281  TransferSyntax, Binding->AuthInfo, Binding->QOS, Binding->CookieAuth, Connection, from_cache);
282  } else {
283  /* we already have a connection with acceptable binding, so use it */
284  if (Binding->FromConn) {
285  *Connection = Binding->FromConn;
286  return RPC_S_OK;
287  } else {
288  ERR("no connection in binding\n");
289  return RPC_S_INTERNAL_ERROR;
290  }
291  }
292 }
#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:391
#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 255 of file rpc_binding.c.

256 {
257  if (InterlockedDecrement(&Binding->refs))
258  return RPC_S_OK;
259 
260  TRACE("binding: %p\n", Binding);
261  if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
262  RPCRT4_strfree(Binding->Endpoint);
263  RPCRT4_strfree(Binding->NetworkAddr);
264  RPCRT4_strfree(Binding->Protseq);
265  HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
266  HeapFree(GetProcessHeap(), 0, Binding->CookieAuth);
267  if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo);
270  return RPC_S_OK;
271 }
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:188
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1185
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1362
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:105
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:394
#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 205 of file rpc_binding.c.

206 {
208 
209  TRACE("(RpcBinding == ^%p, EndPoint == \"%s\"\n", Binding, Endpoint);
210 
211  RPCRT4_strfree(Binding->Endpoint);
212  Binding->Endpoint = RPCRT4_strdupA(Endpoint);
213 
214  if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
215  Binding->Assoc = NULL;
216  status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
217  Binding->Endpoint, Binding->NetworkOptions,
218  &Binding->Assoc);
219  if (status != RPC_S_OK)
220  return status;
221 
222  return RPC_S_OK;
223 }
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:188
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:99
long RPC_STATUS
Definition: rpc.h:52
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:105
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 225 of file rpc_binding.c.

226 {
227  TRACE("(*RpcBinding == ^%p, UUID == %s)\n", Binding, debugstr_guid(ObjectUuid));
228  if (ObjectUuid) Binding->ObjectUuid = *ObjectUuid;
229  else UuidCreateNil(&Binding->ObjectUuid);
230  return RPC_S_OK;
231 }
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
RPC_STATUS WINAPI UuidCreateNil(UUID *Uuid)
Definition: rpcrt4_main.c:285
#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 309 of file rpc_binding.c.

310 {
311  DWORD len = strlen(dst), slen = strlen(src);
312  LPSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(CHAR));
313  if (!ndst)
314  {
315  HeapFree(GetProcessHeap(), 0, dst);
316  return NULL;
317  }
318  ndst[len] = ',';
319  memcpy(ndst+len+1, src, slen+1);
320  return ndst;
321 }
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:395
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:393
GLenum GLenum dst
Definition: glext.h:6340
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by RpcStringBindingParseA().

◆ RPCRT4_strconcatW()

static LPWSTR RPCRT4_strconcatW ( LPWSTR  dst,
LPCWSTR  src 
)
static

Definition at line 323 of file rpc_binding.c.

324 {
325  DWORD len = strlenW(dst), slen = strlenW(src);
326  LPWSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(WCHAR));
327  if (!ndst)
328  {
329  HeapFree(GetProcessHeap(), 0, dst);
330  return NULL;
331  }
332  ndst[len] = ',';
333  memcpy(ndst+len+1, src, (slen+1)*sizeof(WCHAR));
334  return ndst;
335 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
__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:393
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by RpcStringBindingParseW().

◆ RPCRT4_strdupAtoW()

LPWSTR RPCRT4_strdupAtoW ( LPCSTR  src)

Definition at line 70 of file rpc_binding.c.

71 {
72  DWORD len;
73  LPWSTR s;
74  if (!src) return NULL;
75  len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
76  s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
77  MultiByteToWideChar(CP_ACP, 0, src, -1, s, len);
78  return s;
79 }
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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 59 of file rpc_binding.c.

60 {
61  DWORD len;
62  LPSTR s;
63  if (!src) return NULL;
64  len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
65  s = HeapAlloc(GetProcessHeap(), 0, len);
67  return s;
68 }
#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:395
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 46 of file rpc_binding.c.

47 {
48  DWORD len;
49  LPSTR s;
50  if (!src) return NULL;
51  if (slen == -1) slen = strlen(src);
52  len = slen;
53  s = HeapAlloc(GetProcessHeap(), 0, len+1);
54  memcpy(s, src, len);
55  s[len] = 0;
56  return s;
57 }
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:395
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 81 of file rpc_binding.c.

82 {
83  DWORD len;
84  LPWSTR s;
85  if (!src) return NULL;
86  len = MultiByteToWideChar(CP_ACP, 0, src, slen, NULL, 0);
87  s = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
88  MultiByteToWideChar(CP_ACP, 0, src, slen, s, len);
89  return s;
90 }
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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 92 of file rpc_binding.c.

93 {
94  DWORD len;
95  LPWSTR s;
96  if (!src) return NULL;
97  if (slen == -1) slen = strlenW(src);
98  len = slen;
99  s = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
100  memcpy(s, src, len*sizeof(WCHAR));
101  s[len] = 0;
102  return s;
103 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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 458 of file rpc_binding.c.

461 {
462  DWORD len = 1;
463  RPC_CSTR data;
464 
465  TRACE( "(%s,%s,%s,%s,%s,%p)\n",
466  debugstr_a( (char*)ObjUuid ), debugstr_a( (char*)Protseq ),
467  debugstr_a( (char*)NetworkAddr ), debugstr_a( (char*)Endpoint ),
468  debugstr_a( (char*)Options ), StringBinding );
469 
470  /* overestimate for each component for escaping of delimiters */
471  if (ObjUuid && *ObjUuid) len += strlen((char*)ObjUuid) * 2 + 1;
472  if (Protseq && *Protseq) len += strlen((char*)Protseq) * 2 + 1;
473  if (NetworkAddr && *NetworkAddr) len += strlen((char*)NetworkAddr) * 2;
474  if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) * 2 + 2;
475  if (Options && *Options) len += strlen((char*)Options) * 2 + 2;
476 
477  data = HeapAlloc(GetProcessHeap(), 0, len);
478  *StringBinding = data;
479 
480  if (ObjUuid && *ObjUuid) {
482  *data++ = '@';
483  }
484  if (Protseq && *Protseq) {
486  *data++ = ':';
487  }
488  if (NetworkAddr && *NetworkAddr)
489  data = escape_string_binding_component(data, NetworkAddr);
490 
491  if ((Endpoint && *Endpoint) ||
492  (Options && *Options)) {
493  *data++ = '[';
494  if (Endpoint && *Endpoint) {
496  if (Options && *Options) *data++ = ',';
497  }
498  if (Options && *Options) {
500  }
501  *data++ = ']';
502  }
503  *data = 0;
504 
505  return RPC_S_OK;
506 }
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:395
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:339
#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 511 of file rpc_binding.c.

514 {
515  DWORD len = 1;
516  RPC_WSTR data;
517 
518  TRACE("(%s,%s,%s,%s,%s,%p)\n",
519  debugstr_w( ObjUuid ), debugstr_w( Protseq ),
520  debugstr_w( NetworkAddr ), debugstr_w( Endpoint ),
521  debugstr_w( Options ), StringBinding);
522 
523  /* overestimate for each component for escaping of delimiters */
524  if (ObjUuid && *ObjUuid) len += strlenW(ObjUuid) * 2 + 1;
525  if (Protseq && *Protseq) len += strlenW(Protseq) * 2 + 1;
526  if (NetworkAddr && *NetworkAddr) len += strlenW(NetworkAddr) * 2;
527  if (Endpoint && *Endpoint) len += strlenW(Endpoint) * 2 + 2;
528  if (Options && *Options) len += strlenW(Options) * 2 + 2;
529 
530  data = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
531  *StringBinding = data;
532 
533  if (ObjUuid && *ObjUuid) {
535  *data++ = '@';
536  }
537  if (Protseq && *Protseq) {
539  *data++ = ':';
540  }
541  if (NetworkAddr && *NetworkAddr) {
543  }
544  if ((Endpoint && *Endpoint) ||
545  (Options && *Options)) {
546  *data++ = '[';
547  if (Endpoint && *Endpoint) {
549  if (Options && *Options) *data++ = ',';
550  }
551  if (Options && *Options) {
553  }
554  *data++ = ']';
555  }
556  *data = 0;
557 
558  return RPC_S_OK;
559 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
enum OPTION_FLAGS Options
Definition: stats.c:44
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:360
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(), DsSetupBind(), EVENTLOG_HANDLE_W_bind(), get_irot_handle(), LOGONSRV_HANDLE_bind(), 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 565 of file rpc_binding.c.

568 {
569  const unsigned char *data, *next;
570  static const char ep_opt[] = "endpoint=";
571  BOOL endpoint_already_found = FALSE;
572 
573  TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a((char*)StringBinding),
574  ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
575 
576  if (ObjUuid) *ObjUuid = NULL;
577  if (Protseq) *Protseq = NULL;
578  if (NetworkAddr) *NetworkAddr = NULL;
579  if (Endpoint) *Endpoint = NULL;
580  if (Options) *Options = NULL;
581 
582  data = StringBinding;
583 
585  if (next) {
586  UUID uuid;
589  status = UuidFromStringA(str_uuid, &uuid);
590  if (status != RPC_S_OK) {
591  HeapFree(GetProcessHeap(), 0, str_uuid);
592  return status;
593  }
594  if (ObjUuid)
595  *ObjUuid = str_uuid;
596  else
597  HeapFree(GetProcessHeap(), 0, str_uuid);
598  data = next+1;
599  }
600 
602  if (next) {
603  if (Protseq) *Protseq = unescape_string_binding_component(data, next - data);
604  data = next+1;
605  }
606 
608  if (next) {
609  const unsigned char *close;
610  RPC_CSTR opt;
611 
612  if (NetworkAddr) *NetworkAddr = unescape_string_binding_component(data, next - data);
613  data = next+1;
615  if (!close) goto fail;
616 
617  /* tokenize options */
618  while (data < close) {
620  if (!next || next > close) next = close;
621  /* FIXME: this is kind of inefficient */
623  data = next+1;
624 
625  /* parse option */
627  if (!next) {
628  /* not an option, must be an endpoint */
629  if (endpoint_already_found) goto fail;
630  if (Endpoint) *Endpoint = opt;
631  else HeapFree(GetProcessHeap(), 0, opt);
632  endpoint_already_found = TRUE;
633  } else {
634  if (strncmp((const char *)opt, ep_opt, strlen(ep_opt)) == 0) {
635  /* endpoint option */
636  if (endpoint_already_found) goto fail;
637  if (Endpoint) *Endpoint = unescape_string_binding_component(next+1, -1);
638  HeapFree(GetProcessHeap(), 0, opt);
639  endpoint_already_found = TRUE;
640  } else {
641  /* network option */
642  if (Options) {
643  if (*Options) {
644  /* FIXME: this is kind of inefficient */
645  *Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, (char *)opt);
646  HeapFree(GetProcessHeap(), 0, opt);
647  } else
648  *Options = opt;
649  } else
650  HeapFree(GetProcessHeap(), 0, opt);
651  }
652  }
653  }
654 
655  data = close+1;
656  if (*data) goto fail;
657  }
658  else if (NetworkAddr)
659  *NetworkAddr = unescape_string_binding_component(data, -1);
660 
661  return RPC_S_OK;
662 
663 fail:
664  if (ObjUuid) RpcStringFreeA(ObjUuid);
665  if (Protseq) RpcStringFreeA(Protseq);
666  if (NetworkAddr) RpcStringFreeA(NetworkAddr);
667  if (Endpoint) RpcStringFreeA(Endpoint);
670 }
#define TRUE
Definition: types.h:120
static RPC_CSTR unescape_string_binding_component(const unsigned char *string_binding, int len)
Definition: rpc_binding.c:411
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:161
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:309
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:381
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#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:74
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:575
#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:394
#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 675 of file rpc_binding.c.

678 {
679  const WCHAR *data, *next;
680  static const WCHAR ep_opt[] = {'e','n','d','p','o','i','n','t','=',0};
681  BOOL endpoint_already_found = FALSE;
682 
683  TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_w(StringBinding),
684  ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
685 
686  if (ObjUuid) *ObjUuid = NULL;
687  if (Protseq) *Protseq = NULL;
688  if (NetworkAddr) *NetworkAddr = NULL;
689  if (Endpoint) *Endpoint = NULL;
690  if (Options) *Options = NULL;
691 
692  data = StringBinding;
693 
695  if (next) {
696  UUID uuid;
699  status = UuidFromStringW(str_uuid, &uuid);
700  if (status != RPC_S_OK) {
701  HeapFree(GetProcessHeap(), 0, str_uuid);
702  return status;
703  }
704  if (ObjUuid)
705  *ObjUuid = str_uuid;
706  else
707  HeapFree(GetProcessHeap(), 0, str_uuid);
708  data = next+1;
709  }
710 
712  if (next) {
713  if (Protseq) *Protseq = unescape_string_binding_componentW(data, next - data);
714  data = next+1;
715  }
716 
718  if (next) {
719  const WCHAR *close;
720  RPC_WSTR opt;
721 
722  if (NetworkAddr) *NetworkAddr = unescape_string_binding_componentW(data, next - data);
723  data = next+1;
725  if (!close) goto fail;
726 
727  /* tokenize options */
728  while (data < close) {
730  if (!next || next > close) next = close;
731  /* FIXME: this is kind of inefficient */
733  data = next+1;
734 
735  /* parse option */
737  if (!next) {
738  /* not an option, must be an endpoint */
739  if (endpoint_already_found) goto fail;
740  if (Endpoint) *Endpoint = opt;
741  else HeapFree(GetProcessHeap(), 0, opt);
742  endpoint_already_found = TRUE;
743  } else {
744  if (strncmpW(opt, ep_opt, strlenW(ep_opt)) == 0) {
745  /* endpoint option */
746  if (endpoint_already_found) goto fail;
747  if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
748  HeapFree(GetProcessHeap(), 0, opt);
749  endpoint_already_found = TRUE;
750  } else {
751  /* network option */
752  if (Options) {
753  if (*Options) {
754  /* FIXME: this is kind of inefficient */
756  HeapFree(GetProcessHeap(), 0, opt);
757  } else
758  *Options = opt;
759  } else
760  HeapFree(GetProcessHeap(), 0, opt);
761  }
762  }
763  }
764 
765  data = close+1;
766  if (*data) goto fail;
767  } else if (NetworkAddr)
768  *NetworkAddr = unescape_string_binding_componentW(data, -1);
769 
770  return RPC_S_OK;
771 
772 fail:
773  if (ObjUuid) RpcStringFreeW(ObjUuid);
774  if (Protseq) RpcStringFreeW(Protseq);
775  if (NetworkAddr) RpcStringFreeW(NetworkAddr);
776  if (Endpoint) RpcStringFreeW(Endpoint);
779 }
static const WCHAR * string_binding_find_delimiterW(const WCHAR *string_binding, WCHAR delim)
Definition: rpc_binding.c:396
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
enum OPTION_FLAGS Options
Definition: stats.c:44
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:615
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:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define close
Definition: acwin.h:74
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:433
#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:394
static LPWSTR RPCRT4_strconcatW(LPWSTR dst, LPCWSTR src)
Definition: rpc_binding.c:323
#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 381 of file rpc_binding.c.

383 {
384  const unsigned char *next;
385  for (next = string_binding; *next; next++) {
386  if (*next == '\\') {
387  next++;
388  continue;
389  }
390  if (*next == delim)
391  return next;
392  }
393  return NULL;
394 }
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 396 of file rpc_binding.c.

398 {
399  const WCHAR *next;
400  for (next = string_binding; *next; next++) {
401  if (*next == '\\') {
402  next++;
403  continue;
404  }
405  if (*next == delim)
406  return next;
407  }
408  return NULL;
409 }
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 411 of file rpc_binding.c.

413 {
414  RPC_CSTR component, p;
415 
416  if (len == -1) len = strlen((const char *)string_binding);
417 
418  component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
419  if (!component) return NULL;
420  for (p = component; len > 0; string_binding++, len--) {
421  if (*string_binding == '\\') {
422  string_binding++;
423  len--;
424  *p++ = *string_binding;
425  } else {
426  *p++ = *string_binding;
427  }
428  }
429  *p = '\0';
430  return component;
431 }
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:395
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 433 of file rpc_binding.c.

435 {
436  RPC_WSTR component, p;
437 
438  if (len == -1) len = strlenW(string_binding);
439 
440  component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
441  if (!component) return NULL;
442  for (p = component; len > 0; string_binding++, len--) {
443  if (*string_binding == '\\') {
444  string_binding++;
445  len--;
446  *p++ = *string_binding;
447  } else {
448  *p++ = *string_binding;
449  }
450  }
451  *p = '\0';
452  return component;
453 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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  )