Remove building with NOCRYPTO option
[minix.git] / crypto / external / bsd / heimdal / dist / tests / plugin / windc.c
blob610eece8cb7b3d94cdbf924a280e3629664b9a48
1 /* $NetBSD: windc.c,v 1.1.1.2 2014/04/24 12:45:57 pettai Exp $ */
3 #include <krb5/krb5.h>
4 #include <krb5/hdb.h>
5 #include <krb5/kdc.h>
6 #include <windc_plugin.h>
8 static krb5_error_code
9 windc_init(krb5_context context, void **ctx)
11 krb5_warnx(context, "windc init");
12 *ctx = NULL;
13 return 0;
16 static void
17 windc_fini(void *ctx)
21 static krb5_error_code
22 pac_generate(void *ctx, krb5_context context,
23 struct hdb_entry_ex *client, krb5_pac *pac)
25 krb5_error_code ret;
26 krb5_data data;
28 krb5_warnx(context, "pac generate");
30 data.data = "\x00\x01";
31 data.length = 2;
33 ret = krb5_pac_init(context, pac);
34 if (ret)
35 return ret;
37 ret = krb5_pac_add_buffer(context, *pac, 1, &data);
38 if (ret)
39 return ret;
41 return 0;
44 static krb5_error_code
45 pac_verify(void *ctx, krb5_context context,
46 const krb5_principal new_ticket_client,
47 const krb5_principal delegation_proxy,
48 struct hdb_entry_ex * client,
49 struct hdb_entry_ex * server,
50 struct hdb_entry_ex * krbtgt,
51 krb5_pac *pac)
53 krb5_error_code ret;
54 krb5_data data;
56 krb5_warnx(context, "pac_verify");
58 ret = krb5_pac_get_buffer(context, *pac, 1, &data);
59 if (ret)
60 return ret;
62 krb5_data_free(&data);
64 return 0;
67 static krb5_error_code
68 client_access(void *ctx,
69 krb5_context context,
70 krb5_kdc_configuration *config,
71 hdb_entry_ex *client, const char *client_name,
72 hdb_entry_ex *server, const char *server_name,
73 KDC_REQ *req,
74 krb5_data *e_data)
76 krb5_warnx(context, "client_access");
77 return 0;
80 krb5plugin_windc_ftable windc = {
81 KRB5_WINDC_PLUGING_MINOR,
82 windc_init,
83 windc_fini,
84 pac_generate,
85 pac_verify,
86 client_access