krb5_ccache ccache, const char *password, krb5_boolean secure,
const char *service)
{
- int ret;
krb5_creds creds;
krb5_principal server = NULL;
krb5_error_code ret;
memset(&creds, 0, sizeof(creds));
- ret = krb5_get_init_creds_password(context, &creds, principal, password,
- krb5_prompter_posix, NULL, 0, NULL, NULL);
+ ret = krb5_get_init_creds_password(context, &creds, principal,
+ (char *)password, krb5_prompter_posix,
+ NULL, 0, NULL, NULL);
if (ret)
return ret;
ret = krb5_cc_initialize(context, ccache, principal);
if (ret == 0)
ret = krb5_cc_store_cred(context, ccache, &creds);
- krb5_cc_close(context, ccache);
}
end:
- krb5_free_creds_contents(context, &creds);
+ krb5_free_cred_contents(context, &creds);
if (server)
- krb5_free_principal(context, service);
+ krb5_free_principal(context, server);
return ret;
}
#endif
problem = krb5_cc_gen_new(kcontext, &krb5_fcc_ops, &tmp_ccache);
#else
problem = krb5_fcc_generate_new(kcontext, &tmp_ccache);
+ /* krb5_fcc_generate_new() doesn't set KRB5_TC_OPENCLOSE, which makes
+ krb5_cc_initialize() fail */
+ krb5_fcc_set_flags(kcontext, tmp_ccache, KRB5_TC_OPENCLOSE);
#endif
if (problem) {
log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
problem = krb5_cc_initialize(kcontext, tmp_ccache, princ);
if (problem) {
log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "Cannot create krb5 ccache %s: krb5_cc_initialize() failed: %s",
+ "Cannot initialize krb5 ccache %s: krb5_cc_initialize() failed: %s",
ccname, krb5_get_err_text(kcontext, problem));
ret = HTTP_INTERNAL_SERVER_ERROR;
goto end;