glue in send_to_kdc

This commit is contained in:
Love Hörnquist Åstrand
2011-11-21 20:20:13 -08:00
parent c4721dd1d0
commit 6af6e27c50

View File

@@ -38,25 +38,24 @@
static krb5_kdc_configuration *kdc_config; static krb5_kdc_configuration *kdc_config;
static krb5_context kdc_context; static krb5_context kdc_context;
#if 0
static struct sockaddr_storage sa; static struct sockaddr_storage sa;
static krb5_socklen_t salen = sizeof(sa);
static const char *astr = "0.0.0.0"; static const char *astr = "0.0.0.0";
static void static krb5_error_code
send_to_kdc(krb5_context context) send_to_kdc(krb5_context c, void *ptr, krb5_krbhst_info *hi, time_t timeout,
const krb5_data *in, krb5_data *out)
{ {
krb5_error_code ret; krb5_error_code ret;
ret = krb5_kdc_process_request(kdc_context, kdc_config, ret = krb5_kdc_process_request(kdc_context, kdc_config,
d.data, d.length, in->data, in->length,
&r, NULL, astr, out, NULL, astr,
(struct sockaddr *)&sa, 0); (struct sockaddr *)&sa, 0);
if (ret) if (ret)
krb5_err(context, 1, ret, "krb5_kdc_process_request"); krb5_err(c, 1, ret, "krb5_kdc_process_request");
return 0;
} }
#endif
/* /*
* *
@@ -177,26 +176,29 @@ main(int argc, char **argv)
if (argc == 0) if (argc == 0)
errx(1, "missing operations"); errx(1, "missing operations");
krb5_set_send_to_kdc_func(kdc_context, send_to_kdc, NULL);
void *buf; {
size_t size; void *buf;
heim_object_t o; size_t size;
heim_object_t o;
if (rk_undumpdata(argv[0], &buf, &size)) if (rk_undumpdata(argv[0], &buf, &size))
errx(1, "undumpdata: %s", argv[0]); errx(1, "undumpdata: %s", argv[0]);
o = heim_json_create_with_bytes(buf, size, NULL); o = heim_json_create_with_bytes(buf, size, NULL);
free(buf); free(buf);
if (o == NULL) if (o == NULL)
errx(1, "heim_json"); errx(1, "heim_json");
/* /*
* do the work here * do the work here
*/ */
eval_object(o); eval_object(o);
heim_release(o); heim_release(o);
}
krb5_free_context(kdc_context); krb5_free_context(kdc_context);
return 0; return 0;