static int authenticate_agent()

in ad-joining/ksetpwd/ksetpwd.c [29:64]


static int authenticate_agent(
    /* [IN] */ krb5_context context,
    /* [IN] */ krb5_principal agent_principal,
    /* [IN, OPT] */ char *agent_principal_password,
    /* [OUT] */ krb5_creds *agent_creds)
{
    int result;
    krb5_get_init_creds_opt *opts;

    result = krb5_get_init_creds_opt_alloc(context, &opts);
    if (result)
    {
        com_err(NAME, result, "Initializing options failed");
        return 1;
    }

    krb5_get_init_creds_opt_set_tkt_life(opts, 5 * 60);
    krb5_get_init_creds_opt_set_renew_life(opts, 0);
    krb5_get_init_creds_opt_set_forwardable(opts, 0);
    krb5_get_init_creds_opt_set_proxiable(opts, 0);

    result = krb5_get_init_creds_password(
        context,
        agent_creds,
        agent_principal,
        agent_principal_password,
        krb5_prompter_posix,
        NULL,
        0,
        "kadmin/changepw",
        opts);

    krb5_get_init_creds_opt_free(context, opts);

    return result;
}