Lines Matching refs:ctx
26 k5_kt_open(krb5_context ctx, krb5_keytab *kt)
34 if ((code = krb5_kt_default_name(ctx, buf, sizeof (buf))) != 0)
48 return (krb5_kt_resolve(ctx, ktstr, kt));
52 k5_kt_add_entry(krb5_context ctx, krb5_keytab kt, const krb5_principal princ,
67 if ((code = krb5_principal2salt(ctx, svc_princ, &salt)) != 0) {
71 if ((krb5_c_string_to_key(ctx, enctype, &password, &salt, &key)) != 0)
78 code = krb5_kt_add_entry(ctx, kt, &entry);
83 krb5_free_keyblock_contents(ctx, &key);
89 * krb5_error_code k5_kt_add_ad_entries(krb5_context ctx, char **sprincs_str,
95 * where ctx is the pointer passed back from krb5_init_context
144 k5_kt_add_ad_entries(krb5_context ctx, char **sprincs_str, char *domain,
156 assert(ctx != NULL && sprincs_str != NULL && *sprincs_str != NULL);
159 if ((code = krb5_parse_name(ctx, *sprincs_str, &f_princ)) != 0)
161 if (krb5_princ_realm(ctx, f_princ)->length == 0) {
165 realm = krb5_princ_realm(ctx, f_princ)->data;
200 if ((code = krb5_parse_name(ctx, t_host, &salt)) != 0)
203 if ((code = k5_kt_open(ctx, &kt)) != 0)
206 code = krb5_get_permitted_enctypes(ctx, &enctypes);
212 if ((code = krb5_parse_name(ctx, *tprinc, &princ)) != 0)
223 code = krb5_c_enctype_compare(ctx, *tenctype,
231 code = k5_kt_add_entry(ctx, kt, princ, salt, *tenctype,
239 krb5_free_principal(ctx, princ);
247 krb5_free_principal(ctx, f_princ);
249 krb5_free_principal(ctx, salt);
253 (void) krb5_kt_close(ctx, kt);
255 krb5_free_enctypes(ctx, enctypes);
257 krb5_free_principal(ctx, princ);
266 k5_kt_remove_by_key(krb5_context ctx, char *key, uint_t type)
276 assert(ctx != NULL && key != NULL);
279 krb5_princ_realm(ctx, &realm_data)->length = strlen(key);
280 krb5_princ_realm(ctx, &realm_data)->data = key;
282 if ((code = krb5_parse_name(ctx, key, &svc_princ)) != 0)
287 if ((code = k5_kt_open(ctx, &kt)) != 0)
290 if ((code = krb5_kt_start_seq_get(ctx, kt, &cursor)) != 0)
293 while ((code = krb5_kt_next_entry(ctx, kt, &entry, &cursor)) == 0) {
294 if (type == PRINCIPAL && krb5_principal_compare(ctx, svc_princ,
297 } else if (type == REALM && krb5_realm_compare(ctx, &realm_data,
303 code = krb5_kt_end_seq_get(ctx, kt, &cursor);
305 krb5_kt_free_entry(ctx, &entry);
309 code = krb5_kt_remove_entry(ctx, kt, &entry);
311 krb5_kt_free_entry(ctx, &entry);
315 code = krb5_kt_start_seq_get(ctx, kt, &cursor);
317 krb5_kt_free_entry(ctx, &entry);
324 krb5_kt_free_entry(ctx, &entry);
330 code = krb5_kt_end_seq_get(ctx, kt, &cursor);
335 krb5_free_principal(ctx, svc_princ);
337 (void) krb5_kt_close(ctx, kt);
343 * krb5_error_code k5_kt_remove_by_realm(krb5_context ctx, char *realm)
348 * where ctx is the pointer passed back from krb5_init_context
355 k5_kt_remove_by_realm(krb5_context ctx, char *realm)
358 return (k5_kt_remove_by_key(ctx, realm, REALM));
362 * krb5_error_code k5_kt_remove_by_svcprinc(krb5_context ctx, char *sprinc_str)
367 * where ctx is the pointer passed back from krb5_init_context
375 k5_kt_remove_by_svcprinc(krb5_context ctx, char *sprinc_str)
378 return (k5_kt_remove_by_key(ctx, sprinc_str, PRINCIPAL));
382 * krb5_error_code k5_kt_validate(krb5_context ctx, char *sprinc_str,
388 * where ctx is the pointer passed back from krb5_init_context
410 k5_kt_ad_validate(krb5_context ctx, char *sprinc_str, uint_t flags,
423 assert(ctx != NULL && sprinc_str != NULL && valid != NULL);
428 if ((code = krb5_parse_name(ctx, sprinc_str, &svc_princ)) != 0)
431 if ((code = k5_kt_open(ctx, &kt)) != 0)
434 code = krb5_get_permitted_enctypes(ctx, &enctypes);
438 if ((code = krb5_kt_start_seq_get(ctx, kt, &cursor)) != 0)
441 while ((code = krb5_kt_next_entry(ctx, kt, &entry, &cursor)) == 0) {
442 if (krb5_principal_compare(ctx, svc_princ, entry.principal)) {
446 code = krb5_c_enctype_compare(ctx,
449 krb5_kt_free_entry(ctx, &entry);
469 krb5_kt_free_entry(ctx, &entry);
475 if ((code = krb5_kt_end_seq_get(ctx, kt, &cursor)))
489 krb5_free_principal(ctx, svc_princ);
491 (void) krb5_kt_close(ctx, kt);
493 krb5_free_enctypes(ctx, enctypes);