OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2000, International Business Machines Corporation and others. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 /* 00011 cellconfig.h: 00012 00013 Interface to the routines used by the FileServer to manipulate the cell/server database 00014 for the Cellular Andrew system, along with an operation to determine the name of the 00015 local cell. Included are a string variable used to hold the local cell name, definitions for 00016 the database file format and routines for: 00017 1) Acquiring the local cell name. 00018 2) Reading in the cell/server database from disk. 00019 3) Reporting the set of servers associated with a given cell name. 00020 4) Printing out the contents of the cell/server database. 00021 5) Reclaiming the space used by an in-memory database. 00022 00023 Creation date: 00024 17 August 1987 00025 00026 --------------------------------------------------------------------------------------------------------------*/ 00027 00028 #ifndef __CELLCONFIG_AFS_INCL_ 00029 #define __CELLCONFIG_AFS_INCL_ 1 00030 00031 #ifndef IPPROTO_MAX 00032 /* get sockaddr_in */ 00033 #ifdef AFS_NT40_ENV 00034 #include <winsock2.h> 00035 #else 00036 #include <sys/types.h> 00037 #include <netinet/in.h> 00038 #endif 00039 #endif 00040 #include <rx/rx_opaque.h> 00041 #include <opr/queue.h> 00042 00043 #define MAXCELLCHARS 64 00044 #define MAXHOSTCHARS 64 00045 #define MAXHOSTSPERCELL 8 00046 00047 /* 00048 * Return codes. 00049 */ 00050 #define AFSCONF_SUCCESS 0 /* worked */ 00051 00052 /* 00053 * Complete server info for one cell. 00054 */ 00055 struct afsconf_cell { 00056 char name[MAXCELLCHARS]; /*Cell name */ 00057 short numServers; /*Num active servers for the cell */ 00058 short flags; /* useful flags */ 00059 struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; /*IP addresses for cell's servers */ 00060 char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; /*Names for cell's servers */ 00061 char *linkedCell; /* Linked cell name, if any */ 00062 int timeout; /* Data timeout, if non-zero */ 00063 }; 00064 00065 #define AFSCONF_CELL_FLAG_DNS_QUERIED 1 00066 00067 struct afsconf_cellalias { 00068 char aliasName[MAXCELLCHARS]; 00069 char realName[MAXCELLCHARS]; 00070 }; 00071 00072 struct afsconf_entry { 00073 struct afsconf_entry *next; /* next guy in afsconf_dir */ 00074 struct afsconf_cell cellInfo; /* info for this cell */ 00075 }; 00076 00077 struct afsconf_aliasentry { 00078 struct afsconf_aliasentry *next; 00079 struct afsconf_cellalias aliasInfo; 00080 }; 00081 00085 #define AFSCONF_SECOPTS_NOAUTH 0x1 00086 #define AFSCONF_SECOPTS_LOCALAUTH 0x2 00087 #define AFSCONF_SECOPTS_ALWAYSENCRYPT 0x4 00088 #define AFSCONF_SECOPTS_FALLBACK_NULL 0x8 00089 typedef afs_uint32 afsconf_secflags; 00090 00091 struct afsconf_dir { 00092 char *name; /* pointer to dir prefix */ 00093 char *cellName; /* cell name, if any, we're in */ 00094 struct afsconf_entry *entries; /* list of cell entries */ 00095 struct opr_queue keyList; /* list of keys */ 00096 afs_int32 timeRead; /* time stamp of file last read */ 00097 afs_int32 timeCheck; /* time of last check for update */ 00098 struct afsconf_aliasentry *alias_entries; /* cell aliases */ 00099 afsconf_secflags securityFlags; 00100 struct afsconf_realms *local_realms; /* local realms */ 00101 struct afsconf_realms *exclusions; /* excluded principals */ 00102 }; 00103 00104 extern afs_int32 afsconf_FindService(const char *aname); 00105 extern const char *afsconf_FindIANAName(const char *aname); 00106 extern struct afsconf_dir *afsconf_Open(const char *adir); 00107 extern int afsconf_CellApply(struct afsconf_dir *adir, 00108 int (*aproc) (struct afsconf_cell * cell, 00109 void *arock, 00110 struct afsconf_dir * dir), 00111 void *arock); 00112 extern int afsconf_CellAliasApply(struct afsconf_dir *adir, 00113 int (*aproc) (struct afsconf_cellalias * 00114 alias, void *arock, 00115 struct afsconf_dir * dir), 00116 void *arock); 00117 extern int afsconf_GetExtendedCellInfo(struct afsconf_dir *adir, 00118 char *acellName, char *aservice, 00119 struct afsconf_cell *acellInfo, 00120 char clones[]); 00121 extern int afsconf_GetAfsdbInfo(char *acellName, char *aservice, 00122 struct afsconf_cell *acellInfo); 00123 extern int afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName, 00124 char *aservice, 00125 struct afsconf_cell *acellInfo); 00126 extern int afsconf_GetLocalCell(struct afsconf_dir *adir, 00127 char *aname, afs_int32 alen); 00128 extern int afsconf_Close(struct afsconf_dir *adir); 00129 extern int afsconf_UpToDate(void *rock); 00130 00131 struct afsconf_keys; 00132 extern int afsconf_GetKeys(struct afsconf_dir *adir, 00133 struct afsconf_keys *astr); 00134 00135 struct ktc_encryptionKey; 00136 extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir, 00137 afs_int32 * avno, 00138 struct ktc_encryptionKey *akey); 00139 extern int afsconf_GetKey(void *rock, int avno, 00140 struct ktc_encryptionKey *akey); 00141 extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno, 00142 char akey[8], afs_int32 overwrite); 00143 extern int afsconf_DeleteKey(struct afsconf_dir *adir, afs_int32 akvno); 00144 00145 struct afsconf_typedKey; 00146 struct afsconf_typedKeyList { 00147 int nkeys; 00148 struct afsconf_typedKey **keys; 00149 }; 00150 00151 typedef enum { 00152 afsconf_rxkad = 0, 00153 afsconf_rxgk =1 00154 } afsconf_keyType; 00155 00156 extern struct afsconf_typedKey * 00157 afsconf_typedKey_get(struct afsconf_typedKey *); 00158 extern void afsconf_typedKey_put(struct afsconf_typedKey **); 00159 extern struct afsconf_typedKey * 00160 afsconf_typedKey_new(afsconf_keyType type, int kvno, 00161 int subType, struct rx_opaque *key); 00162 extern void afsconf_typedKey_free(struct afsconf_typedKey **); 00163 00164 extern void afsconf_typedKey_values(struct afsconf_typedKey *key, 00165 afsconf_keyType *type, 00166 int *kvno, 00167 int *minorType, 00168 struct rx_opaque **keyMaterial); 00169 00170 extern int afsconf_GetAllKeys(struct afsconf_dir *, 00171 struct afsconf_typedKeyList **); 00172 extern int afsconf_GetKeysByType(struct afsconf_dir *dir, 00173 afsconf_keyType type, int kvno, 00174 struct afsconf_typedKeyList **); 00175 extern int afsconf_GetKeyByTypes(struct afsconf_dir *dir, 00176 afsconf_keyType type, int kvno, int subType, 00177 struct afsconf_typedKey **); 00178 extern int afsconf_GetLatestKeysByType(struct afsconf_dir *dir, 00179 afsconf_keyType type, 00180 struct afsconf_typedKeyList **); 00181 extern int afsconf_GetLatestKeyByTypes(struct afsconf_dir *dir, 00182 afsconf_keyType type, int subType, 00183 struct afsconf_typedKey **); 00184 extern void afsconf_PutTypedKeyList(struct afsconf_typedKeyList **keys); 00185 extern int afsconf_AddTypedKey(struct afsconf_dir *dir, 00186 struct afsconf_typedKey *key, 00187 int overwrite); 00188 extern int afsconf_DeleteKeyByType(struct afsconf_dir *dir, 00189 afsconf_keyType type, int kvno); 00190 extern int afsconf_DeleteKeyBySubType(struct afsconf_dir *dir, 00191 afsconf_keyType type, int kvno, 00192 int subType); 00193 00194 /* authcon.c */ 00195 struct rx_securityClass; 00196 extern afs_int32 afsconf_ServerAuth(void *arock, 00197 struct rx_securityClass **, 00198 afs_int32 *); 00199 extern afs_int32 afsconf_ClientAuth(void *arock, 00200 struct rx_securityClass **astr, 00201 afs_int32 * aindex); 00202 extern afs_int32 afsconf_ClientAuthSecure(void *arock, 00203 struct rx_securityClass **astr, 00204 afs_int32 * aindex); 00205 00206 00207 extern afs_int32 afsconf_ClientAuthToken(struct afsconf_cell *info, 00208 afsconf_secflags flags, 00209 struct rx_securityClass **sc, 00210 afs_int32 *scIndex, 00211 time_t *expires); 00212 00213 00214 extern afs_int32 afsconf_PickClientSecObj(struct afsconf_dir *dir, 00215 afsconf_secflags flags, 00216 struct afsconf_cell *info, 00217 char *cellName, 00218 struct rx_securityClass **sc, 00219 afs_int32 *scIndex, 00220 time_t *expires); 00221 00222 extern void afsconf_SetSecurityFlags(struct afsconf_dir *dir, 00223 afsconf_secflags flags); 00224 00225 extern void afsconf_BuildServerSecurityObjects(void *, 00226 struct rx_securityClass ***, 00227 afs_int32 *); 00228 00229 /* writeconfig.c */ 00230 int afsconf_SetExtendedCellInfo(struct afsconf_dir *adir, const char *apath, 00231 struct afsconf_cell *acellInfo, char clones[]); 00232 int afsconf_SetCellInfo(struct afsconf_dir *adir, const char *apath, 00233 struct afsconf_cell *acellInfo); 00234 00235 00236 /* userok.c */ 00237 00238 struct rx_call; 00239 struct rx_identity; 00240 extern int afsconf_CheckAuth(void *arock, struct rx_call *acall); 00241 extern int afsconf_GetNoAuthFlag(struct afsconf_dir *adir); 00242 extern void afsconf_SetNoAuthFlag(struct afsconf_dir *adir, int aflag); 00243 extern int afsconf_DeleteUser(struct afsconf_dir *adir, char *auser); 00244 extern int afsconf_DeleteIdentity(struct afsconf_dir *, struct rx_identity *); 00245 extern int afsconf_GetNthUser(struct afsconf_dir *adir, afs_int32 an, 00246 char *abuffer, afs_int32 abufferLen); 00247 extern int afsconf_GetNthIdentity(struct afsconf_dir *, int, 00248 struct rx_identity **); 00249 extern int afsconf_AddUser(struct afsconf_dir *adir, char *aname); 00250 extern int afsconf_AddIdentity(struct afsconf_dir *adir, struct rx_identity *); 00251 extern int afsconf_SuperUser(struct afsconf_dir *adir, struct rx_call *acall, 00252 char *namep); 00253 extern int afsconf_SuperIdentity(struct afsconf_dir *, struct rx_call *, 00254 struct rx_identity **); 00255 extern int afsconf_IsSuperIdentity(struct afsconf_dir *, struct rx_identity *); 00256 00257 /* realms.c */ 00258 extern int afsconf_SetLocalRealm(const char *realm); 00259 extern int afsconf_IsLocalRealmMatch(struct afsconf_dir *dir, afs_int32 * local, 00260 const char *name, const char *instance, 00261 const char *cell); 00262 00263 /* netrestrict.c */ 00264 00265 extern int afsconf_ParseNetRestrictFile(afs_uint32 outAddrs[], 00266 afs_uint32 * mask, afs_uint32 * mtu, 00267 afs_uint32 maxAddrs, afs_uint32 * nAddrs, 00268 char reason[], const char *fileName); 00269 00270 extern int afsconf_ParseNetFiles(afs_uint32 addrbuf[], afs_uint32 maskbuf[], 00271 afs_uint32 mtubuf[], afs_uint32 max, 00272 char reason[], const char *niFileName, 00273 const char *nrFileName); 00274 00275 /* some well-known ports and their names; new additions to table in cellconfig.c, too */ 00276 #define AFSCONF_FILESERVICE "afs" 00277 #define AFSCONF_FILEPORT 7000 00278 #define AFSCONF_CALLBACKSERVICE "afscb" 00279 #define AFSCONF_CALLBACKPORT 7001 00280 #define AFSCONF_PROTSERVICE "afsprot" 00281 #define AFSCONF_PROTPORT 7002 00282 #define AFSCONF_VLDBSERVICE "afsvldb" 00283 #define AFSCONF_VLDBPORT 7003 00284 #define AFSCONF_KAUTHSERVICE "afskauth" 00285 #define AFSCONF_KAUTHPORT 7004 00286 #define AFSCONF_VOLUMESERVICE "afsvol" 00287 #define AFSCONF_VOLUMEPORT 7005 00288 #define AFSCONF_ERRORSERVICE "afserror" 00289 #define AFSCONF_ERRORPORT 7006 00290 #define AFSCONF_NANNYSERVICE "afsnanny" 00291 #define AFSCONF_NANNYPORT 7007 00292 #define AFSCONF_UPDATESERVICE "afsupdate" 00293 #define AFSCONF_UPDATEPORT 7008 00294 #define AFSCONF_RMTSYSSERVICE "afsrmtsys" 00295 #define AFSCONF_RMTSYSPORT 7009 00296 #define AFSCONF_RSDBSERVICE "afsres" 00297 #define AFSCONF_RESPORT 7010 00298 #define AFSCONF_REMIODBSERVICE "afsremio" 00299 #define AFSCONF_REMIOPORT 7011 00300 00301 #endif /* __CELLCONFIG_AFS_INCL_ */