# Heimdal Kerberos 5 authentication functions

## Functions

krb5_error_code KRB5_LIB_FUNCTION | krb5_rd_req_in_ctx_alloc (krb5_context context, krb5_rd_req_in_ctx *ctx)
krb5_error_code KRB5_LIB_FUNCTION | krb5_rd_req_in_set_keytab (krb5_context context, krb5_rd_req_in_ctx in, krb5_keytab keytab)
krb5_error_code KRB5_LIB_FUNCTION | krb5_rd_req_in_set_pac_check (krb5_context context, krb5_rd_req_in_ctx in, krb5_boolean flag)
krb5_error_code KRB5_LIB_FUNCTION | krb5_rd_req_out_get_server (krb5_context context, krb5_rd_req_out_ctx out, krb5_principal *principal)
void KRB5_LIB_FUNCTION | krb5_rd_req_out_ctx_free (krb5_context context, krb5_rd_req_out_ctx ctx)
krb5_error_code KRB5_LIB_FUNCTION | krb5_rd_req_ctx (krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, krb5_const_principal server, krb5_rd_req_in_ctx inctx, krb5_rd_req_out_ctx *outctx)

## Detailed Description

## Function Documentation

krb5_error_code KRB5_LIB_FUNCTION krb5_rd_req_ctx | ( | krb5_context | context,
|  | krb5_auth_context * | auth_context,
|  | const krb5_data * | inbuf,
|  | krb5_const_principal | server,
|  | krb5_rd_req_in_ctx | inctx,
|  | krb5_rd_req_out_ctx * | outctx |
| ) |  |  |

The core server function that verify application authentication requests from clients.

Parameters:

  | context | Keberos 5 context.
  | auth_context | the authentication context, can be NULL, then default values for the authentication context will used.
  | inbuf | the (AP-REQ) authentication buffer
  | server | the server with authenticate as, if NULL the function will try to find any avaiable credentintial in the keytab that will verify the reply. The function will prefer the server the server client specified in the AP-REQ, but if there is no mach, it will try all keytab entries for a match. This have serious performance issues for larger keytabs.
  | inctx | control the behavior of the function, if NULL, the default behavior is used.
  | outctx | the return outctx, free with krb5_rd_req_out_ctx_free().

Returns:
  Kerberos 5 error code, see krb5_get_error_message().

krb5_error_code KRB5_LIB_FUNCTION krb5_rd_req_in_ctx_alloc | ( | krb5_context | context,
|  | krb5_rd_req_in_ctx * | ctx |
| ) |  |  |

Allocate a krb5_rd_req_in_ctx as an input parameter to krb5_rd_req_ctx(). The caller should free the context with krb5_rd_req_in_ctx_free() when done with the context.

Parameters:

  | context | Keberos 5 context.
  | ctx | in ctx to krb5_rd_req_ctx().

Returns:
  Kerberos 5 error code, see krb5_get_error_message().

krb5_error_code KRB5_LIB_FUNCTION krb5_rd_req_in_set_keytab | ( | krb5_context | context,
|  | krb5_rd_req_in_ctx | in,
|  | krb5_keytab | keytab |
| ) |  |  |

Set the keytab that krb5_rd_req_ctx() will use.

Parameters:

  | context | Keberos 5 context.
  | in | in ctx to krb5_rd_req_ctx().
  | keytab | keytab that krb5_rd_req_ctx() will use, only copy the pointer, so the caller must free they keytab after krb5_rd_req_in_ctx_free() is called.

Returns:
  Kerberos 5 error code, see krb5_get_error_message().

krb5_error_code KRB5_LIB_FUNCTION krb5_rd_req_in_set_pac_check | ( | krb5_context | context,
|  | krb5_rd_req_in_ctx | in,
|  | krb5_boolean | flag |
| ) |  |  |

Set if krb5_rq_red() is going to check the Windows PAC or not

Parameters:

  | context | Keberos 5 context.
  | in | krb5_rd_req_in_ctx to check the option on.
  | flag | flag to select if to check the pac (TRUE) or not (FALSE).

Returns:
  Kerberos 5 error code, see krb5_get_error_message().

void KRB5_LIB_FUNCTION krb5_rd_req_out_ctx_free | ( | krb5_context | context,
|  | krb5_rd_req_out_ctx | ctx |
| ) |  |  |

Free the krb5_rd_req_out_ctx.

Parameters:

  | context | Keberos 5 context.
  | ctx | krb5_rd_req_out_ctx context to free.

krb5_error_code KRB5_LIB_FUNCTION krb5_rd_req_out_get_server | ( | krb5_context | context,
|  | krb5_rd_req_out_ctx | out,
|  | krb5_principal * | principal |
| ) |  |  |

Get the principal that was used in the request from the client. Might not match whats in the ticket if krb5_rd_req_ctx() searched in the keytab for a matching key.

Parameters:

  | context | a Kerberos 5 context.
  | out | a krb5_rd_req_out_ctx from krb5_rd_req_ctx().
  | principal | return principal, free with krb5_free_principal().