ReactOS  0.4.14-dev-606-g14ebc0b
rpc_binding.h File Reference
#include "rpcndr.h"
#include "security.h"
#include "wine/list.h"
#include "rpc_defs.h"
Include dependency graph for rpc_binding.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RpcAuthInfo
 
struct  _RpcQualityOfService
 
struct  _RpcConnection
 
struct  connection_ops
 
struct  _RpcBinding
 

Macros

#define RPCRT4_strdupA(x)   RPCRT4_strndupA((x),-1)
 
#define RPCRT4_strdupW(x)   RPCRT4_strndupW((x),-1)
 

Typedefs

typedef struct _RpcAuthInfo RpcAuthInfo
 
typedef struct _RpcQualityOfService RpcQualityOfService
 
typedef struct _RpcConnection RpcConnection
 
typedef struct _RpcBinding RpcBinding
 

Enumerations

enum  secure_packet_direction { SECURE_PACKET_SEND, SECURE_PACKET_RECEIVE }
 

Functions

LPSTR RPCRT4_strndupA (LPCSTR src, INT len) DECLSPEC_HIDDEN
 
LPWSTR RPCRT4_strndupW (LPCWSTR src, INT len) DECLSPEC_HIDDEN
 
LPSTR RPCRT4_strdupWtoA (LPCWSTR src) DECLSPEC_HIDDEN
 
LPWSTR RPCRT4_strdupAtoW (LPCSTR src) DECLSPEC_HIDDEN
 
void RPCRT4_strfree (LPSTR src) DECLSPEC_HIDDEN
 
RPC_STATUS RpcAuthInfo_Create (ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret) DECLSPEC_HIDDEN
 
