RpcBindingSetAuthInfo  1N65X50

The RpcBindingSetAuthInfo function sets authentication and authorization information into a binding handle.

#include <rpc.h>

RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfo(

    RPC_BINDING_HANDLE  Binding,

 

    unsigned char *  ServerPrincName,

 

    unsigned long  AuthnLevel,

 

    unsigned long  AuthnSvc,

 

    RPC_AUTH_IDENTITY_HANDLE  AuthIdentity,

 

    unsigned long  AuthzSvc

 

   );

 

 

Parameters

Binding

Specifies the server binding handle into which authentication and authorization information is set.

ServerPrincName

Points to the expected principal name of the server referenced by the binding handle specified in the Binding argument. The content of the name and its syntax are defined by the authentication service in use.

AuthnLevel

Specifies the level of authentication to be performed on remote procedure calls made using the Binding binding handle.  For a list of the RPC-supported authentication levels, see Authentication-Level ConstantsVGIVU_.

AuthnSvc

Specifies the authentication service to use.  For a list of the RPC-supported authentication services, see Authentication-Service ConstantsAQ3ZA5.

Specify RPC_C_AUTHN_NONE to turn off authentication for remote procedure calls made using the Binding 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 Binding binding handle.

AuthIdentity

Specifies a handle for the data structure that contains the client s authentication and authorization credentials appropriate for the selected authentication and authorization service.

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.

AuthzSvc

Specifies the authorization service implemented by the server for the interface of interest. 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.

 For a list of the RPC-supported authentication services, see Authentication-Service ConstantsAQ3ZA5.

 

Remarks

A client application calls the RpcBindingSetAuthInfo routine to set up a server binding handle for making authenticated remote procedure calls.

Unless a client calls RpcBindingSetAuthInfo, all remote procedure calls on the Binding binding handle are unathenticated. A client is not required to call this routine.

 

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.

 

Return Values

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

 

See Also

RpcBindingInqAuthInfo, RpcServerRegisterAuthInfo