ReactOS  0.4.13-dev-52-g0efcfec
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 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().

◆ 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_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().

◆ 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_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_CloseConnection()

RPC_STATUS RPCRT4_CloseConnection ( RpcConnection Connection)

Definition at line 3350 of file rpc_transport.c.

3351 {
3352  TRACE("(Connection == ^%p)\n", Connection);
3353  if (SecIsValidHandle(&Connection->ctx))
3354  {
3355  DeleteSecurityContext(&Connection->ctx);
3356  SecInvalidateHandle(&Connection->ctx);
3357  }
3358  rpcrt4_conn_close(Connection);
3359  return RPC_S_OK;
3360 }
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 3426 of file rpc_transport.c.

3427 {
3428  HANDLE event = NULL;
3429 
3430  if (connection->ref > 1)
3431  event = connection->wait_release = CreateEventW(NULL, TRUE, FALSE, NULL);
3432 
3433  RPCRT4_ReleaseConnection(connection);
3434 
3435  if(event)
3436  {
3438  CloseHandle(event);
3439  }
3440 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
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:597
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 3362 of file rpc_transport.c.

3365 {
3366  static LONG next_id;
3367  const struct connection_ops *ops;
3368  RpcConnection* NewConnection;
3369 
3370  ops = rpcrt4_get_conn_protseq_ops(Protseq);
3371  if (!ops)
3372  {
3373  FIXME("not supported for protseq %s\n", Protseq);
3375  }
3376 
3377  NewConnection = ops->alloc();
3378  NewConnection->ref = 1;
3379  NewConnection->server = server;
3380  NewConnection->ops = ops;
3381  NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
3382  NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
3383  NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
3384  NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth);
3385  NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
3386  NewConnection->NextCallId = 1;
3387 
3388  SecInvalidateHandle(&NewConnection->ctx);
3389  if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
3390  NewConnection->AuthInfo = AuthInfo;
3391  NewConnection->auth_context_id = InterlockedIncrement( &next_id );
3393  NewConnection->QOS = QOS;
3394 
3395  list_init(&NewConnection->conn_pool_entry);
3396  list_init(&NewConnection->protseq_entry);
3397 
3398  TRACE("connection: %p\n", NewConnection);
3399  *Connection = NewConnection;
3400 
3401  return RPC_S_OK;
3402 }
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:1180
#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:1357
__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 973 of file rpcrt4_main.c.

974 {
975  struct threaddata *tdata = get_or_create_threaddata();
976  if (!tdata) return NULL;
977 
978  return tdata->server_binding;
979 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:933
smooth NULL
Definition: ftsmooth.c:416
RpcBinding * server_binding
Definition: rpcrt4_main.c:97

Referenced by I_RpcGetCurrentCallHandle().

◆ RPCRT4_GrabConnection()

RpcConnection* RPCRT4_GrabConnection ( RpcConnection conn)

Definition at line 3442 of file rpc_transport.c.

3443 {
3445  TRACE("%p ref=%u\n", connection, ref);
3446  return connection;
3447 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
RpcConnection * connection
Definition: rpcrt4_main.c:96
#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 3492 of file rpc_transport.c.

3493 {
3494  const struct connection_ops *ops;
3495 
3496  ops = rpcrt4_get_conn_protseq_ops(protseq);
3497  if (!ops)
3498  {
3499  FIXME("not supported for protseq %s\n", protseq);
3500  return RPC_S_INVALID_BINDING;
3501  }
3502 
3503  return ops->is_server_listening(endpoint);
3504 }
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 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_OpenClientConnection()

RPC_STATUS RPCRT4_OpenClientConnection ( RpcConnection Connection)

Definition at line 3342 of file rpc_transport.c.

3343 {
3344  TRACE("(Connection == ^%p)\n", Connection);
3345 
3346  assert(!Connection->server);
3347  return Connection->ops->open_connection_client(Connection);
3348 }
#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 1017 of file rpcrt4_main.c.

1018 {
1019  struct threaddata *tdata = get_or_create_threaddata();
1022 
1023  if (!tdata) return NULL;
1024 
1026  if (!context_handle_list) return NULL;
1028 
1031  return context_handle;
1032 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:933
NDR_SCONTEXT context_handle
Definition: rpcrt4_main.c:88
smooth NULL
Definition: ftsmooth.c:416
struct context_handle_list * next
Definition: rpcrt4_main.c:87
#define GetProcessHeap()
Definition: compat.h:395
static struct list context_handle_list
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:98
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by process_request_packet().

◆ RPCRT4_PushThreadContextHandle()

void RPCRT4_PushThreadContextHandle ( NDR_SCONTEXT  SContext)

Definition at line 981 of file rpcrt4_main.c.

982 {
983  struct threaddata *tdata = get_or_create_threaddata();
985 
986  if (!tdata) return;
987 
989  if (!context_handle_list) return;
990 
994 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:933
NDR_SCONTEXT context_handle
Definition: rpcrt4_main.c:88
struct context_handle_list * next
Definition: rpcrt4_main.c:87
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static struct list context_handle_list
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:98

Referenced by NDRSContextUnmarshall2().

◆ 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_ReleaseConnection()

void RPCRT4_ReleaseConnection ( RpcConnection Connection)

Definition at line 3449 of file rpc_transport.c.

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

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 996 of file rpcrt4_main.c.

997 {
998  struct threaddata *tdata = get_or_create_threaddata();
999  struct context_handle_list *current, *prev;
1000 
1001  if (!tdata) return;
1002 
1003  for (current = tdata->context_handle_list, prev = NULL; current; prev = current, current = current->next)
1004  {
1005  if (current->context_handle == SContext)
1006  {
1007  if (prev)
1008  prev->next = current->next;
1009  else
1010  tdata->context_handle_list = current->next;
1012  return;
1013  }
1014  }
1015 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:933
smooth NULL
Definition: ftsmooth.c:416
struct context_handle_list * next
Definition: rpcrt4_main.c:87
#define GetProcessHeap()
Definition: compat.h:395
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:98
#define HeapFree(x, y, z)
Definition: compat.h:394
struct task_struct * current
Definition: linux.c:32

Referenced by NDRSContextMarshall2().

◆ 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_SetThreadCurrentCallHandle()

void RPCRT4_SetThreadCurrentCallHandle ( RpcBinding Binding)

Definition at line 965 of file rpcrt4_main.c.

966 {
967  struct threaddata *tdata = get_or_create_threaddata();
968  if (!tdata) return;
969 
970  tdata->server_binding = Binding;
971 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:933
static IBinding Binding
Definition: htmldoc.c:1268
RpcBinding * server_binding
Definition: rpcrt4_main.c:97

Referenced by process_request_packet().

◆ RPCRT4_SetThreadCurrentConnection()

void RPCRT4_SetThreadCurrentConnection ( RpcConnection Connection)

Definition at line 955 of file rpcrt4_main.c.

956 {
957  struct threaddata *tdata = get_or_create_threaddata();
958  if (!tdata) return;
959 
960  EnterCriticalSection(&tdata->cs);
961  tdata->connection = Connection;
962  LeaveCriticalSection(&tdata->cs);
963 }
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:933
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RpcConnection * connection
Definition: rpcrt4_main.c:96
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: rpcrt4_main.c:94

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_SendWithAuth().

◆ 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  len 
)

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_strndupW()

LPWSTR RPCRT4_strndupW ( LPCWSTR  src,
INT  len 
)

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().

◆ 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 3506 of file rpc_transport.c.

3511 {
3512  twr_empty_floor_t *protocol_floor;
3513  const struct connection_ops *protseq_ops = rpcrt4_get_conn_protseq_ops(protseq);
3514 
3515  *tower_size = 0;
3516 
3517  if (!protseq_ops)
3519 
3520  if (!tower_data)
3521  {
3522  *tower_size = sizeof(*protocol_floor);
3523  *tower_size += protseq_ops->get_top_of_tower(NULL, networkaddr, endpoint);
3524  return RPC_S_OK;
3525  }
3526 
3527  protocol_floor = (twr_empty_floor_t *)tower_data;
3528  protocol_floor->count_lhs = sizeof(protocol_floor->protid);
3529  protocol_floor->protid = protseq_ops->epm_protocols[0];
3530  protocol_floor->count_rhs = 0;
3531 
3532  tower_data += sizeof(*protocol_floor);
3533 
3534  *tower_size = protseq_ops->get_top_of_tower(tower_data, networkaddr, endpoint);
3535  if (!*tower_size)
3536  return EPT_S_NOT_REGISTERED;
3537 
3538  *tower_size += sizeof(*protocol_floor);
3539 
3540  return RPC_S_OK;
3541 }
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 3543 of file rpc_transport.c.

3548 {
3549  const twr_empty_floor_t *protocol_floor;
3550  const twr_empty_floor_t *floor4;
3551  const struct connection_ops *protseq_ops = NULL;
3553  unsigned int i;
3554 
3555  if (tower_size < sizeof(*protocol_floor))
3556  return EPT_S_NOT_REGISTERED;
3557 
3558  protocol_floor = (const twr_empty_floor_t *)tower_data;
3559  tower_data += sizeof(*protocol_floor);
3560  tower_size -= sizeof(*protocol_floor);
3561  if ((protocol_floor->count_lhs != sizeof(protocol_floor->protid)) ||
3562  (protocol_floor->count_rhs > tower_size))
3563  return EPT_S_NOT_REGISTERED;
3564  tower_data += protocol_floor->count_rhs;
3565  tower_size -= protocol_floor->count_rhs;
3566 
3567  floor4 = (const twr_empty_floor_t *)tower_data;
3568  if ((tower_size < sizeof(*floor4)) ||
3569  (floor4->count_lhs != sizeof(floor4->protid)))
3570  return EPT_S_NOT_REGISTERED;
3571 
3572  for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3573  if ((protocol_floor->protid == conn_protseq_list[i].epm_protocols[0]) &&
3574  (floor4->protid == conn_protseq_list[i].epm_protocols[1]))
3575  {
3577  break;
3578  }
3579 
3580  if (!protseq_ops)
3581  return EPT_S_NOT_REGISTERED;
3582 
3583  status = protseq_ops->parse_top_of_tower(tower_data, tower_size, networkaddr, endpoint);
3584 
3585  if ((status == RPC_S_OK) && protseq)
3586  {
3587  *protseq = I_RpcAllocate(strlen(protseq_ops->name) + 1);
3588  strcpy(*protseq, protseq_ops->name);
3589  }
3590 
3591  return status;
3592 }
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:717
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by TowerExplode().