kauth: Remove unused lclpw structure from klog
[openafs.git] / src / kauth / kauth.rg
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* for input byte sequences */
11 customized struct ka_CBS {
12         afs_int32 SeqLen;
13         char *SeqBody;
14 };
15
16 /* for in/out byte sequences */
17 customized struct ka_BBS {
18         afs_int32 MaxSeqLen;
19         afs_int32 SeqLen;
20         char *SeqBody;
21 };
22
23 const   MAXKAKVNO     = 127;    /* The key version number must fit in a byte */
24
25 /* flags: zero is an illegal value */
26 const   KAFNORMAL      = 0x001; /* set for all user entries */
27   /* if the normal is off then one of these two MUST be set */
28 const   KAFFREE        = 0x002; /* set if in free list */
29 const   KAFOLDKEYS     = 0x010; /* if entry used to store old keys */
30   /* otherwise one of these may be set to define the usage of the misc field */
31 const   KAFSPECIAL     = 0x100; /* set if special AuthServer principal */
32 const   KAFASSOCROOT   = 0x200; /* set if root of associate tree */
33 const   KAFASSOC       = 0x400; /* set if entry is an associate */
34   /* These bits define special propertied of normal users. */
35 const   KAFADMIN       = 0x004; /* an administrator */
36 const   KAFNOTGS       = 0x008; /* ! allow principal to get or use TGT */
37 const   KAFNOSEAL      = 0x020; /* ! allow principal as server in GetTicket */
38 const   KAFNOCPW       = 0x040; /* ! allow principal to change its own key */
39 const   KAFNEWASSOC    = 0x080; /* allow user to create associates */
40
41 /* these flags are settable using SetFields */
42 %#define KAF_SETTABLE_FLAGS (KAFADMIN | KAFNOTGS | KAFNOSEAL | KAFNOCPW | KAFNEWASSOC)
43
44 /* This struction defines an encryption key that is bit level compatible with
45  * DES and ktc_encryptionKey but which will have to be cast to the appropriate
46  * type in calls. */
47
48 struct EncryptionKey {
49     char key[8];
50 };
51
52 /* These structures are returned by server RPC interface routines.  To make
53  * future revisions easy to accomodate they are assigned a major and minor
54  * version number.  Major version changes will require recompilation because of
55  * the structures have changed size.  Minor version changes will be more or
56  * less upward compaitible. */
57 const KAMAJORVERSION = 5;               /* as of 890301 */
58 const KAMINORVERSION = 2;
59
60 %#ifndef NEVERDATE
61 %#define NEVERDATE 037777777777         /* a date that will never come */
62 %#endif
63 %#ifndef Date
64 %#define Date afs_uint32
65 %#endif
66 #define Date afs_uint32
67 /* We log to AuthLog and a dbm-based log file on most platforms.
68  * On NT & some HPs  we only log to AuthLog
69  * For HPs, AUTH_DBM_LOG is defined in their respective Makefiles for
70  * platforms that can log using dbm.
71  * On Linux, dbm is not part of the standard installation, and we can't
72  * statically link it in. So, ignore it for now.
73  */
74 %#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
75 %#define AUTH_DBM_LOG
76 %#endif
77
78 #define MAXKANAMELEN 64                 /* don't export: use MAXKTCNAMELEN */
79 typedef string kaname<MAXKANAMELEN>;
80
81 /* A structure for returning name and instance strings */
82 struct kaident {
83     char name[MAXKANAMELEN];            /* user name */
84     char instance[MAXKANAMELEN];        /* group name */
85 };
86
87 /* A structure for returning entry information */
88 struct kaentryinfo {
89     afs_int32      minor_version;       /* the minor version of this struct */
90     afs_int32      flags;               /* random flags */
91     Date           user_expiration;     /* user registration good till then */
92     Date           modification_time;   /* time of last update */
93     struct kaident modification_user;   /* user name & inst last mod. entry */
94     Date           change_password_time;/* time user changed own password */
95     afs_int32      max_ticket_lifetime; /* maximum lifetime for tickets */
96     afs_int32      key_version;         /* verson number of this key */
97     EncryptionKey  key;                 /* the key to use */
98     afs_uint32  keyCheckSum;            /* crypto-cksum of key */
99     afs_uint32  misc_auth_bytes;     /* expiry, plus more byte values */
100     afs_int32      reserved3;           /* NOT Spare - used to hold pwsums[0] */
101     afs_int32      reserved4;
102 };
103
104 /* These are (static) statistics kept in the database header */
105 /* WARNING: Changing the size of this structure affects the on-disk database
106  * header, which will force it to be rebuilt. */
107 struct kasstats {
108     afs_int32 minor_version;                    /* the minor version of this struct */
109     afs_int32 allocs;                   /* total # of calls to AllocBlock */
110     afs_int32 frees;                            /* total # of calls to FreeBlock */
111     afs_int32 cpws;                             /* # of user change password cmds */
112     afs_int32 reserved1;
113     afs_int32 reserved2;
114     afs_int32 reserved3;
115     afs_int32 reserved4;
116 };
117
118 struct katimeval {
119         afs_int32       tv_sec;         /* seconds */
120         afs_int32       tv_usec;        /* and microseconds */
121 };
122 struct karpcstats {int requests; int aborts;};
123 #define declare_stat(n) struct karpcstats n
124
125 /* These are dynamic statistics kept in the each AuthServer process */
126 struct kadstats {
127     afs_int32 minor_version;                    /* the minor version of this struct */
128     afs_int32 host;                             /* host number */
129     Date start_time;                    /* time statistics were last cleared */
130     /* statistics that can be calculated upon request */
131 #if (KAMAJORVERSION>5)
132     struct katimeval utime;
133     struct katimeval stime;
134     int  dataSize;
135     int  stackSize;
136     int  pageFaults;
137 #endif
138     afs_int32 hashTableUtilization;             /* utilization of non-empty hash table
139                                            entries in parts per 10,000 */
140     /* count of requests and aborts for each RPC */
141     declare_stat (Authenticate);
142     declare_stat (ChangePassword);
143     declare_stat (GetTicket);
144     declare_stat (CreateUser);
145     declare_stat (SetPassword);
146     declare_stat (SetFields);
147     declare_stat (DeleteUser);
148     declare_stat (GetEntry);
149     declare_stat (ListEntry);
150     declare_stat (GetStats);
151     declare_stat (GetPassword);
152     declare_stat (GetRandomKey);
153     declare_stat (Debug);
154     declare_stat (UAuthenticate);
155     declare_stat (UGetTicket);
156     declare_stat (Unlock);
157     declare_stat (LockStatus);
158     afs_int32 string_checks;                    /* errors detected in name.inst strs */
159     afs_int32 reserved1;
160     afs_int32 reserved2;
161     afs_int32 reserved3;
162     afs_int32 reserved4;
163 };
164
165 /* This returns information about the state of the server for debugging
166    problems remotely. */
167
168 const KADEBUGKCINFOSIZE = 25;
169
170 struct ka_kcInfo {
171     Date used;
172     afs_int32 kvno;
173     char primary;
174     char keycksum;
175     char principal[64];
176 };
177
178 struct ka_debugInfo {
179     afs_int32 minorVersion;                     /* the minor version of this struct */
180     afs_int32 host;                             /* host number */
181     Date startTime;                     /* time server was started */
182 #if (KAMAJORVERSION>5)
183     Date now;                           /* current server time */
184 #endif
185     int  noAuth;                        /* running with authentication off */
186     /* activity */
187     Date lastTrans;                     /* time of last transation */
188     char lastOperation[16];             /* name of last operation */
189     char lastAuth[256];                 /* last principal to authenticate */
190     char lastUAuth[256];                /*  "  authenticate via UDP */
191     char lastTGS[256];                  /*  "  call ticket granting service */
192     char lastUTGS[256];                 /*  "  call TGS via UDP */
193     char lastAdmin[256];                /*  "  call admin service */
194     char lastTGSServer[256];            /*  last server a ticket was req for */
195     char lastUTGSServer[256];           /*  "       "     " via UDP */
196     Date nextAutoCPW;                   /* time of next AutoCPW attempt */
197     int  updatesRemaining;              /* update necessary for next AutoCPW */
198     /* db header stuff */
199     Date dbHeaderRead;                  /* time cheader was last read in */
200     afs_int32 dbVersion;
201     afs_int32 dbFreePtr;
202     afs_int32 dbEofPtr;
203     afs_int32 dbKvnoPtr;
204     afs_int32 dbSpecialKeysVersion;
205     /* these are of type struct Lock */
206     afs_int32 cheader_lock;
207     afs_int32 keycache_lock;
208
209     /* key cache stuff */
210     afs_int32 kcVersion;
211     int  kcSize;
212     int  kcUsed;
213     struct ka_kcInfo kcInfo[KADEBUGKCINFOSIZE];
214
215     afs_int32 reserved1;
216     afs_int32 reserved2;
217     afs_int32 reserved3;
218     afs_int32 reserved4;
219 };
220
221 /* finally the procedural definitions */
222
223 package KAA_
224 prefix S
225 statindex 18
226
227 proc Authenticate_old(
228   IN kaname name,
229   IN kaname instance,
230   IN Date start_time,
231   IN Date end_time,
232   IN struct ka_CBS *request,
233   INOUT struct ka_BBS *answer
234 ) = 1;
235
236 proc Authenticate(
237   IN kaname name,
238   IN kaname instance,
239   IN Date start_time,
240   IN Date end_time,
241   IN struct ka_CBS *request,
242   INOUT struct ka_BBS *answer
243 ) = 21;
244
245 proc AuthenticateV2(
246   IN kaname name,
247   IN kaname instance,
248   IN Date start_time,
249   IN Date end_time,
250   IN struct ka_CBS *request,
251   INOUT struct ka_BBS *answer
252 ) = 22;
253
254 proc ChangePassword(
255   IN kaname name,
256   IN kaname instance,
257   IN struct ka_CBS *arequest,
258   INOUT struct ka_BBS *oanswer
259 ) = 2;
260
261 package KAT_
262 prefix S
263 statindex 19
264
265 proc GetTicket_old(
266   IN afs_int32 kvno,
267   IN kaname auth_domain,
268   IN struct ka_CBS *aticket,
269   IN kaname name,
270   IN kaname instance,
271   IN struct ka_CBS *atimes,
272   INOUT struct ka_BBS *oanswer
273 ) = 3;
274
275 proc GetTicket(
276   IN afs_int32 kvno,
277   IN kaname auth_domain,
278   IN struct ka_CBS *aticket,
279   IN kaname name,
280   IN kaname instance,
281   IN struct ka_CBS *atimes,
282   INOUT struct ka_BBS *oanswer
283 ) = 23;
284
285 package KAM_
286 prefix S
287 statindex 20
288
289 proc SetPassword(
290   IN kaname name,
291   IN kaname instance,
292   IN afs_int32 kvno,
293   IN EncryptionKey password
294 ) = 4;
295
296 proc SetFields(
297   IN kaname name,
298   IN kaname instance,
299   IN afs_int32 flags,
300   IN Date user_expiration,
301   IN afs_int32 max_ticket_lifetime,
302   IN afs_int32 maxAssociates,
303   IN afs_uint32 misc_auth_bytes,
304   IN afs_int32 spare2
305 ) = 5;
306
307 proc CreateUser(
308   IN kaname name,
309   IN kaname instance,
310   IN EncryptionKey password
311 ) = 6;
312
313 proc DeleteUser(
314   IN kaname name,
315   IN kaname instance
316 ) = 7;
317
318 proc GetEntry(
319   IN kaname name,
320   IN kaname instance,
321   IN afs_int32 major_version,
322   OUT struct kaentryinfo *entry
323 ) = 8;
324
325 proc ListEntry(
326   IN afs_int32 previous_index,
327   OUT afs_int32 *index,
328   OUT afs_int32 *count,
329   OUT kaident *name
330 ) = 9;
331
332 proc GetStats(
333   IN afs_int32 major_version,
334   OUT afs_int32 *admin_accounts,
335   OUT struct kasstats *statics,
336   OUT struct kadstats *dynamics
337 ) = 10;
338
339 proc Debug(
340   IN afs_int32 major_version,
341   IN int checkDB,
342   OUT struct ka_debugInfo *info
343 ) = 11;
344
345 proc GetPassword(
346   IN kaname name,
347   OUT EncryptionKey *password
348 ) = 12;
349
350 proc GetRandomKey(
351   OUT EncryptionKey *password
352 ) = 13;
353
354 proc Unlock(
355   IN kaname name,
356   IN kaname instance,
357   IN afs_int32 spare1,
358   IN afs_int32 spare2,
359   IN afs_int32 spare3,
360   IN afs_int32 spare4
361 ) = 14;
362
363 proc LockStatus(
364   IN kaname name,
365   IN kaname instance,
366   OUT afs_int32 *lockeduntil,
367   IN afs_int32 spare1,
368   IN afs_int32 spare2,
369   IN afs_int32 spare3,
370   IN afs_int32 spare4
371 ) = 15;