ULONG RpcAuthInfo_AddRef (RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN
 
ULONG RpcAuthInfo_Release (RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN
 
BOOL RpcAuthInfo_IsEqual (const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN
 
ULONG RpcQualityOfService_AddRef (RpcQualityOfService *qos) DECLSPEC_HIDDEN
 
ULONG RpcQualityOfService_Release (RpcQualityOfService *qos) DECLSPEC_HIDDEN
 
BOOL RpcQualityOfService_IsEqual (const RpcQualityOfService *qos1, const RpcQualityOfService *qos2) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_CreateConnection (RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
 
RpcConnectionRPCRT4_GrabConnection (RpcConnection *conn) DECLSPEC_HIDDEN
 
void RPCRT4_ReleaseConnection (RpcConnection *Connection) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_OpenClientConnection (RpcConnection *Connection) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_CloseConnection (RpcConnection *Connection) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_IsServerListening (const char *protseq, const char *endpoint) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_ResolveBinding (RpcBinding *Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_SetBindingObject (RpcBinding *Binding, const UUID *ObjectUuid) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_MakeBinding (RpcBinding **Binding, RpcConnection *Connection) DECLSPEC_HIDDEN
 
void RPCRT4_AddRefBinding (RpcBinding *Binding) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_ReleaseBinding (RpcBinding *Binding) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_OpenBinding (RpcBinding *Binding, RpcConnection **Connection, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId, BOOL *from_cache) DECLSPEC_HIDDEN
 
RPC_STATUS RPCRT4_CloseBinding (RpcBinding *Binding, RpcConnection *Connection) DECLSPEC_HIDDEN
 
void rpcrt4_conn_release_and_wait (RpcConnection *connection) DECLSPEC_HIDDEN
 
static const charrpcrt4_conn_get_name (const RpcConnection *Connection)
 
static int rpcrt4_conn_read (RpcConnection *Connection, void *buffer, unsigned int len)
 
static int rpcrt4_conn_write (RpcConnection *Connection, const void *buffer, unsigned int len)
 
static int rpcrt4_conn_close (RpcConnection *Connection)
 
static void rpcrt4_conn_close_read (RpcConnection *connection)
 
static void rpcrt4_conn_cancel_call (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_conn_handoff (RpcConnection *old_conn, RpcConnection *new_conn)
 
static BOOL rpcrt4_conn_is_authorized (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_conn_authorize (RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len)
 
static RPC_STATUS rpcrt4_conn_secure_packet (RpcConnection *conn, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size)
 
static RPC_STATUS rpcrt4_conn_impersonate_client (RpcConnection *conn)
 
static RPC_STATUS rpcrt4_conn_revert_to_self (RpcConnection *conn)
 
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)
 
RPC_STATUS RpcTransport_GetTopOfTower (unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN
 
RPC_STATUS RpcTransport_ParseTopOfTower (const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN
 
void RPCRT4_SetThreadCurrentConnection (RpcConnection *Connection) DECLSPEC_HIDDEN
 
void RPCRT4_SetThreadCurrentCallHandle (RpcBinding *Binding) DECLSPEC_HIDDEN
 
RpcBindingRPCRT4_GetThreadCurrentCallHandle (void) DECLSPEC_HIDDEN
 
void RPCRT4_PushThreadContextHandle (NDR_SCONTEXT SContext) DECLSPEC_HIDDEN
 
void RPCRT4_RemoveThreadContextHandle (NDR_SCONTEXT SContext) DECLSPEC_HIDDEN
 
NDR_SCONTEXT RPCRT4_PopThreadContextHandle (void) DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ RPCRT4_strdupA

#define RPCRT4_strdupA (   x)    RPCRT4_strndupA((x),-1)

Definition at line 151 of file rpc_binding.h.

◆ RPCRT4_strdupW

#define RPCRT4_strdupW (   x)    RPCRT4_strndupW((x),-1)

Definition at line 152 of file rpc_binding.h.

Typedef Documentation

◆ RpcAuthInfo

◆ RpcBinding

◆ RpcConnection

◆ RpcQualityOfService

Enumeration Type Documentation

◆ secure_packet_direction

Enumerator
SECURE_PACKET_SEND 
SECURE_PACKET_RECEIVE 

Definition at line 30 of file rpc_binding.h.

Function Documentation

◆ RpcAuthInfo_AddRef()

ULONG RpcAuthInfo_AddRef ( RpcAuthInfo AuthInfo)

Definition at line 1179 of file rpc_binding.c.

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

Referenced by RpcBindingCopy(), and RPCRT4_CreateConnection().

◆ RpcAuthInfo_Create()

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

Definition at line 1113 of file rpc_binding.c.

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

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

◆ RpcAuthInfo_IsEqual()

BOOL RpcAuthInfo_IsEqual ( const RpcAuthInfo AuthInfo1,
const RpcAuthInfo AuthInfo2 
)

Definition at line 1205 of file rpc_binding.c.

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

Referenced by RpcAssoc_GetIdleConnection().

◆ RpcAuthInfo_Release()

ULONG RpcAuthInfo_Release ( RpcAuthInfo AuthInfo)

Definition at line 1184 of file rpc_binding.c.

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

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

◆ RpcQualityOfService_AddRef()

ULONG RpcQualityOfService_AddRef ( RpcQualityOfService qos)

Definition at line 1356 of file rpc_binding.c.

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

Referenced by RpcBindingCopy(), and RPCRT4_CreateConnection().

◆ RpcQualityOfService_IsEqual()

BOOL RpcQualityOfService_IsEqual ( const RpcQualityOfService qos1,
const RpcQualityOfService qos2 
)

Definition at line 1386 of file rpc_binding.c.

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

Referenced by RpcAssoc_GetIdleConnection().

◆ RpcQualityOfService_Release()

ULONG RpcQualityOfService_Release ( RpcQualityOfService qos)

Definition at line 1361 of file rpc_binding.c.

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

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

◆ RPCRT4_AddRefBinding()

void RPCRT4_AddRefBinding ( RpcBinding Binding)

Definition at line 249 of file rpc_binding.c.

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

Referenced by I_RpcNegotiateTransferSyntax().

◆ RPCRT4_CloseBinding()

RPC_STATUS RPCRT4_CloseBinding ( RpcBinding Binding,
RpcConnection Connection 
)

Definition at line 293 of file rpc_binding.c.

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

Referenced by I_RpcFreeBuffer().

◆ RPCRT4_CloseConnection()

RPC_STATUS RPCRT4_CloseConnection ( RpcConnection Connection)

Definition at line 3348 of file rpc_transport.c.

3349 {
3350  TRACE("(Connection == ^%p)\n", Connection);
3351  if (SecIsValidHandle(&Connection->ctx))
3352  {
3353  DeleteSecurityContext(&Connection->ctx);
3354  SecInvalidateHandle(&Connection->ctx);
3355  }
3356  rpcrt4_conn_close(Connection);
3357  return RPC_S_OK;
3358 }
static int rpcrt4_conn_close(RpcConnection *Connection)
Definition: rpc_binding.h:200
#define SecIsValidHandle(x)
Definition: sspi.h:63
#define SecInvalidateHandle(x)
Definition: sspi.h:58
#define TRACE(s)
Definition: solgame.cpp:4
CtxtHandle ctx
Definition: rpc_binding.h:74
#define RPC_S_OK
Definition: rpcnterr.h:22
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450

Referenced by RPCRT4_ReleaseConnection(), and RPCRT4_server_thread().

◆ rpcrt4_conn_authorize()

static RPC_STATUS rpcrt4_conn_authorize ( RpcConnection conn,
BOOL  first_time,
unsigned char in_buffer,
unsigned int  in_len,
unsigned char out_buffer,
unsigned int out_len 
)
inlinestatic

Definition at line 225 of file rpc_binding.h.

228 {
229  return conn->ops->authorize(conn, first_time, in_buffer, in_len, out_buffer, out_len);
230 }
const struct connection_ops * ops
Definition: rpc_binding.h:70
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID out_buffer
Definition: file.c:100
static unsigned char * in_buffer
Definition: iccvid.c:87

Referenced by RPCRT4_ClientConnectionAuth(), RPCRT4_Send(), and RPCRT4_ServerConnectionAuth().

◆ rpcrt4_conn_cancel_call()

static void rpcrt4_conn_cancel_call ( RpcConnection Connection)
inlinestatic

Definition at line 210 of file rpc_binding.h.

211 {
212  Connection->ops->cancel_call(Connection);
213 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by rpc_cancel_thread().

◆ rpcrt4_conn_close()

static int rpcrt4_conn_close ( RpcConnection Connection)
inlinestatic

Definition at line 200 of file rpc_binding.h.

201 {
202  return Connection->ops->close(Connection);
203 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by RPCRT4_CloseConnection().

◆ rpcrt4_conn_close_read()

static void rpcrt4_conn_close_read ( RpcConnection connection)
inlinestatic

Definition at line 205 of file rpc_binding.h.

206 {
207  connection->ops->close_read(connection);
208 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by RPCRT4_server_thread().

◆ rpcrt4_conn_get_name()

static const char* rpcrt4_conn_get_name ( const RpcConnection Connection)
inlinestatic

Definition at line 183 of file rpc_binding.h.

184 {
185  return Connection->ops->name;
186 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by process_bind_packet_no_send(), RPCRT4_MakeBinding(), and rpcrt4_spawn_connection().

◆ rpcrt4_conn_handoff()

static RPC_STATUS rpcrt4_conn_handoff ( RpcConnection old_conn,
RpcConnection new_conn 
)
inlinestatic

Definition at line 215 of file rpc_binding.h.

216 {
217  return old_conn->ops->handoff(old_conn, new_conn);
218 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by rpcrt4_spawn_connection().

◆ rpcrt4_conn_impersonate_client()

static RPC_STATUS rpcrt4_conn_impersonate_client ( RpcConnection conn)
inlinestatic

Definition at line 241 of file rpc_binding.h.

243 {
244  return conn->ops->impersonate_client(conn);
245 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by RpcImpersonateClient().

◆ rpcrt4_conn_inquire_auth_client()

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 
)
inlinestatic

Definition at line 253 of file rpc_binding.h.

256 {
257  return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags);
258 }
const struct connection_ops * ops
Definition: rpc_binding.h:70
GLbitfield flags
Definition: glext.h:7161

Referenced by RpcBindingInqAuthClientExW().

◆ rpcrt4_conn_is_authorized()

static BOOL rpcrt4_conn_is_authorized ( RpcConnection Connection)
inlinestatic

Definition at line 220 of file rpc_binding.h.

221 {
222  return Connection->ops->is_authorized(Connection);
223 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_Send().

◆ rpcrt4_conn_read()

static int rpcrt4_conn_read ( RpcConnection Connection,
void buffer,
unsigned int  len 
)
inlinestatic

Definition at line 188 of file rpc_binding.h.

190 {
191  return Connection->ops->read(Connection, buffer, len);
192 }
GLuint buffer
Definition: glext.h:5915
const struct connection_ops * ops
Definition: rpc_binding.h:70
GLenum GLsizei len
Definition: glext.h:6722

Referenced by RPCRT4_default_receive_fragment().

◆ rpcrt4_conn_release_and_wait()

void rpcrt4_conn_release_and_wait ( RpcConnection connection)

Definition at line 3424 of file rpc_transport.c.

3425 {
3426  HANDLE event = NULL;
3427 
3428  if (connection->ref > 1)
3429  event = connection->wait_release = CreateEventW(NULL, TRUE, FALSE, NULL);
3430 
3431  RPCRT4_ReleaseConnection(connection);
3432 
3433  if(event)
3434  {
3436  CloseHandle(event);
3437  }
3438 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
void RPCRT4_ReleaseConnection(RpcConnection *connection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
HANDLE wait_release
Definition: rpc_binding.h:66
struct _cl_event * event
Definition: glext.h:7739
#define INFINITE
Definition: serial.h:102

Referenced by RPCRT4_server_thread().

◆ rpcrt4_conn_revert_to_self()

static RPC_STATUS rpcrt4_conn_revert_to_self ( RpcConnection conn)
inlinestatic

Definition at line 247 of file rpc_binding.h.

249 {
250  return conn->ops->revert_to_self(conn);
251 }
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by RpcRevertToSelfEx().

◆ rpcrt4_conn_secure_packet()

static RPC_STATUS rpcrt4_conn_secure_packet ( RpcConnection conn,
enum secure_packet_direction  dir,
RpcPktHdr hdr,
unsigned int  hdr_size,
unsigned char stub_data,
unsigned int  stub_data_size,
RpcAuthVerifier auth_hdr,
unsigned char auth_value,
unsigned int  auth_value_size 
)
inlinestatic

Definition at line 232 of file rpc_binding.h.

237 {
238  return conn->ops->secure_packet(conn, dir, hdr, hdr_size, stub_data, stub_data_size, auth_hdr, auth_value, auth_value_size);
239 }
char hdr[14]
Definition: iptest.cpp:33
const struct connection_ops * ops
Definition: rpc_binding.h:70
unsigned int dir
Definition: maze.c:112

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_SendWithAuth().

◆ rpcrt4_conn_write()

static int rpcrt4_conn_write ( RpcConnection Connection,
const void buffer,
unsigned int  len 
)
inlinestatic

Definition at line 194 of file rpc_binding.h.

196 {
197  return Connection->ops->write(Connection, buffer, len);
198 }
GLuint buffer
Definition: glext.h:5915
const struct connection_ops * ops
Definition: rpc_binding.h:70
GLenum GLsizei len
Definition: glext.h:6722

Referenced by RPCRT4_SendWithAuth().

◆ RPCRT4_CreateConnection()

RPC_STATUS RPCRT4_CreateConnection ( RpcConnection **  Connection,
BOOL  server,
LPCSTR  Protseq,
LPCSTR  NetworkAddr,
LPCSTR  Endpoint,
LPCWSTR  NetworkOptions,
RpcAuthInfo AuthInfo,
RpcQualityOfService QOS,
LPCWSTR  CookieAuth 
)

Definition at line 3360 of file rpc_transport.c.

3363 {
3364  static LONG next_id;
3365  const struct connection_ops *ops;
3366  RpcConnection* NewConnection;
3367 
3368  ops = rpcrt4_get_conn_protseq_ops(Protseq);
3369  if (!ops)
3370  {
3371  FIXME("not supported for protseq %s\n", Protseq);
3373  }
3374 
3375  NewConnection = ops->alloc();
3376  NewConnection->ref = 1;
3377  NewConnection->server = server;
3378  NewConnection->ops = ops;
3379  NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
3380  NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
3381  NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
3382  NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth);
3383  NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
3384  NewConnection->NextCallId = 1;
3385 
3386  SecInvalidateHandle(&NewConnection->ctx);
3387  if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
3388  NewConnection->AuthInfo = AuthInfo;
3389  NewConnection->auth_context_id = InterlockedIncrement( &next_id );
3391  NewConnection->QOS = QOS;
3392 
3393  list_init(&NewConnection->conn_pool_entry);
3394  list_init(&NewConnection->protseq_entry);
3395 
3396  TRACE("connection: %p\n", NewConnection);
3397  *Connection = NewConnection;
3398 
3399  return RPC_S_OK;
3400 }
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
struct list protseq_entry
Definition: rpc_binding.h:94
static rfbScreenInfoPtr server
Definition: vnc.c:74
USHORT NextCallId
Definition: rpc_binding.h:93
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
static LONG next_id
Definition: changenotify.c:91
const struct connection_ops * ops
Definition: rpc_binding.h:70
struct list conn_pool_entry
Definition: rpc_binding.h:85
#define SecInvalidateHandle(x)
Definition: sspi.h:58
long LONG
Definition: pedump.c:60
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1179
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1014
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
LPSTR NetworkAddr
Definition: rpc_binding.h:67
LPWSTR CookieAuth
Definition: rpc_binding.h:82
CtxtHandle ctx
Definition: rpc_binding.h:74
RpcConnection *(* alloc)(void)
Definition: rpc_binding.h:102
#define InterlockedIncrement
Definition: armddk.h:53
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos)
Definition: rpc_binding.c:1356
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
ULONG auth_context_id
Definition: rpc_binding.h:78
struct _QualityOfService QOS
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcAssoc_GetClientConnection(), rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(), rpcrt4_protseq_ncacn_np_open_endpoint(), rpcrt4_protseq_ncalrpc_open_endpoint(), and rpcrt4_spawn_connection().

◆ RPCRT4_GetThreadCurrentCallHandle()

RpcBinding* RPCRT4_GetThreadCurrentCallHandle ( void  )

Definition at line 970 of file rpcrt4_main.c.

971 {
972  struct threaddata *tdata = get_or_create_threaddata();
973  if (!tdata) return NULL;
974 
975  return tdata->server_binding;
976 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:930
smooth NULL
Definition: ftsmooth.c:416
RpcBinding * server_binding
Definition: rpcrt4_main.c:94

Referenced by I_RpcGetCurrentCallHandle().

◆ RPCRT4_GrabConnection()

RpcConnection* RPCRT4_GrabConnection ( RpcConnection conn)

Definition at line 3440 of file rpc_transport.c.

3441 {
3443  TRACE("%p ref=%u\n", connection, ref);
3444  return connection;
3445 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
RpcConnection * connection
Definition: rpcrt4_main.c:93
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by RPCRT4_io_thread(), and RPCRT4_server_thread().

◆ RPCRT4_IsServerListening()

RPC_STATUS RPCRT4_IsServerListening ( const char protseq,
const char endpoint 
)

Definition at line 3490 of file rpc_transport.c.

3491 {
3492  const struct connection_ops *ops;
3493 
3494  ops = rpcrt4_get_conn_protseq_ops(protseq);
3495  if (!ops)
3496  {
3497  FIXME("not supported for protseq %s\n", protseq);
3498  return RPC_S_INVALID_BINDING;
3499  }
3500 
3501  return ops->is_server_listening(endpoint);
3502 }
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
RPC_STATUS(* is_server_listening)(const char *endpoint)
Definition: rpc_binding.h:110
Definition: nis.h:10

Referenced by RpcMgmtIsServerListening().

◆ RPCRT4_MakeBinding()

RPC_STATUS RPCRT4_MakeBinding ( RpcBinding **  Binding,
RpcConnection Connection 
)

Definition at line 232 of file rpc_binding.c.

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

Referenced by process_bind_packet_no_send(), and RpcServerInqBindings().

◆ RPCRT4_OpenBinding()

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

Definition at line 272 of file rpc_binding.c.

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

Referenced by I_RpcNegotiateTransferSyntax(), and I_RpcSend().

◆ RPCRT4_OpenClientConnection()

RPC_STATUS RPCRT4_OpenClientConnection ( RpcConnection Connection)

Definition at line 3340 of file rpc_transport.c.

3341 {
3342  TRACE("(Connection == ^%p)\n", Connection);
3343 
3344  assert(!Connection->server);
3345  return Connection->ops->open_connection_client(Connection);
3346 }
#define assert(x)
Definition: debug.h:53
const struct connection_ops * ops
Definition: rpc_binding.h:70
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by RpcAssoc_GetClientConnection().

◆ RPCRT4_PopThreadContextHandle()

NDR_SCONTEXT RPCRT4_PopThreadContextHandle ( void  )

Definition at line 1014 of file rpcrt4_main.c.

1015 {
1016  struct threaddata *tdata = get_or_create_threaddata();
1019 
1020  if (!tdata) return NULL;
1021 
1023  if (!context_handle_list) return NULL;
1025 
1028  return context_handle;
1029 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:930
NDR_SCONTEXT context_handle
Definition: rpcrt4_main.c:85
smooth NULL
Definition: ftsmooth.c:416
struct context_handle_list * next
Definition: rpcrt4_main.c:84
#define GetProcessHeap()
Definition: compat.h:403
static struct list context_handle_list
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:95
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by process_request_packet().

◆ RPCRT4_PushThreadContextHandle()

void RPCRT4_PushThreadContextHandle ( NDR_SCONTEXT  SContext)

Definition at line 978 of file rpcrt4_main.c.

979 {
980  struct threaddata *tdata = get_or_create_threaddata();
982 
983  if (!tdata) return;
984 
986  if (!context_handle_list) return;
987 
991 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:930
NDR_SCONTEXT context_handle
Definition: rpcrt4_main.c:85
struct context_handle_list * next
Definition: rpcrt4_main.c:84
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static struct list context_handle_list
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:95

Referenced by NDRSContextUnmarshall2().

◆ RPCRT4_ReleaseBinding()

RPC_STATUS RPCRT4_ReleaseBinding ( RpcBinding Binding)

Definition at line 254 of file rpc_binding.c.

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

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

◆ RPCRT4_ReleaseConnection()

void RPCRT4_ReleaseConnection ( RpcConnection Connection)

Definition at line 3447 of file rpc_transport.c.

3448 {
3449  LONG ref;
3450 
3451  /* protseq stores a list of active connections, but does not own references to them.
3452  * It may need to grab a connection from the list, which could lead to a race if
3453  * connection is being released, but not yet removed from the list. We handle that
3454  * by synchronizing on CS here. */
3455  if (connection->protseq)
3456  {
3457  EnterCriticalSection(&connection->protseq->cs);
3458  ref = InterlockedDecrement(&connection->ref);
3459  if (!ref)
3460  list_remove(&connection->protseq_entry);
3461  LeaveCriticalSection(&connection->protseq->cs);
3462  }
3463  else
3464  {
3465  ref = InterlockedDecrement(&connection->ref);
3466  }
3467 
3468  TRACE("%p ref=%u\n", connection, ref);
3469 
3470  if (!ref)
3471  {
3472  RPCRT4_CloseConnection(connection);
3473  RPCRT4_strfree(connection->Endpoint);
3474  RPCRT4_strfree(connection->NetworkAddr);
3475  HeapFree(GetProcessHeap(), 0, connection->NetworkOptions);
3476  HeapFree(GetProcessHeap(), 0, connection->CookieAuth);
3477  if (connection->AuthInfo) RpcAuthInfo_Release(connection->AuthInfo);
3478  if (connection->QOS) RpcQualityOfService_Release(connection->QOS);
3479 
3480  /* server-only */
3481  if (connection->server_binding) RPCRT4_ReleaseBinding(connection->server_binding);
3482  else if (connection->assoc) RpcAssoc_ConnectionReleased(connection->assoc);
3483 
3484  if (connection->wait_release) SetEvent(connection->wait_release);
3485 
3486  HeapFree(GetProcessHeap(), 0, connection);
3487  }
3488 }
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
Definition: rpc_assoc.c:447
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1184
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
Definition: send.c:47
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1361
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:254
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by I_RpcReceive(), I_RpcSend(), RpcAssoc_GetClientConnection(), RpcAssoc_Release(), RPCRT4_CloseBinding(), rpcrt4_conn_release_and_wait(), RPCRT4_io_thread(), RPCRT4_new_client(), rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(), and RPCRT4_worker_thread().

◆ RPCRT4_RemoveThreadContextHandle()

void RPCRT4_RemoveThreadContextHandle ( NDR_SCONTEXT  SContext)

Definition at line 993 of file rpcrt4_main.c.

994 {
995  struct threaddata *tdata = get_or_create_threaddata();
996  struct context_handle_list *current, *prev;
997 
998  if (!tdata) return;
999 
1000  for (current = tdata->context_handle_list, prev = NULL; current; prev = current, current = current->next)
1001  {
1002  if (current->context_handle == SContext)
1003  {
1004  if (prev)
1005  prev->next = current->next;
1006  else
1007  tdata->context_handle_list = current->next;
1009  return;
1010  }
1011  }
1012 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:930
smooth NULL
Definition: ftsmooth.c:416
struct context_handle_list * next
Definition: rpcrt4_main.c:84
#define GetProcessHeap()
Definition: compat.h:403
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:95
#define HeapFree(x, y, z)
Definition: compat.h:402
struct task_struct * current
Definition: linux.c:32

Referenced by NDRSContextMarshall2().

◆ RPCRT4_ResolveBinding()

RPC_STATUS RPCRT4_ResolveBinding ( RpcBinding Binding,
LPCSTR  Endpoint 
)

Definition at line 204 of file rpc_binding.c.

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

Referenced by get_epm_handle_client(), and RpcEpResolveBinding().

◆ RPCRT4_SetBindingObject()

RPC_STATUS RPCRT4_SetBindingObject ( RpcBinding Binding,
const UUID ObjectUuid 
)

Definition at line 224 of file rpc_binding.c.

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

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

◆ RPCRT4_SetThreadCurrentCallHandle()

void RPCRT4_SetThreadCurrentCallHandle ( RpcBinding Binding)

Definition at line 962 of file rpcrt4_main.c.

963 {
964  struct threaddata *tdata = get_or_create_threaddata();
965  if (!tdata) return;
966 
967  tdata->server_binding = Binding;
968 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:930
static IBinding Binding
Definition: htmldoc.c:1268
RpcBinding * server_binding
Definition: rpcrt4_main.c:94

Referenced by process_request_packet().

◆ RPCRT4_SetThreadCurrentConnection()

void RPCRT4_SetThreadCurrentConnection ( RpcConnection Connection)

Definition at line 952 of file rpcrt4_main.c.

953 {
954  struct threaddata *tdata = get_or_create_threaddata();
955  if (!tdata) return;
956 
957  EnterCriticalSection(&tdata->cs);
958  tdata->connection = Connection;
959  LeaveCriticalSection(&tdata->cs);
960 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:930
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RpcConnection * connection
Definition: rpcrt4_main.c:93
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: rpcrt4_main.c:91

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_SendWithAuth().

◆ RPCRT4_strdupAtoW()

LPWSTR RPCRT4_strdupAtoW ( LPCSTR  src)

Definition at line 69 of file rpc_binding.c.

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

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

◆ RPCRT4_strdupWtoA()

LPSTR RPCRT4_strdupWtoA ( LPCWSTR  src)

Definition at line 58 of file rpc_binding.c.

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

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

◆ RPCRT4_strfree()

void RPCRT4_strfree ( LPSTR  src)

◆ RPCRT4_strndupA()

LPSTR RPCRT4_strndupA ( LPCSTR  src,
INT  len 
)

Definition at line 45 of file rpc_binding.c.

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

Referenced by RpcBindingCopy().

◆ RPCRT4_strndupW()

LPWSTR RPCRT4_strndupW ( LPCWSTR  src,
INT  len 
)

Definition at line 91 of file rpc_binding.c.

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

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

◆ RpcTransport_GetTopOfTower()

RPC_STATUS RpcTransport_GetTopOfTower ( unsigned char tower_data,
size_t tower_size,
const char protseq,
const char networkaddr,
const char endpoint 
)

Definition at line 3504 of file rpc_transport.c.

3509 {
3510  twr_empty_floor_t *protocol_floor;
3511  const struct connection_ops *protseq_ops = rpcrt4_get_conn_protseq_ops(protseq);
3512 
3513  *tower_size = 0;
3514 
3515  if (!protseq_ops)
3517 
3518  if (!tower_data)
3519  {
3520  *tower_size = sizeof(*protocol_floor);
3521  *tower_size += protseq_ops->get_top_of_tower(NULL, networkaddr, endpoint);
3522  return RPC_S_OK;
3523  }
3524 
3525  protocol_floor = (twr_empty_floor_t *)tower_data;
3526  protocol_floor->count_lhs = sizeof(protocol_floor->protid);
3527  protocol_floor->protid = protseq_ops->epm_protocols[0];
3528  protocol_floor->count_rhs = 0;
3529 
3530  tower_data += sizeof(*protocol_floor);
3531 
3532  *tower_size = protseq_ops->get_top_of_tower(tower_data, networkaddr, endpoint);
3533  if (!*tower_size)
3534  return EPT_S_NOT_REGISTERED;
3535 
3536  *tower_size += sizeof(*protocol_floor);
3537 
3538  return RPC_S_OK;
3539 }
u_int16 count_rhs
Definition: epm_towers.h:85
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
smooth NULL
Definition: ftsmooth.c:416
u_int16 count_lhs
Definition: epm_towers.h:83
#define RPC_S_INVALID_RPC_PROTSEQ
Definition: winerror.h:1015
Definition: nis.h:10
#define EPT_S_NOT_REGISTERED
Definition: winerror.h:1061
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by TowerConstruct().

◆ RpcTransport_ParseTopOfTower()

RPC_STATUS RpcTransport_ParseTopOfTower ( const unsigned char tower_data,
size_t  tower_size,
char **  protseq,
char **  networkaddr,
char **  endpoint 
)

Definition at line 3541 of file rpc_transport.c.

3546 {
3547  const twr_empty_floor_t *protocol_floor;
3548  const twr_empty_floor_t *floor4;
3549  const struct connection_ops *protseq_ops = NULL;
3551  unsigned int i;
3552 
3553  if (tower_size < sizeof(*protocol_floor))
3554  return EPT_S_NOT_REGISTERED;
3555 
3556  protocol_floor = (const twr_empty_floor_t *)tower_data;
3557  tower_data += sizeof(*protocol_floor);
3558  tower_size -= sizeof(*protocol_floor);
3559  if ((protocol_floor->count_lhs != sizeof(protocol_floor->protid)) ||
3560  (protocol_floor->count_rhs > tower_size))
3561  return EPT_S_NOT_REGISTERED;
3562  tower_data += protocol_floor->count_rhs;
3563  tower_size -= protocol_floor->count_rhs;
3564 
3565  floor4 = (const twr_empty_floor_t *)tower_data;
3566  if ((tower_size < sizeof(*floor4)) ||
3567  (floor4->count_lhs != sizeof(floor4->protid)))
3568  return EPT_S_NOT_REGISTERED;
3569 
3570  for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3571  if ((protocol_floor->protid == conn_protseq_list[i].epm_protocols[0]) &&
3572  (floor4->protid == conn_protseq_list[i].epm_protocols[1]))
3573  {
3575  break;
3576  }
3577 
3578  if (!protseq_ops)
3579  return EPT_S_NOT_REGISTERED;
3580 
3581  status = protseq_ops->parse_top_of_tower(tower_data, tower_size, networkaddr, endpoint);
3582 
3583  if ((status == RPC_S_OK) && protseq)
3584  {
3585  *protseq = I_RpcAllocate(strlen(protseq_ops->name) + 1);
3586  strcpy(*protseq, protseq_ops->name);
3587  }
3588 
3589  return status;
3590 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
u_int16 count_rhs
Definition: epm_towers.h:85
const char * name
Definition: rpc_server.h:50
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
smooth NULL
Definition: ftsmooth.c:416
u_int16 count_lhs
Definition: epm_towers.h:83
static const struct connection_ops conn_protseq_list[]
Definition: nis.h:10
#define ARRAY_SIZE(a)
Definition: main.h:24
#define EPT_S_NOT_REGISTERED
Definition: winerror.h:1061
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static SERVICE_STATUS status
Definition: service.c:31
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:714
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by TowerExplode().