2 * Copyright 2000, International Business Machines Corporation and others.
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
13 Interface to the routines used by the FileServer to manipulate the cell/server database
14 for the Cellular Andrew system, along with an operation to determine the name of the
15 local cell. Included are a string variable used to hold the local cell name, definitions for
16 the database file format and routines for:
17 1) Acquiring the local cell name.
18 2) Reading in the cell/server database from disk.
19 3) Reporting the set of servers associated with a given cell name.
20 4) Printing out the contents of the cell/server database.
21 5) Reclaiming the space used by an in-memory database.
26 --------------------------------------------------------------------------------------------------------------*/
28 #ifndef __CELLCONFIG_AFS_INCL_
29 #define __CELLCONFIG_AFS_INCL_ 1
36 #include <sys/types.h>
37 #include <netinet/in.h>
40 #include <rx/rx_opaque.h>
41 #include <opr/queue.h>
43 #include <rx/rxgk_types.h>
45 #define MAXCELLCHARS 64
46 #define MAXHOSTCHARS 64
47 #define MAXHOSTSPERCELL 8
52 #define AFSCONF_SUCCESS 0 /* worked */
55 * Complete server info for one cell.
58 char name[MAXCELLCHARS]; /*Cell name */
59 short numServers; /*Num active servers for the cell */
60 short flags; /* useful flags */
61 struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; /*IP addresses for cell's servers */
62 char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; /*Names for cell's servers */
63 char clone[MAXHOSTSPERCELL]; /*Indicates which ones are clones */
64 char *linkedCell; /* Linked cell name, if any */
65 int timeout; /* Data timeout, if non-zero */
68 #define AFSCONF_CELL_FLAG_DNS_QUERIED 1
70 struct afsconf_cellalias {
71 char aliasName[MAXCELLCHARS];
72 char realName[MAXCELLCHARS];
75 struct afsconf_entry {
76 struct afsconf_entry *next; /* next guy in afsconf_dir */
77 struct afsconf_cell cellInfo; /* info for this cell */
80 struct afsconf_aliasentry {
81 struct afsconf_aliasentry *next;
82 struct afsconf_cellalias aliasInfo;
86 * A set of bit flags to control the selection of a security object
88 #define AFSCONF_SECOPTS_NOAUTH 0x1
89 #define AFSCONF_SECOPTS_LOCALAUTH 0x2
90 #define AFSCONF_SECOPTS_ALWAYSENCRYPT 0x4
91 #define AFSCONF_SECOPTS_FALLBACK_NULL 0x8
92 #define AFSCONF_SECOPTS_NEVERENCRYPT 0x10
93 #define AFSCONF_SECOPTS_ALWAYSCLEAR 0x20
94 #define AFSCONF_SECOPTS_RXGK 0x40
95 typedef afs_uint32 afsconf_secflags;
98 char *name; /* pointer to dir prefix */
99 char *cellName; /* cell name, if any, we're in */
100 char *cellservDB; /* pathname of the CellServDB file */
101 struct afsconf_entry *entries; /* list of cell entries */
102 struct opr_queue keyList; /* list of keys */
103 afs_int32 timeRead; /* time stamp of file last read */
104 afs_int32 timeCheck; /* time of last check for update */
105 struct afsconf_aliasentry *alias_entries; /* cell aliases */
106 afsconf_secflags securityFlags;
107 struct afsconf_realms *local_realms; /* local realms */
108 struct afsconf_realms *exclusions; /* excluded principals */
111 extern afs_int32 afsconf_FindService(const char *aname);
112 extern const char *afsconf_FindIANAName(const char *aname);
113 extern struct afsconf_dir *afsconf_Open(const char *adir);
114 extern int afsconf_CellApply(struct afsconf_dir *adir,
115 int (*aproc) (struct afsconf_cell * cell,
117 struct afsconf_dir * dir),
119 extern int afsconf_CellAliasApply(struct afsconf_dir *adir,
120 int (*aproc) (struct afsconf_cellalias *
122 struct afsconf_dir * dir),
124 extern int afsconf_GetExtendedCellInfo(struct afsconf_dir *adir,
125 char *acellName, char *aservice,
126 struct afsconf_cell *acellInfo,
128 extern int afsconf_GetAfsdbInfo(char *acellName, char *aservice,
129 struct afsconf_cell *acellInfo);
130 extern int afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName,
132 struct afsconf_cell *acellInfo);
133 extern int afsconf_GetLocalCell(struct afsconf_dir *adir,
134 char *aname, afs_int32 alen);
135 extern int afsconf_Close(struct afsconf_dir *adir);
136 extern int afsconf_UpToDate(void *rock);
139 extern int afsconf_GetKeys(struct afsconf_dir *adir,
140 struct afsconf_keys *astr);
142 struct ktc_encryptionKey;
143 extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir,
145 struct ktc_encryptionKey *akey);
146 extern afs_int32 afsconf_GetLatestRXGKKey(struct afsconf_dir *adir,
147 afs_int32 *avno, afs_int32 *enctype,
149 extern int afsconf_GetKey(void *rock, int avno,
150 struct ktc_encryptionKey *akey);
151 extern int afsconf_GetRXGKKey(void *rock, afs_int32 *avno, afs_int32 *enctype,
153 extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno,
154 char akey[8], afs_int32 overwrite);
155 extern int afsconf_DeleteKey(struct afsconf_dir *adir, afs_int32 akvno);
157 struct afsconf_typedKey;
158 struct afsconf_typedKeyList {
160 struct afsconf_typedKey **keys;
166 afsconf_rxkad_krb5 =2
169 extern struct afsconf_typedKey *
170 afsconf_typedKey_get(struct afsconf_typedKey *);
171 extern void afsconf_typedKey_put(struct afsconf_typedKey **);
172 extern struct afsconf_typedKey *
173 afsconf_typedKey_new(afsconf_keyType type, int kvno,
174 int subType, struct rx_opaque *key);
175 extern void afsconf_typedKey_free(struct afsconf_typedKey **);
177 extern void afsconf_typedKey_values(struct afsconf_typedKey *key,
178 afsconf_keyType *type,
181 struct rx_opaque **keyMaterial);
183 extern int afsconf_GetAllKeys(struct afsconf_dir *,
184 struct afsconf_typedKeyList **);
185 extern int afsconf_GetKeysByType(struct afsconf_dir *dir,
186 afsconf_keyType type, int kvno,
187 struct afsconf_typedKeyList **);
188 extern int afsconf_GetKeyByTypes(struct afsconf_dir *dir,
189 afsconf_keyType type, int kvno, int subType,
190 struct afsconf_typedKey **);
191 extern int afsconf_GetLatestKeysByType(struct afsconf_dir *dir,
192 afsconf_keyType type,
193 struct afsconf_typedKeyList **);
194 extern int afsconf_GetLatestKeyByTypes(struct afsconf_dir *dir,
195 afsconf_keyType type, int subType,
196 struct afsconf_typedKey **);
197 extern void afsconf_PutTypedKeyList(struct afsconf_typedKeyList **keys);
198 extern int afsconf_AddTypedKey(struct afsconf_dir *dir,
199 struct afsconf_typedKey *key,
201 extern int afsconf_DeleteKeyByType(struct afsconf_dir *dir,
202 afsconf_keyType type, int kvno);
203 extern int afsconf_DeleteKeyBySubType(struct afsconf_dir *dir,
204 afsconf_keyType type, int kvno,
208 struct rx_securityClass;
209 extern afs_int32 afsconf_ServerAuth(void *arock,
210 struct rx_securityClass **,
212 extern afs_int32 afsconf_ClientAuth(void *arock,
213 struct rx_securityClass **astr,
215 extern afs_int32 afsconf_ClientAuthSecure(void *arock,
216 struct rx_securityClass **astr,
218 extern afs_int32 afsconf_ClientAuthRXGKClear(void *arock,
219 struct rx_securityClass **aclass,
221 extern afs_int32 afsconf_ClientAuthRXGKAuth(void *arock,
222 struct rx_securityClass **aclass,
224 extern afs_int32 afsconf_ClientAuthRXGKCrypt(void *arock,
225 struct rx_securityClass **aclass,
229 extern afs_int32 afsconf_ClientAuthToken(struct afsconf_cell *info,
230 afsconf_secflags flags,
231 struct rx_securityClass **sc,
236 extern afs_int32 afsconf_PickClientSecObj(struct afsconf_dir *dir,
237 afsconf_secflags flags,
238 struct afsconf_cell *info,
240 struct rx_securityClass **sc,
244 extern void afsconf_SetSecurityFlags(struct afsconf_dir *dir,
245 afsconf_secflags flags);
247 extern void afsconf_BuildServerSecurityObjects(void *,
248 struct rx_securityClass ***,
252 int afsconf_SetExtendedCellInfo(struct afsconf_dir *adir, const char *apath,
253 struct afsconf_cell *acellInfo, char clones[]);
254 int afsconf_SetCellInfo(struct afsconf_dir *adir, const char *apath,
255 struct afsconf_cell *acellInfo);
262 extern int afsconf_CheckAuth(void *arock, struct rx_call *acall);
263 extern int afsconf_GetNoAuthFlag(struct afsconf_dir *adir);
264 extern void afsconf_SetNoAuthFlag(struct afsconf_dir *adir, int aflag);
265 extern int afsconf_DeleteUser(struct afsconf_dir *adir, char *auser);
266 extern int afsconf_DeleteIdentity(struct afsconf_dir *, struct rx_identity *);
267 extern int afsconf_GetNthUser(struct afsconf_dir *adir, afs_int32 an,
268 char *abuffer, afs_int32 abufferLen);
269 extern int afsconf_GetNthIdentity(struct afsconf_dir *, int,
270 struct rx_identity **);
271 extern int afsconf_AddUser(struct afsconf_dir *adir, char *aname);
272 extern int afsconf_AddIdentity(struct afsconf_dir *adir, struct rx_identity *);
273 extern int afsconf_SuperUser(struct afsconf_dir *adir, struct rx_call *acall,
275 extern int afsconf_SuperIdentity(struct afsconf_dir *, struct rx_call *,
276 struct rx_identity **);
277 extern int afsconf_IsSuperIdentity(struct afsconf_dir *, struct rx_identity *);
278 extern int afsconf_CheckRestrictedQuery(struct afsconf_dir *adir,
279 struct rx_call *acall,
283 * Level constants for the -restricted_query option used by vlserver
284 * and volser. Once we have vlserver and volserver to ptserver
285 * connection, we can add more access levels, like AUTHUSER or
286 * AUTHANDFOREIGNUSER.
288 #define RESTRICTED_QUERY_ANYUSER 0
289 #define RESTRICTED_QUERY_ADMIN 1
292 extern int afsconf_SetLocalRealm(const char *realm);
293 extern int afsconf_IsLocalRealmMatch(struct afsconf_dir *dir, afs_int32 * local,
294 const char *name, const char *instance,
299 extern int afsconf_ParseNetRestrictFile(afs_uint32 outAddrs[],
300 afs_uint32 * mask, afs_uint32 * mtu,
301 afs_uint32 maxAddrs, afs_uint32 * nAddrs,
302 char reason[], const char *fileName);
304 extern int afsconf_ParseNetFiles(afs_uint32 addrbuf[], afs_uint32 maskbuf[],
305 afs_uint32 mtubuf[], afs_uint32 max,
306 char reason[], const char *niFileName,
307 const char *nrFileName);
309 /* some well-known ports and their names; new additions to table in cellconfig.c, too */
310 #define AFSCONF_FILESERVICE "afs"
311 #define AFSCONF_FILEPORT 7000
312 #define AFSCONF_CALLBACKSERVICE "afscb"
313 #define AFSCONF_CALLBACKPORT 7001
314 #define AFSCONF_PROTSERVICE "afsprot"
315 #define AFSCONF_PROTPORT 7002
316 #define AFSCONF_VLDBSERVICE "afsvldb"
317 #define AFSCONF_VLDBPORT 7003
318 #define AFSCONF_KAUTHSERVICE "afskauth"
319 #define AFSCONF_KAUTHPORT 7004
320 #define AFSCONF_VOLUMESERVICE "afsvol"
321 #define AFSCONF_VOLUMEPORT 7005
322 #define AFSCONF_ERRORSERVICE "afserror"
323 #define AFSCONF_ERRORPORT 7006
324 #define AFSCONF_NANNYSERVICE "afsnanny"
325 #define AFSCONF_NANNYPORT 7007
326 #define AFSCONF_UPDATESERVICE "afsupdate"
327 #define AFSCONF_UPDATEPORT 7008
328 #define AFSCONF_RMTSYSSERVICE "afsrmtsys"
329 #define AFSCONF_RMTSYSPORT 7009
330 #define AFSCONF_RSDBSERVICE "afsres"
331 #define AFSCONF_RESPORT 7010
332 #define AFSCONF_REMIODBSERVICE "afsremio"
333 #define AFSCONF_REMIOPORT 7011
335 #endif /* __CELLCONFIG_AFS_INCL_ */