TF_UTIL(3) 4.0 TF_UTIL(3) NNAAMMEE tf_init, tf_get_pname, tf_get_pinst, tf_get_cred, tf_close - Routines for manipulating a Kerberos ticket file SSYYNNOOPPSSIISS ##iinncclluuddee <<kkeerrbbeerroossIIVV//kkrrbb..hh>> eexxtteerrnn cchhaarr **kkrrbb__eerrrr__ttxxtt[[]];; ttff__iinniitt((ttff__nnaammee,, rrww)) cchhaarr **ttff__nnaammee;; iinntt rrww;; ttff__ggeett__ppnnaammee((ppnnaammee)) cchhaarr **ppnnaammee;; ttff__ggeett__ppiinnsstt((ppiinnsstt)) cchhaarr **ppiinnsstt;; ttff__ggeett__ccrreedd((cc)) CCRREEDDEENNTTIIAALLSS **cc;; ttff__cclloossee(()) DDEESSCCRRIIPPTTIIOONN This group of routines are provided to manipulate the Ker- beros tickets file. A ticket file has the following format: principal's name (null-terminated string) principal's instance (null-terminated string) CREDENTIAL_1 CREDENTIAL_2 ... CREDENTIAL_n EOF Where "CREDENTIAL_x" consists of the following fixed-length fields from the CREDENTIALS structure (defined in <kerberosIV/krb.h>): char service[ANAME_SZ] char instance[INST_SZ] char realm[REALM_SZ] des_cblock session int lifetime int kvno KTEXT_ST ticket_st long issue_date _t_f__i_n_i_t must be called before the other ticket file rou- tines. It takes the name of the ticket file to use, and a Printed 7/27/90 Kerberos 1 TF_UTIL(3) 4.0 TF_UTIL(3) read/write flag as arguments. It tries to open the ticket file, checks the mode and if everything is okay, locks the file. If it's opened for reading, the lock is shared. If it's opened for writing, the lock is exclusive. KSUCCESS is returned if all went well, otherwise one of the following: NO_TKT_FIL - file wasn't there TKT_FIL_ACC - file was in wrong mode, etc. TKT_FIL_LCK - couldn't lock the file, even after a retry The _t_f__g_e_t__p_n_a_m_e reads the principal's name from a ticket file. It should only be called after tf_init has been called. The principal's name is filled into the _p_n_a_m_e parameter. If all goes well, KSUCCESS is returned. If tf_init wasn't called, TKT_FIL_INI is returned. If the principal's name was null, or EOF was encountered, or the name was longer than ANAME_SZ, TKT_FIL_FMT is returned. The _t_f__g_e_t__p_i_n_s_t reads the principal's instance from a ticket file. It should only be called after tf_init and tf_get_pname have been called. The principal's instance is filled into the _p_i_n_s_t parameter. If all goes well, KSUCCESS is returned. If tf_init wasn't called, TKT_FIL_INI is returned. If EOF was encountered, or the name was longer than INST_SZ, TKT_FIL_FMT is returned. Note that, unlike the principal name, the instance name may be null. The _t_f__g_e_t__c_r_e_d routine reads a CREDENTIALS record from a ticket file and fills in the given structure. It should only be called after tf_init, tf_get_pname, and tf_get_pinst have been called. If all goes well, KSUCCESS is returned. Possible error codes are: TKT_FIL_INI - tf_init wasn't called first TKT_FIL_FMT - bad format EOF - end of file encountered _t_f__c_l_o_s_e closes the ticket file and releases the lock on it. SSEEEE AALLSSOO krb(3) DDIIAAGGNNOOSSTTIICCSS BBUUGGSS The ticket file routines have to be called in a certain order. AAUUTTHHOORRSS Jennifer Steiner, MIT Project Athena Bill Bryant, MIT Project Athena Printed 7/27/90 Kerberos 2 TF_UTIL(3) 4.0 TF_UTIL(3) RREESSTTRRIICCTTIIOONNSS Copyright 1987 Massachusetts Institute of Technology Printed 7/27/90 Kerberos 3