1/*	$NetBSD: hdb-protos.h,v 1.2 2019/12/15 22:50:49 christos Exp $	*/
2
3/* This is a generated file */
4#ifndef __hdb_protos_h__
5#define __hdb_protos_h__
6#ifndef DOXY
7
8#include <stdarg.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14krb5_error_code
15entry2mit_string_int (
16	krb5_context /*context*/,
17	krb5_storage */*sp*/,
18	hdb_entry */*ent*/);
19
20/**
21 * This function adds an HDB entry's current keyset to the entry's key
22 * history.  The current keyset is left alone; the caller is responsible
23 * for freeing it.
24 *
25 * @param context   Context
26 * @param entry	    HDB entry
27 */
28
29krb5_error_code
30hdb_add_current_keys_to_history (
31	krb5_context /*context*/,
32	hdb_entry */*entry*/);
33
34/**
35 * This function adds a key to an HDB entry's key history.
36 *
37 * @param context   Context
38 * @param entry	    HDB entry
39 * @param kvno	    Key version number of the key to add to the history
40 * @param key	    The Key to add
41 */
42
43krb5_error_code
44hdb_add_history_key (
45	krb5_context /*context*/,
46	hdb_entry */*entry*/,
47	krb5_kvno /*kvno*/,
48	Key */*key*/);
49
50krb5_error_code
51hdb_add_master_key (
52	krb5_context /*context*/,
53	krb5_keyblock */*key*/,
54	hdb_master_key */*inout*/);
55
56/**
57 * This function changes an hdb_entry's kvno, swapping the current key
58 * set with a historical keyset.  If no historical keys are found then
59 * an error is returned (the caller can still set entry->kvno directly).
60 *
61 * @param context	krb5_context
62 * @param new_kvno	New kvno for the entry
63 * @param entry		hdb_entry to modify
64 */
65
66krb5_error_code
67hdb_change_kvno (
68	krb5_context /*context*/,
69	krb5_kvno /*new_kvno*/,
70	hdb_entry */*entry*/);
71
72krb5_error_code
73hdb_check_db_format (
74	krb5_context /*context*/,
75	HDB */*db*/);
76
77krb5_error_code
78hdb_clear_extension (
79	krb5_context /*context*/,
80	hdb_entry */*entry*/,
81	int /*type*/);
82
83krb5_error_code
84hdb_clear_master_key (
85	krb5_context /*context*/,
86	HDB */*db*/);
87
88/**
89 * Create a handle for a Kerberos database
90 *
91 * Create a handle for a Kerberos database backend specified by a
92 * filename.  Doesn't create a file if its doesn't exists, you have to
93 * use O_CREAT to tell the backend to create the file.
94 */
95
96krb5_error_code
97hdb_create (
98	krb5_context /*context*/,
99	HDB **/*db*/,
100	const char */*filename*/);
101
102krb5_error_code
103hdb_db1_create (
104	krb5_context /*context*/,
105	HDB **/*db*/,
106	const char */*filename*/);
107
108krb5_error_code
109hdb_db3_create (
110	krb5_context /*context*/,
111	HDB **/*db*/,
112	const char */*filename*/);
113
114/**
115 * Return the directory where the hdb database resides.
116 *
117 * @param context Kerberos 5 context.
118 *
119 * @return string pointing to directory.
120 */
121
122const char *
123hdb_db_dir (krb5_context /*context*/);
124
125const char *
126hdb_dbinfo_get_acl_file (
127	krb5_context /*context*/,
128	struct hdb_dbinfo */*dbp*/);
129
130const krb5_config_binding *
131hdb_dbinfo_get_binding (
132	krb5_context /*context*/,
133	struct hdb_dbinfo */*dbp*/);
134
135const char *
136hdb_dbinfo_get_dbname (
137	krb5_context /*context*/,
138	struct hdb_dbinfo */*dbp*/);
139
140const char *
141hdb_dbinfo_get_label (
142	krb5_context /*context*/,
143	struct hdb_dbinfo */*dbp*/);
144
145const char *
146hdb_dbinfo_get_log_file (
147	krb5_context /*context*/,
148	struct hdb_dbinfo */*dbp*/);
149
150const char *
151hdb_dbinfo_get_mkey_file (
152	krb5_context /*context*/,
153	struct hdb_dbinfo */*dbp*/);
154
155struct hdb_dbinfo *
156hdb_dbinfo_get_next (
157	struct hdb_dbinfo */*dbp*/,
158	struct hdb_dbinfo */*dbprevp*/);
159
160const char *
161hdb_dbinfo_get_realm (
162	krb5_context /*context*/,
163	struct hdb_dbinfo */*dbp*/);
164
165/**
166 * Return the default hdb database resides.
167 *
168 * @param context Kerberos 5 context.
169 *
170 * @return string pointing to directory.
171 */
172
173const char *
174hdb_default_db (krb5_context /*context*/);
175
176krb5_error_code
177hdb_enctype2key (
178	krb5_context /*context*/,
179	hdb_entry */*e*/,
180	const Keys */*keyset*/,
181	krb5_enctype /*enctype*/,
182	Key **/*key*/);
183
184krb5_error_code
185hdb_entry2string (
186	krb5_context /*context*/,
187	hdb_entry */*ent*/,
188	char **/*str*/);
189
190int
191hdb_entry2value (
192	krb5_context /*context*/,
193	const hdb_entry */*ent*/,
194	krb5_data */*value*/);
195
196int
197hdb_entry_alias2value (
198	krb5_context /*context*/,
199	const hdb_entry_alias */*alias*/,
200	krb5_data */*value*/);
201
202krb5_error_code
203hdb_entry_check_mandatory (
204	krb5_context /*context*/,
205	const hdb_entry */*ent*/);
206
207krb5_error_code
208hdb_entry_clear_kvno_diff_clnt (
209	krb5_context /*context*/,
210	hdb_entry */*entry*/);
211
212krb5_error_code
213hdb_entry_clear_kvno_diff_svc (
214	krb5_context /*context*/,
215	hdb_entry */*entry*/);
216
217int
218hdb_entry_clear_password (
219	krb5_context /*context*/,
220	hdb_entry */*entry*/);
221
222krb5_error_code
223hdb_entry_get_ConstrainedDelegACL (
224	const hdb_entry */*entry*/,
225	const HDB_Ext_Constrained_delegation_acl **/*a*/);
226
227krb5_error_code
228hdb_entry_get_aliases (
229	const hdb_entry */*entry*/,
230	const HDB_Ext_Aliases **/*a*/);
231
232unsigned int
233hdb_entry_get_kvno_diff_clnt (const hdb_entry */*entry*/);
234
235unsigned int
236hdb_entry_get_kvno_diff_svc (const hdb_entry */*entry*/);
237
238int
239hdb_entry_get_password (
240	krb5_context /*context*/,
241	HDB */*db*/,
242	const hdb_entry */*entry*/,
243	char **/*p*/);
244
245krb5_error_code
246hdb_entry_get_pkinit_acl (
247	const hdb_entry */*entry*/,
248	const HDB_Ext_PKINIT_acl **/*a*/);
249
250krb5_error_code
251hdb_entry_get_pkinit_cert (
252	const hdb_entry */*entry*/,
253	const HDB_Ext_PKINIT_cert **/*a*/);
254
255krb5_error_code
256hdb_entry_get_pkinit_hash (
257	const hdb_entry */*entry*/,
258	const HDB_Ext_PKINIT_hash **/*a*/);
259
260krb5_error_code
261hdb_entry_get_pw_change_time (
262	const hdb_entry */*entry*/,
263	time_t */*t*/);
264
265krb5_error_code
266hdb_entry_set_kvno_diff_clnt (
267	krb5_context /*context*/,
268	hdb_entry */*entry*/,
269	unsigned int /*diff*/);
270
271krb5_error_code
272hdb_entry_set_kvno_diff_svc (
273	krb5_context /*context*/,
274	hdb_entry */*entry*/,
275	unsigned int /*diff*/);
276
277int
278hdb_entry_set_password (
279	krb5_context /*context*/,
280	HDB */*db*/,
281	hdb_entry */*entry*/,
282	const char */*p*/);
283
284krb5_error_code
285hdb_entry_set_pw_change_time (
286	krb5_context /*context*/,
287	hdb_entry */*entry*/,
288	time_t /*t*/);
289
290HDB_extension *
291hdb_find_extension (
292	const hdb_entry */*entry*/,
293	int /*type*/);
294
295krb5_error_code
296hdb_foreach (
297	krb5_context /*context*/,
298	HDB */*db*/,
299	unsigned /*flags*/,
300	hdb_foreach_func_t /*func*/,
301	void */*data*/);
302
303void
304hdb_free_dbinfo (
305	krb5_context /*context*/,
306	struct hdb_dbinfo **/*dbp*/);
307
308void
309hdb_free_entry (
310	krb5_context /*context*/,
311	hdb_entry_ex */*ent*/);
312
313void
314hdb_free_key (Key */*key*/);
315
316void
317hdb_free_keys (
318	krb5_context /*context*/,
319	int /*len*/,
320	Key */*keys*/);
321
322void
323hdb_free_master_key (
324	krb5_context /*context*/,
325	hdb_master_key /*mkey*/);
326
327krb5_error_code
328hdb_generate_key_set (
329	krb5_context /*context*/,
330	krb5_principal /*principal*/,
331	krb5_key_salt_tuple */*ks_tuple*/,
332	int /*n_ks_tuple*/,
333	Key **/*ret_key_set*/,
334	size_t */*nkeyset*/,
335	int /*no_salt*/);
336
337krb5_error_code
338hdb_generate_key_set_password (
339	krb5_context /*context*/,
340	krb5_principal /*principal*/,
341	const char */*password*/,
342	Key **/*keys*/,
343	size_t */*num_keys*/);
344
345krb5_error_code
346hdb_generate_key_set_password_with_ks_tuple (
347	krb5_context /*context*/,
348	krb5_principal /*principal*/,
349	const char */*password*/,
350	krb5_key_salt_tuple */*ks_tuple*/,
351	int /*n_ks_tuple*/,
352	Key **/*keys*/,
353	size_t */*num_keys*/);
354
355int
356hdb_get_dbinfo (
357	krb5_context /*context*/,
358	struct hdb_dbinfo **/*dbp*/);
359
360krb5_error_code
361hdb_init_db (
362	krb5_context /*context*/,
363	HDB */*db*/);
364
365int
366hdb_key2principal (
367	krb5_context /*context*/,
368	krb5_data */*key*/,
369	krb5_principal /*p*/);
370
371krb5_error_code
372hdb_keytab_create (
373	krb5_context /*context*/,
374	HDB ** /*db*/,
375	const char */*arg*/);
376
377const Keys *
378hdb_kvno2keys (
379	krb5_context /*context*/,
380	const hdb_entry */*e*/,
381	krb5_kvno /*kvno*/);
382
383krb5_error_code
384hdb_ldap_create (
385	krb5_context /*context*/,
386	HDB ** /*db*/,
387	const char */*arg*/);
388
389krb5_error_code
390hdb_ldapi_create (
391	krb5_context /*context*/,
392	HDB ** /*db*/,
393	const char */*arg*/);
394
395krb5_error_code
396hdb_list_builtin (
397	krb5_context /*context*/,
398	char **/*list*/);
399
400krb5_error_code
401hdb_lock (
402	int /*fd*/,
403	int /*operation*/);
404
405krb5_error_code
406hdb_mdb_create (
407	krb5_context /*context*/,
408	HDB **/*db*/,
409	const char */*filename*/);
410
411krb5_error_code
412hdb_mitdb_create (
413	krb5_context /*context*/,
414	HDB **/*db*/,
415	const char */*filename*/);
416
417krb5_error_code
418hdb_ndbm_create (
419	krb5_context /*context*/,
420	HDB **/*db*/,
421	const char */*filename*/);
422
423krb5_error_code
424hdb_next_enctype2key (
425	krb5_context /*context*/,
426	const hdb_entry */*e*/,
427	const Keys */*keyset*/,
428	krb5_enctype /*enctype*/,
429	Key **/*key*/);
430
431int
432hdb_principal2key (
433	krb5_context /*context*/,
434	krb5_const_principal /*p*/,
435	krb5_data */*key*/);
436
437krb5_error_code
438hdb_print_entry (
439	krb5_context /*context*/,
440	HDB */*db*/,
441	hdb_entry_ex */*entry*/,
442	void */*data*/);
443
444krb5_error_code
445hdb_process_master_key (
446	krb5_context /*context*/,
447	int /*kvno*/,
448	krb5_keyblock */*key*/,
449	krb5_enctype /*etype*/,
450	hdb_master_key */*mkey*/);
451
452/**
453 * This function prunes an HDB entry's keys that are too old to have been used
454 * to mint still valid tickets (based on the entry's maximum ticket lifetime).
455 *
456 * @param context   Context
457 * @param entry	    HDB entry
458 */
459
460krb5_error_code
461hdb_prune_keys (
462	krb5_context /*context*/,
463	hdb_entry */*entry*/);
464
465krb5_error_code
466hdb_read_master_key (
467	krb5_context /*context*/,
468	const char */*filename*/,
469	hdb_master_key */*mkey*/);
470
471krb5_error_code
472hdb_replace_extension (
473	krb5_context /*context*/,
474	hdb_entry */*entry*/,
475	const HDB_extension */*ext*/);
476
477krb5_error_code
478hdb_seal_key (
479	krb5_context /*context*/,
480	HDB */*db*/,
481	Key */*k*/);
482
483krb5_error_code
484hdb_seal_key_mkey (
485	krb5_context /*context*/,
486	Key */*k*/,
487	hdb_master_key /*mkey*/);
488
489krb5_error_code
490hdb_seal_keys (
491	krb5_context /*context*/,
492	HDB */*db*/,
493	hdb_entry */*ent*/);
494
495krb5_error_code
496hdb_seal_keys_mkey (
497	krb5_context /*context*/,
498	hdb_entry */*ent*/,
499	hdb_master_key /*mkey*/);
500
501krb5_error_code
502hdb_set_last_modified_by (
503	krb5_context /*context*/,
504	hdb_entry */*entry*/,
505	krb5_principal /*modby*/,
506	time_t /*modtime*/);
507
508krb5_error_code
509hdb_set_master_key (
510	krb5_context /*context*/,
511	HDB */*db*/,
512	krb5_keyblock */*key*/);
513
514krb5_error_code
515hdb_set_master_keyfile (
516	krb5_context /*context*/,
517	HDB */*db*/,
518	const char */*keyfile*/);
519
520/**
521 * Create SQLITE object, and creates the on disk database if its doesn't exists.
522 *
523 * @param context A Kerberos 5 context.
524 * @param db a returned database handle.
525 * @param filename filename
526 *
527 * @return        0 on success, an error code if not
528 */
529
530krb5_error_code
531hdb_sqlite_create (
532	krb5_context /*context*/,
533	HDB **/*db*/,
534	const char */*filename*/);
535
536krb5_error_code
537hdb_unlock (int /*fd*/);
538
539krb5_error_code
540hdb_unseal_key (
541	krb5_context /*context*/,
542	HDB */*db*/,
543	Key */*k*/);
544
545krb5_error_code
546hdb_unseal_key_mkey (
547	krb5_context /*context*/,
548	Key */*k*/,
549	hdb_master_key /*mkey*/);
550
551krb5_error_code
552hdb_unseal_keys (
553	krb5_context /*context*/,
554	HDB */*db*/,
555	hdb_entry */*ent*/);
556
557krb5_error_code
558hdb_unseal_keys_kvno (
559	krb5_context /*context*/,
560	HDB */*db*/,
561	krb5_kvno /*kvno*/,
562	unsigned /*flags*/,
563	hdb_entry */*ent*/);
564
565krb5_error_code
566hdb_unseal_keys_mkey (
567	krb5_context /*context*/,
568	hdb_entry */*ent*/,
569	hdb_master_key /*mkey*/);
570
571int
572hdb_value2entry (
573	krb5_context /*context*/,
574	krb5_data */*value*/,
575	hdb_entry */*ent*/);
576
577int
578hdb_value2entry_alias (
579	krb5_context /*context*/,
580	krb5_data */*value*/,
581	hdb_entry_alias */*ent*/);
582
583krb5_error_code
584hdb_write_master_key (
585	krb5_context /*context*/,
586	const char */*filename*/,
587	hdb_master_key /*mkey*/);
588
589#ifdef __cplusplus
590}
591#endif
592
593#endif /* DOXY */
594#endif /* __hdb_protos_h__ */
595