2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
8 * Data Types for policy and principal information that
9 * exists in the respective databases.
13 * This file was originally created with rpcgen.
14 * It has been hacked up since then.
19 #include <sys/types.h>
20 #include <rpc/types.h> /* SUNWresync121 - no need to change to gssrpc/ */
24 #include <kadm5/admin.h>
25 #include <kdb/adb_err.h>
28 typedef long osa_adb_ret_t
;
30 #define OSA_ADB_POLICY_DB_MAGIC 0x12345A00
31 #define OSA_ADB_PRINC_DB_MAGIC 0x12345B00
33 #define OSA_ADB_SHARED 0x7001
34 #define OSA_ADB_EXCLUSIVE 0x7002
35 #define OSA_ADB_PERMANENT 0x7003
37 #define OSA_ADB_PRINC_VERSION_MASK 0x12345C00
38 #define OSA_ADB_PRINC_VERSION_1 0x12345C01
39 #define OSA_ADB_POLICY_VERSION_MASK 0x12345D00
40 #define OSA_ADB_POLICY_VERSION_1 0x12345D01
42 typedef struct _osa_adb_db_lock_ent_t
{
45 int refcnt
, lockmode
, lockcnt
;
47 } osa_adb_lock_ent
, *osa_adb_lock_t
;
49 typedef struct _osa_adb_db_ent_t
{
57 } osa_adb_db_ent
, *osa_adb_db_t
, *osa_adb_princ_t
, *osa_adb_policy_t
;
59 /* an osa_pw_hist_ent stores all the key_datas for a single password */
60 typedef struct _osa_pw_hist_t
{
62 krb5_key_data
*key_data
;
63 } osa_pw_hist_ent
, *osa_pw_hist_t
;
65 typedef struct _osa_princ_ent_t
{
69 unsigned int old_key_len
;
70 unsigned int old_key_next
;
71 krb5_kvno admin_history_kvno
;
72 osa_pw_hist_ent
*old_keys
;
73 } osa_princ_ent_rec
, *osa_princ_ent_t
;
75 typedef struct _osa_policy_ent_t
{
80 uint32_t pw_min_length
;
81 uint32_t pw_min_classes
;
82 uint32_t pw_history_num
;
83 uint32_t policy_refcnt
;
84 } osa_policy_ent_rec
, *osa_policy_ent_t
;
86 typedef void (*osa_adb_iter_princ_func
) (void *, osa_princ_ent_t
);
87 typedef void (*osa_adb_iter_policy_func
) (void *, osa_policy_ent_t
);
91 * Return Code (the rest are in adb_err.h)
99 bool_t
xdr_osa_princ_ent_rec(XDR
*xdrs
, osa_princ_ent_t objp
);
100 bool_t
xdr_osa_policy_ent_rec(XDR
*xdrs
, osa_policy_ent_t objp
);
101 bool_t
xdr_osa_pw_hist_ent(XDR
*xdrs
, osa_pw_hist_ent
*objp
);
102 bool_t
xdr_krb5_key_data(XDR
*xdrs
, krb5_key_data
*objp
);
108 osa_adb_ret_t
osa_adb_create_db(char *filename
, char *lockfile
, int magic
);
109 osa_adb_ret_t
osa_adb_destroy_db(char *filename
, char *lockfile
, int magic
);
110 osa_adb_ret_t
osa_adb_rename_db(char *filefrom
, char *lockfrom
,
111 char *fileto
, char *lockto
, int magic
);
112 osa_adb_ret_t
osa_adb_rename_policy_db(kadm5_config_params
*fromparams
,
113 kadm5_config_params
*toparams
);
114 osa_adb_ret_t
osa_adb_init_db(osa_adb_db_t
*dbp
, char *filename
,
115 char *lockfile
, int magic
);
116 osa_adb_ret_t
osa_adb_fini_db(osa_adb_db_t db
, int magic
);
117 osa_adb_ret_t
osa_adb_get_lock(osa_adb_db_t db
, int mode
);
118 osa_adb_ret_t
osa_adb_release_lock(osa_adb_db_t db
);
119 osa_adb_ret_t
osa_adb_open_and_lock(osa_adb_princ_t db
, int locktype
);
120 osa_adb_ret_t
osa_adb_close_and_unlock(osa_adb_princ_t db
);
122 osa_adb_ret_t
osa_adb_create_policy_db(kadm5_config_params
*params
);
123 osa_adb_ret_t
osa_adb_destroy_policy_db(kadm5_config_params
*params
);
124 osa_adb_ret_t
osa_adb_open_princ(osa_adb_princ_t
*db
, char *filename
);
125 osa_adb_ret_t
osa_adb_open_policy(osa_adb_policy_t
*db
,
126 kadm5_config_params
*rparams
);
127 osa_adb_ret_t
osa_adb_close_princ(osa_adb_princ_t db
);
128 osa_adb_ret_t
osa_adb_close_policy(osa_adb_policy_t db
);
129 osa_adb_ret_t
osa_adb_create_princ(osa_adb_princ_t db
,
130 osa_princ_ent_t entry
);
131 osa_adb_ret_t
osa_adb_create_policy(osa_adb_policy_t db
,
132 osa_policy_ent_t entry
);
133 osa_adb_ret_t
osa_adb_destroy_princ(osa_adb_princ_t db
,
135 osa_adb_ret_t
osa_adb_destroy_policy(osa_adb_policy_t db
,
136 kadm5_policy_t name
);
137 osa_adb_ret_t
osa_adb_get_princ(osa_adb_princ_t db
,
139 osa_princ_ent_t
*entry
);
140 osa_adb_ret_t
osa_adb_get_policy(osa_adb_policy_t db
,
142 osa_policy_ent_t
*entry
);
143 osa_adb_ret_t
osa_adb_put_princ(osa_adb_princ_t db
,
144 osa_princ_ent_t entry
);
145 osa_adb_ret_t
osa_adb_put_policy(osa_adb_policy_t db
,
146 osa_policy_ent_t entry
);
147 osa_adb_ret_t
osa_adb_iter_policy(osa_adb_policy_t db
,
148 osa_adb_iter_policy_func func
,
150 osa_adb_ret_t
osa_adb_iter_princ(osa_adb_princ_t db
,
151 osa_adb_iter_princ_func func
,
153 void osa_free_policy_ent(osa_policy_ent_t val
);
154 void osa_free_princ_ent(osa_princ_ent_t val
);
155 #endif /* __ADB_H__ */