The RpcBindingSetAuthInfo function sets authentication and authorization information into a binding handle.
#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfo(
RPC_BINDING_HANDLE hBinding,
unsigned char * ServerPrincName,
unsigned long AuthnLevel,
unsigned long AuthnService,
RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
unsigned long AuthzService
);
Under MSMQ security this can be RPC_C_AUTHN_LEVEL_NONE, RPC_C_AUTHN_LEVEL_PKT_INTEGRITY, or RPC_C_AUTHN_LEVEL_PKT_PRIVACY. If you specify any other level it will be converted silently to the next higher supported level.
Specify RPC_C_AUTHN_NONE to turn off authentication for remote procedure calls made using the hBinding binding handle.
If RPC_C_AUTHN_DEFAULT is specified, the RPC run-time library uses the RPC_C_AUTHN_WINNT authentication service for remote procedure calls made using the hBinding binding handle.
The only authentication services allowed for MSMQ security are RPC_C_AUTHN_NONE and RPC_C_AUTHN_MQ. If you use RPC_C_AUTHN_WINNT or one of the other security providers your message calls will not be authenticated or encrypted.
When using the RPC_C_AUTHN_WINNT authentication service AuthIdentity should be a pointer to a SEC_WINNT_AUTH_IDENTITY structure (defined in rpcdce.h).
Specify a null value to use the security login context for the current address space.
The validity and trustworthiness of authorization data, like any application data, depends on the authentication service and authentication level selected. This parameter is ignored when using the RPC_C_AUTHN_WINNT authentication service.
Value | Meaning |
---|---|
RPC_S_OK | Success. |
RPC_S_INVALID_BINDING | Invalid binding handle. |
RPC_S_WRONG_KIND_OF_BINDING | Wrong kind of binding for operation. |
RPC_S_UNKNOWN_AUTHN_SERVICE | Unknown authentication service. |
A client application calls the RpcBindingSetAuthInfo routine to set up a server binding handle for making authenticated remote procedure calls. A client is not required to call this routine.
Unless a client calls RpcBindingSetAuthInfo, no remote procedure calls on the hBinding binding handle are athenticated. A server can call RpcBindingInqAuthClient from within a remote procedure call to determine if that call has been authenticated.
Note As long as the binding handle exists, RPC maintains a pointer to AuthIdentity. Be sure it is not on the stack and is not freed until the binding handle is freed. If the binding handle is copied, or if a context handle is created from the binding handle, then the AuthIdentity pointer will also be copied.
Windows NT: Yes
Windows CE: Unsupported.
Header: Declared in rpcdce.h.
Import Library: Link with rpcrt4.lib.
RpcBindingSetOption, RpcBindingInqAuthInfo, RpcServerRegisterAuthInfo