Rob Shearman : rpcrt4: Allow the authentication details of the client to be transport-specific.
Alexandre Julliard
julliard at winehq.org
Mon Dec 14 09:51:19 CST 2009
Module: wine
Branch: master
Commit: 3dbf356f8f3326ce3d4f42b72cd1c28ec2320d6e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3dbf356f8f3326ce3d4f42b72cd1c28ec2320d6e
Author: Rob Shearman <robertshearman at gmail.com>
Date: Sun Dec 13 21:36:05 2009 +0000
rpcrt4: Allow the authentication details of the client to be transport-specific.
---
dlls/rpcrt4/rpc_binding.c | 22 ++++------------------
dlls/rpcrt4/rpc_binding.h | 8 ++++++++
dlls/rpcrt4/rpc_message.c | 35 +++++++++++++++++++++++++++++++++++
dlls/rpcrt4/rpc_message.h | 1 +
dlls/rpcrt4/rpc_transport.c | 4 ++++
5 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index 68ab461..8bfc493 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -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 (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);
+ if (!bind->FromConn) return RPC_S_INVALID_BINDING;
- return RPC_S_OK;
+ return rpcrt4_conn_inquire_auth_client(bind->FromConn, Privs,
+ ServerPrincName, AuthnLevel,
+ AuthnSvc, AuthzSvc, Flags);
}
/***********************************************************************
diff --git a/dlls/rpcrt4/rpc_binding.h b/dlls/rpcrt4/rpc_binding.h
index 908967c..e523ba6 100644
--- a/dlls/rpcrt4/rpc_binding.h
+++ b/dlls/rpcrt4/rpc_binding.h
@@ -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);
diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index 520f247..45a0398 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -1177,6 +1177,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)
*
* Transmit a packet over connection in acceptable fragments.
diff --git a/dlls/rpcrt4/rpc_message.h b/dlls/rpcrt4/rpc_message.h
index 2a441d6..2509527 100644
--- a/dlls/rpcrt4/rpc_message.h
+++ b/dlls/rpcrt4/rpc_message.h
@@ -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
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 6dbac41..00ada8e 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -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,
},
};
More information about the wine-cvs
mailing list