rpcrt4: Allow the authentication details of the client to be transport-specific.
This commit is contained in:
parent
d918587f1d
commit
3dbf356f8f
|
@ -1614,25 +1614,11 @@ RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
|
|||
TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
|
||||
AuthnSvc, AuthzSvc, Flags);
|
||||
|
||||
if (!bind->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH;
|
||||
if (!bind->FromConn) return RPC_S_INVALID_BINDING;
|
||||
|
||||
if (Privs) *Privs = (RPC_AUTHZ_HANDLE)bind->AuthInfo->identity;
|
||||
if (ServerPrincName)
|
||||
{
|
||||
*ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name);
|
||||
if (!*ServerPrincName) return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
if (AuthnLevel) *AuthnLevel = bind->AuthInfo->AuthnLevel;
|
||||
if (AuthnSvc) *AuthnSvc = bind->AuthInfo->AuthnSvc;
|
||||
if (AuthzSvc)
|
||||
{
|
||||
FIXME("authorization service not implemented\n");
|
||||
*AuthzSvc = RPC_C_AUTHZ_NONE;
|
||||
}
|
||||
if (Flags)
|
||||
FIXME("flags 0x%x not implemented\n", Flags);
|
||||
|
||||
return RPC_S_OK;
|
||||
return rpcrt4_conn_inquire_auth_client(bind->FromConn, Privs,
|
||||
ServerPrincName, AuthnLevel,
|
||||
AuthnSvc, AuthzSvc, Flags);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -111,6 +111,7 @@ struct connection_ops {
|
|||
RPC_STATUS (*secure_packet)(RpcConnection *Connection, 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);
|
||||
RPC_STATUS (*impersonate_client)(RpcConnection *conn);
|
||||
RPC_STATUS (*revert_to_self)(RpcConnection *conn);
|
||||
RPC_STATUS (*inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG);
|
||||
};
|
||||
|
||||
/* don't know what MS's structure looks like */
|
||||
|
@ -230,6 +231,13 @@ static inline RPC_STATUS rpcrt4_conn_revert_to_self(
|
|||
return conn->ops->revert_to_self(conn);
|
||||
}
|
||||
|
||||
static inline 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)
|
||||
{
|
||||
return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags);
|
||||
}
|
||||
|
||||
/* floors 3 and up */
|
||||
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint);
|
||||
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint);
|
||||
|
|
|
@ -1176,6 +1176,41 @@ RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn)
|
|||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RPCRT4_default_inquire_auth_client (internal)
|
||||
*
|
||||
* Default function to retrieve the authentication details that the client
|
||||
* is using to call the server.
|
||||
*/
|
||||
RPC_STATUS RPCRT4_default_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)
|
||||
{
|
||||
if (!conn->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH;
|
||||
|
||||
if (privs)
|
||||
{
|
||||
FIXME("privs not implemented\n");
|
||||
*privs = NULL;
|
||||
}
|
||||
if (server_princ_name)
|
||||
{
|
||||
*server_princ_name = RPCRT4_strdupW(conn->AuthInfo->server_principal_name);
|
||||
if (!*server_princ_name) return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
if (authn_level) *authn_level = conn->AuthInfo->AuthnLevel;
|
||||
if (authn_svc) *authn_svc = conn->AuthInfo->AuthnSvc;
|
||||
if (authz_svc)
|
||||
{
|
||||
FIXME("authorization service not implemented\n");
|
||||
*authz_svc = RPC_C_AUTHZ_NONE;
|
||||
}
|
||||
if (flags)
|
||||
FIXME("flags 0x%x not implemented\n", flags);
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RPCRT4_Send (internal)
|
||||
*
|
||||
|
|
|
@ -55,5 +55,6 @@ BOOL RPCRT4_default_is_authorized(RpcConnection *Connection);
|
|||
RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection, 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);
|
||||
RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn);
|
||||
RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn);
|
||||
RPC_STATUS RPCRT4_default_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);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2753,6 +2753,7 @@ static const struct connection_ops conn_protseq_list[] = {
|
|||
RPCRT4_default_secure_packet,
|
||||
rpcrt4_conn_np_impersonate_client,
|
||||
rpcrt4_conn_np_revert_to_self,
|
||||
RPCRT4_default_inquire_auth_client,
|
||||
},
|
||||
{ "ncalrpc",
|
||||
{ EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE },
|
||||
|
@ -2772,6 +2773,7 @@ static const struct connection_ops conn_protseq_list[] = {
|
|||
rpcrt4_ncalrpc_secure_packet,
|
||||
rpcrt4_conn_np_impersonate_client,
|
||||
rpcrt4_conn_np_revert_to_self,
|
||||
RPCRT4_default_inquire_auth_client,
|
||||
},
|
||||
{ "ncacn_ip_tcp",
|
||||
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP },
|
||||
|
@ -2791,6 +2793,7 @@ static const struct connection_ops conn_protseq_list[] = {
|
|||
RPCRT4_default_secure_packet,
|
||||
RPCRT4_default_impersonate_client,
|
||||
RPCRT4_default_revert_to_self,
|
||||
RPCRT4_default_inquire_auth_client,
|
||||
},
|
||||
{ "ncacn_http",
|
||||
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP },
|
||||
|
@ -2810,6 +2813,7 @@ static const struct connection_ops conn_protseq_list[] = {
|
|||
RPCRT4_default_secure_packet,
|
||||
RPCRT4_default_impersonate_client,
|
||||
RPCRT4_default_revert_to_self,
|
||||
RPCRT4_default_inquire_auth_client,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue