KAFS(3) UNIX Programmer's Manual KAFS(3) NNAAMMEE kk__hhaassaaffss, kk__ppiiooccttll, kk__uunnlloogg, kk__sseettppaagg, kk__aaffss__cceellll__ooff__ffiillee, kkaaffss__sseett__vveerrbboossee, kkaaffss__sseettttookkeenn__rrxxkkaadd, kkaaffss__sseettttookkeenn, kkrrbb__aaffsslloogg, kkrrbb__aaffsslloogg__uuiidd kkaaffss__sseettttookkeenn55, kkrrbb55__aaffsslloogg, kkrrbb55__aaffsslloogg__uuiidd - AFS library LLIIBBRRAARRYY AFS cache manager access library (libkafs, -lkafs) SSYYNNOOPPSSIISS _i_n_t kk__aaffss__cceellll__ooff__ffiillee(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _c_h_a_r _*_c_e_l_l, _i_n_t _l_e_n) _i_n_t kk__hhaassaaffss(_v_o_i_d) _i_n_t kk__ppiiooccttll(_c_h_a_r _*_a___p_a_t_h, _i_n_t _o___o_p_c_o_d_e, _s_t_r_u_c_t _V_i_c_e_I_o_c_t_l _*_a___p_a_r_a_m_s_P, _i_n_t _a___f_o_l_l_o_w_S_y_m_l_i_n_k_s) _i_n_t kk__sseettppaagg(_v_o_i_d) _i_n_t kk__uunnlloogg(_v_o_i_d) _v_o_i_d kkaaffss__sseett__vveerrbboossee(_v_o_i_d _(_*_f_u_n_c_)_(_v_o_i_d _*_, _c_o_n_s_t _c_h_a_r _*_, _i_n_t_), _v_o_i_d _*) _i_n_t kkaaffss__sseettttookkeenn__rrxxkkaadd(_c_o_n_s_t _c_h_a_r _*_c_e_l_l, _s_t_r_u_c_t _C_l_e_a_r_T_o_k_e_n _*_t_o_k_e_n, _v_o_i_d _*_t_i_c_k_e_t, _s_i_z_e___t _t_i_c_k_e_t___l_e_n) _i_n_t kkaaffss__sseettttookkeenn(_c_o_n_s_t _c_h_a_r _*_c_e_l_l, _u_i_d___t _u_i_d, _C_R_E_D_E_N_T_I_A_L_S _*_c) kkrrbb__aaffsslloogg(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m) _i_n_t kkrrbb__aaffsslloogg__uuiidd(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m, _u_i_d___t _u_i_d) _k_r_b_5___e_r_r_o_r___c_o_d_e kkrrbb55__aaffsslloogg__uuiidd(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___c_c_a_c_h_e _i_d, _c_o_n_s_t _c_h_a_r _*_c_e_l_l, _k_r_b_5___c_o_n_s_t___r_e_a_l_m _r_e_a_l_m, _u_i_d___t _u_i_d) _i_n_t kkaaffss__sseettttookkeenn55(_c_o_n_s_t _c_h_a_r _*_c_e_l_l, _u_i_d___t _u_i_d, _k_r_b_5___c_r_e_d_s _*_c) _k_r_b_5___e_r_r_o_r___c_o_d_e kkrrbb55__aaffsslloogg(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___c_c_a_c_h_e _i_d, _c_o_n_s_t _c_h_a_r _*_c_e_l_l, _k_r_b_5___c_o_n_s_t___r_e_a_l_m _r_e_a_l_m) DDEESSCCRRIIPPTTIIOONN kk__hhaassaaffss() initializes some library internal structures, and tests for the presence of AFS in the kernel, none of the other functions should be called before kk__hhaassaaffss() is called, or if it fails. kkaaffss__sseett__vveerrbboossee() set a log function that will be called each time the kafs library does something important so that the application using libkafs can output verbose logging. Calling the function _k_a_f_s___s_e_t___v_e_r_b_o_s_e with the function argument set to NULL will stop libkafs from calling the logging function (if set). kkaaffss__sseettttookkeenn__rrxxkkaadd() set rxkad with the _t_o_k_e_n and _t_i_c_k_e_t (that have the length _t_i_c_k_e_t___l_e_n) for a given _c_e_l_l. kkaaffss__sseettttookkeenn() and kkaaffss__sseettttookkeenn55() work the same way as kkaaffss__sseettttookkeenn__rrxxkkaadd() but internally converts the Kerberos 4 or 5 creden- tial to a afs cleartoken and ticket. kkrrbb__aaffsslloogg(), and kkrrbb__aaffsslloogg__uuiidd() obtains new tokens (and possibly tick- ets) for the specified _c_e_l_l and _r_e_a_l_m. If _c_e_l_l is NULL, the local cell is used. If _r_e_a_l_m is NULL, the function tries to guess what realm to use. Unless you have some good knowledge of what cell or realm to use, you should pass NULL. kkrrbb__aaffsslloogg() will use the real user-id for the ViceId field in the token, kkrrbb__aaffsslloogg__uuiidd() will use _u_i_d. kkrrbb55__aaffsslloogg(), and kkrrbb55__aaffsslloogg__uuiidd() are the Kerberos 5 equivalents of kkrrbb__aaffsslloogg(), and kkrrbb__aaffsslloogg__uuiidd(). kkrrbb55__aaffsslloogg(), kkaaffss__sseettttookkeenn55() can be configured to behave diffrently via a kkrrbb55__aappppddeeffaauulltt option afs-use-524 in _k_r_b_5_._c_o_n_f. Possible values for afs-use-524 are: yes use the 524 server in the realm to convert the ticket no use the Kerberos 5 ticket directly, can be used with if the afs cell support 2b token. local, 2b convert the Kerberos 5 credential to a 2b token locally (the same work as a 2b 524 server should have done). Example: [appdefaults] SU.SE = { afs-use-524 = local } PDC.KTH.SE = { afs-use-524 = yes } afs-use-524 = yes libkafs will use the libkafs as application name when running the kkrrbb55__aappppddeeffaauulltt function call. The (uppercased) cellname is used as the realm to the kkrrbb55__aappppddeeffaauulltt ffuunnccttiioonn.. kk__aaffss__cceellll__ooff__ffiillee() will in _c_e_l_l return the cell of a specified file, no more than _l_e_n characters is put in _c_e_l_l. kk__ppiiooccttll() does a ppiiooccttll() syscall with the specified arguments. This function is equivalent to llppiiooccttll(). kk__sseettppaagg() initializes a new PAG. kk__uunnlloogg() removes destroys all tokens in the current PAG. RREETTUURRNN VVAALLUUEESS kk__hhaassaaffss() returns 1 if AFS is present in the kernel, 0 otherwise. kkrrbb__aaffsslloogg() and kkrrbb__aaffsslloogg__uuiidd() returns 0 on success, or a Kerberos er- ror number on failure. kk__aaffss__cceellll__ooff__ffiillee(), kk__ppiiooccttll(), kk__sseettppaagg(), and kk__uunnlloogg() all return the value of the underlaying system call, 0 on suc- cess. EENNVVIIRROONNMMEENNTT The following environment variable affect the mode of operation of kkaaffss: AFS_SYSCALL Normally, kkaaffss will try to figure out the correct system call(s) that are used by AFS by itself. If it does not man- age to do that, or does it incorrectly, you can set this variable to the system call number or list of system call numbers that should be used. EEXXAAMMPPLLEESS The following code from llooggiinn will obtain a new PAG and tokens for the local cell and the cell of the users home directory. if (k_hasafs()) { char cell[64]; k_setpag(); if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0) krb_afslog(cell, NULL); krb_afslog(NULL, NULL); } EERRRROORRSS If any of these functions (apart from kk__hhaassaaffss()) is called without AFS being present in the kernel, the process will usually (depending on the operating system) receive a SIGSYS signal. SSEEEE AALLSSOO Transarc Corporation, "File Server/Cache Manager Interface", _A_F_S_-_3 _P_r_o_g_r_a_m_m_e_r_'_s _R_e_f_e_r_e_n_c_e, 1991. krb5_appdefaults(3), krb5.conf(5) BBUUGGSS AFS_SYSCALL has no effect under AIX. HEIMDAL Mar 17, 2003 3