/* * This function allows the caller to supply options to preauth * plugins. Preauth plugin modules are given a chance to look * at each option at the time this function is called in ordre * to check the validity of the option. * The 'opt' pointer supplied to this function must have been * obtained using krb5_get_init_creds_opt_alloc() */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_pa(krb5_context context, krb5_get_init_creds_opt *opt, const char *attr, const char *value) { krb5_error_code retval; krb5_gic_opt_ext *opte; retval = krb5int_gic_opt_to_opte(context, opt, &opte, 0, "krb5_get_init_creds_opt_set_pa"); if (retval) return retval; /* * Copy the option into the extended get_init_creds_opt structure */ retval = add_gic_opt_ext_preauth_data(context, opte, attr, value); if (retval) return retval; /* * Give the plugins a chance to look at the option now. */ retval = krb5_preauth_supply_preauth_data(context, opte, attr, value); return retval; }
krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_pa(krb5_context context, krb5_get_init_creds_opt *opt, const char *attr, const char *value) { struct extended_options *opte = (struct extended_options *)opt; krb5_gic_opt_pa_data *t, *pa; if (opt == NULL || !(opt->flags & GIC_OPT_EXTENDED)) return EINVAL; assert(!(opt->flags & GIC_OPT_SHALLOW_COPY)); /* Allocate space for another option. */ t = realloc(opte->preauth_data, (opte->num_preauth_data + 1) * sizeof(*t)); if (t == NULL) return ENOMEM; opte->preauth_data = t; /* Copy the option into the new slot. */ pa = &opte->preauth_data[opte->num_preauth_data]; pa->attr = strdup(attr); if (pa->attr == NULL) return ENOMEM; pa->value = strdup(value); if (pa->value == NULL) { free(pa->attr); return ENOMEM; } opte->num_preauth_data++; /* Give preauth modules a chance to look at the option now. */ return krb5_preauth_supply_preauth_data(context, opt, attr, value); }