krb5_rd_safe()--Process Kerberos KRB_SAFE Message
Syntax
#include <krb5.h>
krb5_error_code krb5_rd_safe(
krb5_context context,
krb5_auth_context auth_context,
krb5_const krb5_data * in_data,
krb5_data * out_data,
krb5_replay_data * replay_data);
Service Program Name: QSYS/QKRBGSS
Default Public Authority: *USE
Threadsafe: Conditional. See
Usage
notes.
The krb5_rd_safe() function processes a Kerberos KRB_SAFE
message and extracts the application data after verifying its integrity. If
timestamps are being used, the message is stored in the replay cache associated
with the authentication context.
Authorities
No authorities are required.
Parameters
- context (Input)
- The Kerberos context.
- auth_context (Input)
- The authentication context.
- in_data (Input)
- The buffer containing the KRB_SAFE message.
- out_data (Output)
- The application data. The krb5_free_data_contents()
routine should be called to release the storage pointed to by the data
field of the krb5_data structure when it is no longer needed.
- replay_data (Output)
- Replay information returned to the caller. This parameter is required if
the KRB5_AUTH_CONTEXT_RET_TIME (x'00000002') or
KRB5_AUTH_CONTEXT_RET_SEQUENCE (x'00000008') flag is set in
the authentication context. Otherwise, NULL may be specified
for this parameter.
Return Value
If no errors occur, the return value is 0. Otherwise, a Kerberos error code
is returned.
Error Messages
Message ID |
Error Message Text |
CPE3418 E |
Possible APAR condition or hardware failure. |
- The keyblock that is used for verifying message integrity is obtained from
the authentication context. The first non-NULL keyblock is used by checking the
local_subkey, remote_subkey, or keyblock, in that order.
- The remote address in the authentication context must be present. It
specifies the address of the sender. Use the
krb5_auth_con_genaddrs() routine or the
krb5_auth_con_setaddrs() routine to set the remote address. If
the port number was set in the authentication context used for the
krb5_mk_safe() routine, then the port number also must be set
in the authentication context used for the krb5_rd_safe()
routine. An error is returned if the address in the message does not match the
remote address in the authentication context.
- The local address in the authentication context is optional. If it is
present, then it must match the receiver address in the message. Otherwise, the
receiver message in the message must match one of the local addresses returned
by the krb5_os_localaddr() routine. If the port number was set
in the authentication context used for the krb5_mk_safe()
routine, then both the local address and the local port must be set in the
authentication context used for the krb5_rd_priv() routine.
Use the krb5_auth_con_genaddrs() routine or a combination of
the krb5_auth_con_setaddrs() and
krb5_auth_con_setports() routines to set the local address and
local port in the authentication context.
- Use the krb5_auth_con_setrcache() routine to set the
replay cache in the authentication context.
- If message sequence numbers are being used
(KRB5_AUTH_CONTEXT_DO_SEQUENCE (x'00000004') is set in the
authentication context), the remote sequence number in the authentication
context must match the sequence number in the message. Use the
krb5_auth_con_setflags() routine to set the
KRB5_AUTH_CONTEXT_DO_SEQUENCE flag.
- If timestamps are being used (KRB5_AUTH_CONTEXT_DO_TIME
(x'00000001') is set in the authentication context), the timestamp in the
message must be within the Kerberos clock skew for the current time. In
addition, the message must not be found in the replay cache obtained from the
authentication context. Use the krb5_auth_con_setflags()
routine to set the KRB5_AUTH_CONTEXT_DO_TIME flag.
- The Kerberos protocol runtime provides no concurrency control for the
authentication context. If the application wants to use the same authentication
context in multiple threads, it is the responsibility of the application to
serialize access to the authentication context so that only a single thread is
accessing the authentication context at any time. Because message sequence
numbers are contained in the authentication context, this serialization needs
to be extended to encompass the message exchange between the two applications.
Otherwise, message sequence errors are liable to occur if the messages are
delivered out of sequence.
API introduced: V5R1