OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * kautils.h: 00003 * This file is automatically generated; please do not edit it. 00004 */ 00005 /* Including ./kautils.p.h at beginning of kautils.h file. */ 00006 00007 /* 00008 * Copyright 2000, International Business Machines Corporation and others. 00009 * All Rights Reserved. 00010 * 00011 * This software has been released under the terms of the IBM Public 00012 * License. For details, see the LICENSE file in the top-level source 00013 * directory or online at http://www.openafs.org/dl/license10.html 00014 */ 00015 00016 /* 00017 * Revision 2.2 1990/09/27 13:51:37 00018 * Declare (char *) returning function ka_timestr(). 00019 * Cleanups. 00020 * 00021 * Revision 2.1 90/08/07 19:11:51 00022 * Start with clean version to sync test and dev trees. 00023 * */ 00024 00025 #ifndef __KAUTILS__ 00026 #define __KAUTILS__ 00027 00028 #include <afs/auth.h> 00029 00030 #ifndef KAMAJORVERSION 00031 /* just to be on the safe side, get these two first */ 00032 #include <sys/types.h> 00033 #include <rx/xdr.h> 00034 00035 /* get installed .h file only if not included already from local dir */ 00036 #ifndef _RXGEN_KAUTH_ 00037 #include <afs/kauth.h> 00038 #endif 00039 00040 #endif 00041 00042 #include <ubik.h> 00043 #include <afs/cellconfig.h> 00044 #include <afs/afsutil.h> 00045 00046 00047 #define KA_TIMESTR_LEN 30 00048 #define Date afs_uint32 00049 00050 /* 00051 * Public function prototypes 00052 */ 00053 00054 extern afs_int32 ka_GetAuthToken(char *name, char *instance, char *cell, 00055 struct ktc_encryptionKey *key, 00056 afs_int32 lifetime, afs_int32 * pwexpires); 00057 00058 extern afs_int32 ka_GetServerToken(char *name, char *instance, char *cell, 00059 Date lifetime, struct ktc_token *token, 00060 int newer, int dosetpag); 00061 00062 extern afs_int32 ka_GetAdminToken(char *name, char *instance, char *cell, 00063 struct ktc_encryptionKey *key, 00064 afs_int32 lifetime, struct ktc_token *token, 00065 int newer); 00066 00067 extern afs_int32 ka_VerifyUserToken(char *name, char *instance, char *cell, 00068 struct ktc_encryptionKey *key); 00069 00070 extern void ka_ExplicitCell(char *cell, afs_uint32 serverList[] 00071 ); 00072 00073 extern afs_int32 ka_GetServers(char *cell, struct afsconf_cell *cellinfo); 00074 00075 extern afs_int32 ka_GetSecurity(int service, struct ktc_token *token, 00076 struct rx_securityClass **scP, int *siP); 00077 00078 extern afs_int32 ka_SingleServerConn(char *cell, char *server, int service, 00079 struct ktc_token *token, 00080 struct ubik_client **conn); 00081 00082 extern afs_int32 ka_AuthSpecificServersConn(int service, 00083 struct ktc_token *token, 00084 struct afsconf_cell *cellinfo, 00085 struct ubik_client **conn); 00086 00087 extern afs_int32 ka_AuthServerConn(char *cell, int service, 00088 struct ktc_token *token, 00089 struct ubik_client **conn); 00090 00091 extern afs_int32 ka_Authenticate(char *name, char *instance, char *cell, 00092 struct ubik_client *conn, int service, 00093 struct ktc_encryptionKey *key, Date start, 00094 Date end, struct ktc_token *token, 00095 afs_int32 * pwexpires); 00096 00097 extern afs_int32 ka_GetToken(char *name, char *instance, char *cell, 00098 char *cname, char *cinst, 00099 struct ubik_client *conn, Date start, Date end, 00100 struct ktc_token *auth_token, char *auth_domain, 00101 struct ktc_token *token); 00102 00103 extern afs_int32 ka_ChangePassword(char *name, char *instance, 00104 struct ubik_client *conn, 00105 struct ktc_encryptionKey *oldkey, 00106 struct ktc_encryptionKey *newkey); 00107 00108 extern void ka_StringToKey(char *str, char *cell, 00109 struct ktc_encryptionKey *key); 00110 00111 extern afs_int32 ka_ReadPassword(char *prompt, int verify, char *cell, 00112 struct ktc_encryptionKey *key); 00113 00114 extern afs_int32 ka_ParseLoginName(char *login, char name[MAXKTCNAMELEN], 00115 char inst[MAXKTCNAMELEN], 00116 char cell[MAXKTCREALMLEN] 00117 ); 00118 00119 #ifdef _MFC_VER 00120 extern "C" { 00121 #endif /* _MFC_VER */ 00122 extern afs_int32 ka_Init(int flags); 00123 #ifdef _MFC_VER 00124 } 00125 #endif /* _MFC_VER */ 00126 extern int ka_CellConfig(const char *dir); 00127 00128 extern char *ka_LocalCell(void 00129 ); 00130 00131 extern int ka_ExpandCell(char *cell, char *fullCell, int *alocal); 00132 00133 extern int ka_CellToRealm(char *cell, char *realm, int *local); 00134 00135 extern void ka_PrintUserID(char *prefix, char *name, char *instance, 00136 char *postfix); 00137 00138 extern void ka_PrintBytes(char bs[], int bl); 00139 00140 extern int ka_ConvertBytes(char *ascii, int alen, char bs[], int bl); 00141 00142 extern int ka_ReadBytes(char *ascii, char *binary, int blen); 00143 00144 extern int umin(afs_uint32 a, afs_uint32 b); 00145 00146 extern afs_int32 ka_KeyCheckSum(char *key, afs_uint32 * cksumP); 00147 00148 extern int ka_KeyIsZero(char *akey, int alen); 00149 00150 extern void ka_timestr(afs_int32 time, char *tstr, afs_int32 tlen); 00151 00152 extern void ka_debugKeyCache(struct ka_debugInfo *info); 00153 00154 extern void save_principal(char *p, char *n, char *i, char *c); 00155 00156 extern afs_int32 ka_GetAFSTicket(char *name, char *instance, char *realm, 00157 Date lifetime, afs_int32 flags); 00158 00159 extern afs_int32 ka_UserAuthenticateGeneral(afs_int32 flags, char *name, 00160 char *instance, char *realm, 00161 char *password, Date lifetime, 00162 afs_int32 * password_expires, 00163 afs_int32 spare2, char **reasonP); 00164 00165 extern afs_int32 ka_UserAuthenticateGeneral2(afs_int32 flags, char *name, 00166 char *instance, char *realm, 00167 char *password, char *smbname, 00168 Date lifetime, 00169 afs_int32 * password_expires, 00170 afs_int32 spare2, 00171 char **reasonP); 00172 extern afs_int32 ka_UserAuthenticate(char *name, char *instance, char *realm, 00173 char *password, int doSetPAG, 00174 char **reasonP); 00175 00176 extern afs_int32 ka_UserReadPassword(char *prompt, char *password, int plen, 00177 char **reasonP); 00178 00179 extern afs_int32 ka_VerifyUserPassword(afs_int32 version, char *name, 00180 char *instance, char *realm, 00181 char *password, int spare, 00182 char **reasonP); 00183 #define KA_USERAUTH_VERSION 1 00184 #define KA_USERAUTH_VERSION_MASK 0x00ffff 00185 #define KA_USERAUTH_DOSETPAG 0x010000 00186 #define KA_USERAUTH_DOSETPAG2 0x020000 00187 #define KA_USERAUTH_ONLY_VERIFY 0x040000 00188 #define KA_USERAUTH_AUTHENT_LOGON 0x100000 00189 #define ka_UserAuthenticate(n,i,r,p,d,rP) \ 00190 ka_UserAuthenticateGeneral \ 00191 (KA_USERAUTH_VERSION + ((d) ? KA_USERAUTH_DOSETPAG : 0), \ 00192 n,i,r,p, /*lifetime*/0, /*spare1,2*/0,0, rP) 00193 #define ka_UserAuthenticateLife(f,n,i,r,p,l,rP) \ 00194 ka_UserAuthenticateGeneral \ 00195 (KA_USERAUTH_VERSION + (f), n,i,r,p,l, /*spare1,2*/0,0, rP) 00196 00197 #define KA_REUSEPW 1 00198 #define KA_NOREUSEPW 2 00199 #define KA_ISLOCKED 4 00200 00201 #define KA_AUTHENTICATION_SERVICE 731 00202 #define KA_TICKET_GRANTING_SERVICE 732 00203 #define KA_MAINTENANCE_SERVICE 733 00204 00205 #define RX_SCINDEX_NULL 0 /* No security */ 00206 #define RX_SCINDEX_VAB 1 /* vice tokens, with bcrypt */ 00207 #define RX_SCINDEX_KAD 2 /* Kerberos/DES */ 00208 00209 #define KA_TGS_NAME "krbtgt" 00210 /* realm is TGS instance */ 00211 #define KA_ADMIN_NAME "AuthServer" 00212 #define KA_ADMIN_INST "Admin" 00213 00214 #define KA_LABELSIZE 4 00215 #define KA_GETTGT_REQ_LABEL "gTGS" 00216 #define KA_GETTGT_ANS_LABEL "tgsT" 00217 #define KA_GETADM_REQ_LABEL "gADM" 00218 #define KA_GETADM_ANS_LABEL "admT" 00219 #define KA_CPW_REQ_LABEL "CPWl" 00220 #define KA_CPW_ANS_LABEL "Pass" 00221 #define KA_GETTICKET_ANS_LABEL "gtkt" 00222 00223 struct ka_gettgtRequest { /* format of request */ 00224 Date time; /* time of request */ 00225 char label[KA_LABELSIZE]; /* label to verify correct decrypt */ 00226 }; 00227 00228 /* old interface: see ka_ticketAnswer instead */ 00229 struct ka_gettgtAnswer { /* format of response */ 00230 Date time; /* the time of the request plus one */ 00231 struct ktc_encryptionKey 00232 sessionkey; /* the session key in the ticket */ 00233 afs_int32 kvno; /* version # of tkt encrypting key */ 00234 afs_int32 ticket_len; /* the ticket's length */ 00235 char ticket[MAXKTCTICKETLEN]; /* the ticket itself (no padding) */ 00236 char label[KA_LABELSIZE]; /* label to verify correct decrypt */ 00237 }; 00238 00239 struct ka_ticketAnswer { /* format of response */ 00240 afs_int32 cksum; /* function to be defined */ 00241 Date challenge; /* the time of the request plus one */ 00242 struct ktc_encryptionKey 00243 sessionKey; /* the session key in the ticket */ 00244 Date startTime; 00245 Date endTime; 00246 afs_int32 kvno; /* version of ticket encrypting key */ 00247 afs_int32 ticketLen; /* the ticket's length */ 00248 char name[MAXKTCNAMELEN]; 00249 char instance[MAXKTCNAMELEN]; 00250 char cell[MAXKTCNAMELEN]; 00251 char sname[MAXKTCNAMELEN]; 00252 char sinstance[MAXKTCNAMELEN]; 00253 char ticket[MAXKTCTICKETLEN]; /* the ticket (no extra chars) */ 00254 char label[KA_LABELSIZE]; /* for detecting decryption errors */ 00255 }; 00256 00257 struct ka_cpwRequest { /* format of request */ 00258 Date time; /* time of request */ 00259 struct ktc_encryptionKey 00260 newpw; /* new key */ 00261 afs_int32 kvno; /* version number of key */ 00262 afs_int32 spare; /* must be zero */ 00263 char label[KA_LABELSIZE]; /* label to verify correct decrypt */ 00264 }; 00265 00266 struct ka_cpwAnswer { /* format of response */ 00267 Date time; /* the time of the request plus one */ 00268 char label[KA_LABELSIZE]; /* label to verify correct decrypt */ 00269 }; 00270 00271 struct ka_getTicketTimes { 00272 Date start; 00273 Date end; 00274 }; 00275 00276 /* old interface: see ka_ticketAnswer instead */ 00277 struct ka_getTicketAnswer { 00278 struct ktc_encryptionKey sessionKey; 00279 Date startTime; 00280 Date endTime; 00281 afs_int32 kvno; 00282 afs_int32 ticketLen; 00283 char name[MAXKTCNAMELEN]; 00284 char instance[MAXKTCNAMELEN]; 00285 char cell[MAXKTCNAMELEN]; 00286 char sname[MAXKTCNAMELEN]; 00287 char sinstance[MAXKTCNAMELEN]; 00288 char ticket[MAXKTCTICKETLEN]; 00289 }; 00290 00291 #ifndef ERROR_TABLE_BASE_KA 00292 #define ka_ErrorString afs_error_message 00293 #undef KAMINERROR 00294 #define KAMINERROR ERROR_TABLE_BASE_KA 00295 #define KAMAXERROR (KAMINERROR+255) 00296 #endif 00297 00298 #endif 00299 00300 /* End of prolog file ./kautils.p.h. */ 00301 00302 #define KADATABASEINCONSISTENT (180480L) 00303 #define KAEXIST (180481L) 00304 #define KAIO (180482L) 00305 #define KACREATEFAIL (180483L) 00306 #define KANOENT (180484L) 00307 #define KAEMPTY (180485L) 00308 #define KABADNAME (180486L) 00309 #define KABADINDEX (180487L) 00310 #define KANOAUTH (180488L) 00311 #define KAANSWERTOOLONG (180489L) 00312 #define KABADREQUEST (180490L) 00313 #define KAOLDINTERFACE (180491L) 00314 #define KABADARGUMENT (180492L) 00315 #define KABADCMD (180493L) 00316 #define KANOKEYS (180494L) 00317 #define KAREADPW (180495L) 00318 #define KABADKEY (180496L) 00319 #define KAUBIKINIT (180497L) 00320 #define KAUBIKCALL (180498L) 00321 #define KABADPROTOCOL (180499L) 00322 #define KANOCELLS (180500L) 00323 #define KANOCELL (180501L) 00324 #define KATOOMANYUBIKS (180502L) 00325 #define KATOOMANYKEYS (180503L) 00326 #define KABADTICKET (180504L) 00327 #define KAUNKNOWNKEY (180505L) 00328 #define KAKEYCACHEINVALID (180506L) 00329 #define KABADSERVER (180507L) 00330 #define KABADUSER (180508L) 00331 #define KABADCPW (180509L) 00332 #define KABADCREATE (180510L) 00333 #define KANOTICKET (180511L) 00334 #define KAASSOCUSER (180512L) 00335 #define KANOTSPECIAL (180513L) 00336 #define KACLOCKSKEW (180514L) 00337 #define KANORECURSE (180515L) 00338 #define KARXFAIL (180516L) 00339 #define KANULLPASSWORD (180517L) 00340 #define KAINTERNALERROR (180518L) 00341 #define KAPWEXPIRED (180519L) 00342 #define KAREUSED (180520L) 00343 #define KATOOSOON (180521L) 00344 #define KALOCKED (180522L) 00345 extern void initialize_KA_error_table(void); 00346 #define ERROR_TABLE_BASE_KA (180480L) 00347 00348 /* for compatibility with older versions... */ 00349 #define init_KA_err_tbl initialize_KA_error_table 00350 #define KA_err_base ERROR_TABLE_BASE_KA 00351 00352 /* for compatibility with other users... */ 00353 #define ERROR_TABLE_BASE_ka (180480L) 00354 #define init_ka_err_tbl initialize_KA_error_table 00355 #define initialize_ka_error_table initialize_KA_error_table 00356 #define ka_err_base ERROR_TABLE_BASE_ka