Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / crypto / kerberosIV / lib / kdb / krb_db.h
1 /*
2  * $Id: krb_db.h,v 1.15 1996/12/17 20:34:32 assar Exp $ 
3  * $FreeBSD: src/crypto/kerberosIV/lib/kdb/krb_db.h,v 1.3 1999/09/19 21:56:06 markm Exp $ 
4  * $DragonFly: src/crypto/kerberosIV/lib/kdb/Attic/krb_db.h,v 1.2 2003/06/17 04:24:36 dillon Exp $ 
5  *
6  * Copyright 1987, 1988 by the Massachusetts Institute of Technology. 
7  *
8  * For copying and distribution information, please see the file
9  * <mit-copyright.h>. 
10  *
11  * spm          Project Athena  8/85 
12  *
13  * This file defines data structures for the kerberos
14  * authentication/authorization database. 
15  *
16  * They MUST correspond to those defined in *.rel 
17  */
18
19 #ifndef KRB_DB_DEFS
20 #define KRB_DB_DEFS
21
22 #include <stdio.h>
23
24 #define KERB_M_NAME             "K"     /* Kerberos */
25 #define KERB_M_INST             "M"     /* Master */
26 #define KERB_DEFAULT_NAME       "default"
27 #define KERB_DEFAULT_INST       ""
28 #ifndef DB_DIR
29 #define DB_DIR                  "/var/db/kerberos"
30 #endif
31 #ifndef DBM_FILE
32 #define DBM_FILE                DB_DIR "/principal"
33 #endif
34
35 /* this also defines the number of queue headers */
36 #define KERB_DB_HASH_MODULO 64
37
38
39 /* Arguments to kerb_dbl_lock() */
40
41 #define KERB_DBL_EXCLUSIVE 1
42 #define KERB_DBL_SHARED 0
43
44 /* arguments to kerb_db_set_lockmode() */
45
46 #define KERB_DBL_BLOCKING 0
47 #define KERB_DBL_NONBLOCKING 1
48
49 /* arguments to kdb_get_master_key */
50
51 #define KDB_GET_PROMPT 1
52 #define KDB_GET_TWICE  2
53
54 /* Principal defines the structure of a principal's name */
55
56 typedef struct {
57     char    name[ANAME_SZ];
58     char    instance[INST_SZ];
59
60     u_int32_t key_low;
61     u_int32_t key_high;
62     u_int32_t exp_date;
63     char    exp_date_txt[DATE_SZ];
64     u_int32_t mod_date;
65     char    mod_date_txt[DATE_SZ];
66     u_int16_t attributes;
67     u_int8_t max_life;
68     u_int8_t kdc_key_ver;
69     u_int8_t key_version;
70
71     char    mod_name[ANAME_SZ];
72     char    mod_instance[INST_SZ];
73     char   *old;                /* cast to (Principal *); not in db,
74                                  * ptr to old vals */
75 } Principal;
76
77 typedef struct {
78     int32_t    cpu;
79     int32_t    elapsed;
80     int32_t    dio;
81     int32_t    pfault;
82     int32_t    t_stamp;
83     int32_t    n_retrieve;
84     int32_t    n_replace;
85     int32_t    n_append;
86     int32_t    n_get_stat;
87     int32_t    n_put_stat;
88 } DB_stat;
89
90 /* Dba defines the structure of a database administrator */
91
92 typedef struct {
93     char    name[ANAME_SZ];
94     char    instance[INST_SZ];
95     u_int16_t attributes;
96     u_int32_t exp_date;
97     char    exp_date_txt[DATE_SZ];
98     char   *old;        /*
99                          * cast to (Dba *); not in db, ptr to
100                          * old vals
101                          */
102 } Dba;
103
104 typedef int (*k_iter_proc_t)(void*, Principal*);
105
106 void copy_from_key __P((des_cblock in, u_int32_t *lo, u_int32_t *hi));
107 void copy_to_key __P((u_int32_t *lo, u_int32_t *hi, des_cblock out));
108
109 void kdb_encrypt_key __P((des_cblock *, des_cblock *, des_cblock *,
110                           des_key_schedule, int));
111 int kdb_get_master_key __P((int prompt, des_cblock *master_key,
112                             des_key_schedule master_key_sched));
113 int kdb_get_new_master_key __P((des_cblock *, des_key_schedule, int));
114 int kdb_kstash __P((des_cblock *, char *));
115 int kdb_new_get_master_key __P((des_cblock *, des_key_schedule));
116 int kdb_new_get_new_master_key __P((des_cblock *key, des_key_schedule schedule, int verify));
117 long kdb_verify_master_key __P((des_cblock *, des_key_schedule, FILE *));
118 long *kerb_db_begin_update __P((void));
119 int kerb_db_create __P((char *db_name));
120 int kerb_db_delete_principal (char *name, char *inst);
121 void kerb_db_end_update __P((long *db));
122 int kerb_db_get_dba __P((char *, char *, Dba *, unsigned, int *));
123 void kerb_db_get_stat __P((DB_stat *));
124 int kerb_db_iterate __P((k_iter_proc_t, void*));
125 int kerb_db_put_principal __P((Principal *, unsigned int));
126 void kerb_db_put_stat __P((DB_stat *));
127 int kerb_db_rename __P((char *, char *));
128 int kerb_db_set_lockmode __P((int));
129 int kerb_db_set_name __P((char *));
130 int kerb_db_update __P((long *db, Principal *principal, unsigned int max));
131 int kerb_delete_principal __P((char *name, char *inst));
132 void kerb_fini __P((void));
133 int kerb_get_dba __P((char *, char *, Dba *, unsigned int, int *));
134 time_t kerb_get_db_age __P((void));
135 int kerb_get_principal __P((char *, char *, Principal *, unsigned int, int *));
136 int kerb_init __P((void));
137 int kerb_put_principal __P((Principal *, unsigned int));
138
139 #endif /* KRB_DB_DEFS */