1 /* $NetBSD: windc.c,v 1.1.1.2 2014/04/24 12:45:57 pettai Exp $ */ 2 3 #include <krb5/krb5.h> 4 #include <krb5/hdb.h> 5 #include <krb5/kdc.h> 6 #include <windc_plugin.h> 7 8 static krb5_error_code 9 windc_init(krb5_context context, void **ctx) 10 { 11 krb5_warnx(context, "windc init"); 12 *ctx = NULL; 13 return 0; 14 } 15 16 static void 17 windc_fini(void *ctx) 18 { 19 } 20 21 static krb5_error_code 22 pac_generate(void *ctx, krb5_context context, 23 struct hdb_entry_ex *client, krb5_pac *pac) 24 { 25 krb5_error_code ret; 26 krb5_data data; 27 28 krb5_warnx(context, "pac generate"); 29 30 data.data = "\x00\x01"; 31 data.length = 2; 32 33 ret = krb5_pac_init(context, pac); 34 if (ret) 35 return ret; 36 37 ret = krb5_pac_add_buffer(context, *pac, 1, &data); 38 if (ret) 39 return ret; 40 41 return 0; 42 } 43 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) 52 { 53 krb5_error_code ret; 54 krb5_data data; 55 56 krb5_warnx(context, "pac_verify"); 57 58 ret = krb5_pac_get_buffer(context, *pac, 1, &data); 59 if (ret) 60 return ret; 61 62 krb5_data_free(&data); 63 64 return 0; 65 } 66 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) 75 { 76 krb5_warnx(context, "client_access"); 77 return 0; 78 } 79 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 87 }; 88