mit_krb5_error_code KRB5_CALLCONV krb5_c_string_to_key(mit_krb5_context context, mit_krb5_enctype enctype, const mit_krb5_data *string, const mit_krb5_data *salt, mit_krb5_keyblock *key) { krb5_data hstring; krb5_error_code ret; krb5_salt hsalt; krb5_keyblock hkey; LOG_ENTRY(); mshim_mdata2hdata(string, &hstring); hsalt.salttype = (krb5_salttype)KRB5_PADATA_PW_SALT; mshim_mdata2hdata(salt, &hsalt.saltvalue); ret = heim_krb5_string_to_key_data_salt(HC(context), enctype, hstring, hsalt, &hkey); heim_krb5_data_free(&hstring); heim_krb5_data_free(&hsalt.saltvalue); if (ret) return ret; mshim_hkeyblock2mkeyblock(&hkey, key); heim_krb5_free_keyblock_contents(HC(context), &hkey); return 0; }
void mshim_hcred2mcred(krb5_context context, krb5_creds *h, mit_krb5_creds *m) { memset(m, 0, sizeof(*m)); m->magic = MIT_KV5M_CREDS; m->client = mshim_hprinc2mprinc(context, h->client); m->server = mshim_hprinc2mprinc(context, h->server); mshim_hkeyblock2mkeyblock(&h->session, &m->keyblock); mshim_hdata2mdata(&h->ticket, &m->ticket); m->times.authtime = h->times.authtime; m->times.starttime = h->times.starttime; m->times.endtime = h->times.endtime; m->times.renew_till = h->times.renew_till; m->ticket_flags = 0; if (h->flags.b.forwardable) m->ticket_flags |= MIT_TKT_FLG_FORWARDABLE; if (h->flags.b.forwarded) m->ticket_flags |= MIT_TKT_FLG_FORWARDED; if (h->flags.b.proxiable) m->ticket_flags |= MIT_TKT_FLG_PROXIABLE; if (h->flags.b.proxy) m->ticket_flags |= MIT_TKT_FLG_PROXY; if (h->flags.b.may_postdate) m->ticket_flags |= MIT_TKT_FLG_MAY_POSTDATE; if (h->flags.b.postdated) m->ticket_flags |= MIT_TKT_FLG_POSTDATED; if (h->flags.b.invalid) m->ticket_flags |= MIT_TKT_FLG_INVALID; if (h->flags.b.renewable) m->ticket_flags |= MIT_TKT_FLG_RENEWABLE; if (h->flags.b.initial) m->ticket_flags |= MIT_TKT_FLG_INITIAL; if (h->flags.b.pre_authent) m->ticket_flags |= MIT_TKT_FLG_PRE_AUTH; if (h->flags.b.hw_authent) m->ticket_flags |= MIT_TKT_FLG_HW_AUTH; if (h->flags.b.transited_policy_checked) m->ticket_flags |= MIT_TKT_FLG_TRANSIT_POLICY_CHECKED; if (h->flags.b.ok_as_delegate) m->ticket_flags |= MIT_TKT_FLG_OK_AS_DELEGATE; if (h->flags.b.anonymous) m->ticket_flags |= MIT_TKT_FLG_ANONYMOUS; }
void mshim_haprepencpart2maprepencpart(const krb5_ap_rep_enc_part *h, mit_krb5_ap_rep_enc_part *m) { m->magic = MIT_KV5M_AP_REP_ENC_PART; m->ctime = h->ctime; m->cusec = h->cusec; if (h->subkey) { m->subkey = mshim_malloc(sizeof(*m->subkey)); mshim_hkeyblock2mkeyblock(h->subkey, m->subkey); } else m->subkey = NULL; if (h->seq_number) { m->seq_number = *h->seq_number; } else m->seq_number = 0; }
mit_krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalsubkey(mit_krb5_context context, mit_krb5_auth_context ac, mit_krb5_keyblock **key) { LOG_ENTRY(); krb5_keyblock *hkey = NULL; krb5_error_code ret; *key = NULL; ret = heim_krb5_auth_con_getlocalsubkey(HC(context), (krb5_auth_context)ac, &hkey); if (ret) return ret; if (hkey) { *key = mshim_malloc(sizeof(**key)); mshim_hkeyblock2mkeyblock(hkey, *key); heim_krb5_free_keyblock(HC(context), hkey); } return 0; }
mit_krb5_error_code KRB5_CALLCONV krb5_kt_next_entry(mit_krb5_context context, mit_krb5_keytab keytab, mit_krb5_keytab_entry *entry, mit_krb5_kt_cursor *cursor) { krb5_error_code ret; krb5_keytab_entry e; LOG_ENTRY(); ret = heim_krb5_kt_next_entry(HC(context), (krb5_keytab)keytab, &e, (krb5_kt_cursor *)*cursor); if (ret) return ret; entry->magic = 0; entry->principal = mshim_hprinc2mprinc(HC(context), e.principal); entry->timestamp = e.timestamp; entry->vno = e.vno; mshim_hkeyblock2mkeyblock(&e.keyblock, &entry->key); heim_krb5_kt_free_entry(HC(context), &e); return 0; }