xref: /titanic_41/usr/src/cmd/krb5/iprop/iprop.x (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
7*7c478bd9Sstevel@tonic-gate 
8*7c478bd9Sstevel@tonic-gate #ifdef RPC_XDR
9*7c478bd9Sstevel@tonic-gate %#include "iprop.h"
10*7c478bd9Sstevel@tonic-gate #endif /* RPC_XDR */
11*7c478bd9Sstevel@tonic-gate 
12*7c478bd9Sstevel@tonic-gate /*
13*7c478bd9Sstevel@tonic-gate  * Initial declarations
14*7c478bd9Sstevel@tonic-gate  */
15*7c478bd9Sstevel@tonic-gate 
16*7c478bd9Sstevel@tonic-gate #ifndef RPC_HDR
17*7c478bd9Sstevel@tonic-gate typedef short int16_t;
18*7c478bd9Sstevel@tonic-gate typedef unsigned short uint16_t;
19*7c478bd9Sstevel@tonic-gate typedef int int32_t;
20*7c478bd9Sstevel@tonic-gate typedef unsigned int uint32_t;
21*7c478bd9Sstevel@tonic-gate typedef hyper int64_t;
22*7c478bd9Sstevel@tonic-gate typedef unsigned hyper uint64_t;
23*7c478bd9Sstevel@tonic-gate #endif  /* !RPC_HDR */
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate typedef opaque	 utf8str_t<>;
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate  * Transaction log serial no.
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate typedef uint32_t	kdb_sno_t;
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /* Timestamp */
33*7c478bd9Sstevel@tonic-gate struct kdbe_time_t {
34*7c478bd9Sstevel@tonic-gate 	uint32_t	seconds;
35*7c478bd9Sstevel@tonic-gate 	uint32_t	useconds;
36*7c478bd9Sstevel@tonic-gate };
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /* Key Data */
39*7c478bd9Sstevel@tonic-gate struct kdbe_key_t {
40*7c478bd9Sstevel@tonic-gate 	int32_t		k_ver;	/* Version */
41*7c478bd9Sstevel@tonic-gate 	int32_t		k_kvno;	/* Key version no. */
42*7c478bd9Sstevel@tonic-gate 	int32_t		k_enctype<>;
43*7c478bd9Sstevel@tonic-gate 	utf8str_t	k_contents<>;
44*7c478bd9Sstevel@tonic-gate };
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate /* Content data */
47*7c478bd9Sstevel@tonic-gate struct kdbe_data_t {
48*7c478bd9Sstevel@tonic-gate 	int32_t		k_magic;
49*7c478bd9Sstevel@tonic-gate 	utf8str_t	k_data;
50*7c478bd9Sstevel@tonic-gate };
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /* Principal Data */
53*7c478bd9Sstevel@tonic-gate struct kdbe_princ_t {
54*7c478bd9Sstevel@tonic-gate 	utf8str_t	k_realm;
55*7c478bd9Sstevel@tonic-gate 	kdbe_data_t	k_components<>;
56*7c478bd9Sstevel@tonic-gate 	int32_t		k_nametype;
57*7c478bd9Sstevel@tonic-gate };
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate /* TL data (pre-auth specific data) */
60*7c478bd9Sstevel@tonic-gate struct kdbe_tl_t {
61*7c478bd9Sstevel@tonic-gate 	int16_t		tl_type;
62*7c478bd9Sstevel@tonic-gate 	opaque		tl_data<>;
63*7c478bd9Sstevel@tonic-gate };
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate /* Structure to store pwd history */
66*7c478bd9Sstevel@tonic-gate typedef kdbe_key_t kdbe_pw_hist_t<>;
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate /* Basic KDB entry attributes */
69*7c478bd9Sstevel@tonic-gate enum kdbe_attr_type_t {
70*7c478bd9Sstevel@tonic-gate 	AT_ATTRFLAGS = 0,
71*7c478bd9Sstevel@tonic-gate 	AT_MAX_LIFE = 1,
72*7c478bd9Sstevel@tonic-gate 	AT_MAX_RENEW_LIFE = 2,
73*7c478bd9Sstevel@tonic-gate 	AT_EXP = 3,
74*7c478bd9Sstevel@tonic-gate 	AT_PW_EXP = 4,
75*7c478bd9Sstevel@tonic-gate 	AT_LAST_SUCCESS = 5,
76*7c478bd9Sstevel@tonic-gate 	AT_LAST_FAILED = 6,
77*7c478bd9Sstevel@tonic-gate 	AT_FAIL_AUTH_COUNT = 7,
78*7c478bd9Sstevel@tonic-gate 	AT_PRINC = 8,
79*7c478bd9Sstevel@tonic-gate 	AT_KEYDATA = 9,
80*7c478bd9Sstevel@tonic-gate 	AT_TL_DATA = 10,
81*7c478bd9Sstevel@tonic-gate 	AT_LEN = 11,
82*7c478bd9Sstevel@tonic-gate 	AT_MOD_PRINC = 12,
83*7c478bd9Sstevel@tonic-gate 	AT_MOD_TIME = 13,
84*7c478bd9Sstevel@tonic-gate 	AT_MOD_WHERE = 14,
85*7c478bd9Sstevel@tonic-gate 	AT_PW_LAST_CHANGE = 15,
86*7c478bd9Sstevel@tonic-gate 	AT_PW_POLICY = 16,
87*7c478bd9Sstevel@tonic-gate 	AT_PW_POLICY_SWITCH = 17,
88*7c478bd9Sstevel@tonic-gate 	AT_PW_HIST_KVNO = 18,
89*7c478bd9Sstevel@tonic-gate 	AT_PW_HIST = 19
90*7c478bd9Sstevel@tonic-gate };
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /* KDB entry, Attribute=value */
93*7c478bd9Sstevel@tonic-gate union kdbe_val_t switch (kdbe_attr_type_t av_type) {
94*7c478bd9Sstevel@tonic-gate case AT_ATTRFLAGS:
95*7c478bd9Sstevel@tonic-gate 	uint32_t	av_attrflags;
96*7c478bd9Sstevel@tonic-gate case AT_MAX_LIFE:
97*7c478bd9Sstevel@tonic-gate 	uint32_t	av_max_life;
98*7c478bd9Sstevel@tonic-gate case AT_MAX_RENEW_LIFE:
99*7c478bd9Sstevel@tonic-gate 	uint32_t	av_max_renew_life;
100*7c478bd9Sstevel@tonic-gate case AT_EXP:
101*7c478bd9Sstevel@tonic-gate 	uint32_t	av_exp;
102*7c478bd9Sstevel@tonic-gate case AT_PW_EXP:
103*7c478bd9Sstevel@tonic-gate 	uint32_t	av_pw_exp;
104*7c478bd9Sstevel@tonic-gate case AT_LAST_SUCCESS:
105*7c478bd9Sstevel@tonic-gate 	uint32_t	av_last_success;
106*7c478bd9Sstevel@tonic-gate case AT_LAST_FAILED:
107*7c478bd9Sstevel@tonic-gate 	uint32_t	av_last_failed;
108*7c478bd9Sstevel@tonic-gate case AT_FAIL_AUTH_COUNT:
109*7c478bd9Sstevel@tonic-gate 	uint32_t	av_fail_auth_count;
110*7c478bd9Sstevel@tonic-gate case AT_PRINC:
111*7c478bd9Sstevel@tonic-gate 	kdbe_princ_t	av_princ;
112*7c478bd9Sstevel@tonic-gate case AT_KEYDATA:
113*7c478bd9Sstevel@tonic-gate 	kdbe_key_t	av_keydata<>;	/* array of keys */
114*7c478bd9Sstevel@tonic-gate case AT_TL_DATA:
115*7c478bd9Sstevel@tonic-gate 	kdbe_tl_t	av_tldata<>;	/* array of TL data */
116*7c478bd9Sstevel@tonic-gate case AT_LEN:
117*7c478bd9Sstevel@tonic-gate 	int16_t		av_len;
118*7c478bd9Sstevel@tonic-gate case AT_PW_LAST_CHANGE:
119*7c478bd9Sstevel@tonic-gate 	uint32_t	av_pw_last_change;
120*7c478bd9Sstevel@tonic-gate case AT_MOD_PRINC:
121*7c478bd9Sstevel@tonic-gate 	kdbe_princ_t	av_mod_princ;
122*7c478bd9Sstevel@tonic-gate case AT_MOD_TIME:
123*7c478bd9Sstevel@tonic-gate 	uint32_t	av_mod_time;
124*7c478bd9Sstevel@tonic-gate case AT_MOD_WHERE:
125*7c478bd9Sstevel@tonic-gate 	utf8str_t	av_mod_where;
126*7c478bd9Sstevel@tonic-gate case AT_PW_POLICY:
127*7c478bd9Sstevel@tonic-gate 	utf8str_t	av_pw_policy;
128*7c478bd9Sstevel@tonic-gate case AT_PW_POLICY_SWITCH:
129*7c478bd9Sstevel@tonic-gate 	bool		av_pw_policy_switch;
130*7c478bd9Sstevel@tonic-gate case AT_PW_HIST_KVNO:
131*7c478bd9Sstevel@tonic-gate 	uint32_t	av_pw_hist_kvno;
132*7c478bd9Sstevel@tonic-gate case AT_PW_HIST:
133*7c478bd9Sstevel@tonic-gate 	kdbe_pw_hist_t	av_pw_hist<>;	/* array of pw history */
134*7c478bd9Sstevel@tonic-gate default:
135*7c478bd9Sstevel@tonic-gate 	opaque		av_extension<>;	/* futures */
136*7c478bd9Sstevel@tonic-gate };
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate typedef kdbe_val_t kdbe_t<>;	    /* Array of attr/val makes a KDB entry */
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate /*
141*7c478bd9Sstevel@tonic-gate  * Incremental update
142*7c478bd9Sstevel@tonic-gate  */
143*7c478bd9Sstevel@tonic-gate struct kdb_incr_update_t {
144*7c478bd9Sstevel@tonic-gate 	utf8str_t	kdb_princ_name;	/* Principal name */
145*7c478bd9Sstevel@tonic-gate 	kdb_sno_t	kdb_entry_sno;	/* Serial # of entry */
146*7c478bd9Sstevel@tonic-gate 	kdbe_time_t	kdb_time;	/* Timestamp of update */
147*7c478bd9Sstevel@tonic-gate 	kdbe_t		kdb_update; 	/* Attributes modified */
148*7c478bd9Sstevel@tonic-gate 	bool		kdb_deleted;	/* Is this update a DELETION ? */
149*7c478bd9Sstevel@tonic-gate 	bool		kdb_commit;	/* Is the entry committed or not ? */
150*7c478bd9Sstevel@tonic-gate 	utf8str_t	kdb_kdcs_seen_by<>; /* Names of slaves that have */
151*7c478bd9Sstevel@tonic-gate 					    /* seen this update - for */
152*7c478bd9Sstevel@tonic-gate 					    /* future use */
153*7c478bd9Sstevel@tonic-gate 	opaque		kdb_futures<>;	/* futures */
154*7c478bd9Sstevel@tonic-gate };
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate /*
157*7c478bd9Sstevel@tonic-gate  * Update log body
158*7c478bd9Sstevel@tonic-gate  */
159*7c478bd9Sstevel@tonic-gate typedef kdb_incr_update_t kdb_ulog_t<>;
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate enum update_status_t {
162*7c478bd9Sstevel@tonic-gate 	UPDATE_OK = 0,
163*7c478bd9Sstevel@tonic-gate 	UPDATE_ERROR = 1,
164*7c478bd9Sstevel@tonic-gate 	UPDATE_FULL_RESYNC_NEEDED = 2,
165*7c478bd9Sstevel@tonic-gate 	UPDATE_BUSY = 3,
166*7c478bd9Sstevel@tonic-gate 	UPDATE_NIL = 4,
167*7c478bd9Sstevel@tonic-gate 	UPDATE_PERM_DENIED = 5
168*7c478bd9Sstevel@tonic-gate };
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate struct kdb_last_t {
171*7c478bd9Sstevel@tonic-gate 	kdb_sno_t	last_sno;
172*7c478bd9Sstevel@tonic-gate 	kdbe_time_t	last_time;
173*7c478bd9Sstevel@tonic-gate };
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate struct kdb_incr_result_t {
176*7c478bd9Sstevel@tonic-gate 	kdb_last_t		lastentry;
177*7c478bd9Sstevel@tonic-gate 	kdb_ulog_t		updates;
178*7c478bd9Sstevel@tonic-gate 	update_status_t		ret;
179*7c478bd9Sstevel@tonic-gate };
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate struct kdb_fullresync_result_t {
182*7c478bd9Sstevel@tonic-gate 	kdb_last_t		lastentry;
183*7c478bd9Sstevel@tonic-gate 	update_status_t 	ret;
184*7c478bd9Sstevel@tonic-gate };
185*7c478bd9Sstevel@tonic-gate 
186*7c478bd9Sstevel@tonic-gate program KRB5_IPROP_PROG {
187*7c478bd9Sstevel@tonic-gate 	version KRB5_IPROP_VERS {
188*7c478bd9Sstevel@tonic-gate 		/*
189*7c478bd9Sstevel@tonic-gate 		 * NULL procedure
190*7c478bd9Sstevel@tonic-gate 		 */
191*7c478bd9Sstevel@tonic-gate 		void
192*7c478bd9Sstevel@tonic-gate 		IPROP_NULL(void) = 0;
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate 		/*
195*7c478bd9Sstevel@tonic-gate 		 * Keep waiting for and get next incremental update(s)
196*7c478bd9Sstevel@tonic-gate 		 *
197*7c478bd9Sstevel@tonic-gate 		 * Will return latest kdb_vers on the master (if different),
198*7c478bd9Sstevel@tonic-gate 		 * alongwith return value and affected db entries.
199*7c478bd9Sstevel@tonic-gate 		 */
200*7c478bd9Sstevel@tonic-gate 		kdb_incr_result_t
201*7c478bd9Sstevel@tonic-gate 		IPROP_GET_UPDATES(kdb_last_t) = 1;
202*7c478bd9Sstevel@tonic-gate 
203*7c478bd9Sstevel@tonic-gate 		/*
204*7c478bd9Sstevel@tonic-gate 		 * We need to do the full-resync of the db, since the
205*7c478bd9Sstevel@tonic-gate 		 * serial nos./timestamps are way out-of-whack
206*7c478bd9Sstevel@tonic-gate 		 */
207*7c478bd9Sstevel@tonic-gate 		kdb_fullresync_result_t
208*7c478bd9Sstevel@tonic-gate 		IPROP_FULL_RESYNC(void) = 2;
209*7c478bd9Sstevel@tonic-gate 	} = 1;
210*7c478bd9Sstevel@tonic-gate } = 100423;
211