| 1 |
|
|---|
| 2 | KAFS(3) BSD Library Functions Manual KAFS(3)
|
|---|
| 3 |
|
|---|
| 4 | NNAAMMEE
|
|---|
| 5 | kk__hhaassaaffss, kk__hhaassaaffss__rreecchheecckk, kk__ppiiooccttll, kk__uunnlloogg, kk__sseettppaagg,
|
|---|
| 6 | kk__aaffss__cceellll__ooff__ffiillee, kkaaffss__sseett__vveerrbboossee, kkaaffss__sseettttookkeenn__rrxxkkaadd, kkaaffss__sseettttookkeenn,
|
|---|
| 7 | kkrrbb__aaffsslloogg, kkrrbb__aaffsslloogg__uuiidd, kkaaffss__sseettttookkeenn55, kkrrbb55__aaffsslloogg, kkrrbb55__aaffsslloogg__uuiidd
|
|---|
| 8 | -- AFS library
|
|---|
| 9 |
|
|---|
| 10 | LLIIBBRRAARRYY
|
|---|
| 11 | AFS cache manager access library (libkafs, -lkafs)
|
|---|
| 12 |
|
|---|
| 13 | SSYYNNOOPPSSIISS
|
|---|
| 14 | ##iinncclluuddee <<kkaaffss..hh>>
|
|---|
| 15 |
|
|---|
| 16 | _i_n_t
|
|---|
| 17 | 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);
|
|---|
| 18 |
|
|---|
| 19 | _i_n_t
|
|---|
| 20 | kk__hhaassaaffss(_v_o_i_d);
|
|---|
| 21 |
|
|---|
| 22 | _i_n_t
|
|---|
| 23 | kk__hhaassaaffss__rreecchheecckk(_v_o_i_d);
|
|---|
| 24 |
|
|---|
| 25 | _i_n_t
|
|---|
| 26 | 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,
|
|---|
| 27 | _i_n_t _a___f_o_l_l_o_w_S_y_m_l_i_n_k_s);
|
|---|
| 28 |
|
|---|
| 29 | _i_n_t
|
|---|
| 30 | kk__sseettppaagg(_v_o_i_d);
|
|---|
| 31 |
|
|---|
| 32 | _i_n_t
|
|---|
| 33 | kk__uunnlloogg(_v_o_i_d);
|
|---|
| 34 |
|
|---|
| 35 | _v_o_i_d
|
|---|
| 36 | 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 _*);
|
|---|
| 37 |
|
|---|
| 38 | _i_n_t
|
|---|
| 39 | 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,
|
|---|
| 40 | _v_o_i_d _*_t_i_c_k_e_t, _s_i_z_e___t _t_i_c_k_e_t___l_e_n);
|
|---|
| 41 |
|
|---|
| 42 | _i_n_t
|
|---|
| 43 | 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);
|
|---|
| 44 |
|
|---|
| 45 | kkrrbb__aaffsslloogg(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m);
|
|---|
| 46 |
|
|---|
| 47 | _i_n_t
|
|---|
| 48 | 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);
|
|---|
| 49 |
|
|---|
| 50 | _k_r_b_5___e_r_r_o_r___c_o_d_e
|
|---|
| 51 | 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,
|
|---|
| 52 | _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);
|
|---|
| 53 |
|
|---|
| 54 | _i_n_t
|
|---|
| 55 | 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);
|
|---|
| 56 |
|
|---|
| 57 | _k_r_b_5___e_r_r_o_r___c_o_d_e
|
|---|
| 58 | 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,
|
|---|
| 59 | _k_r_b_5___c_o_n_s_t___r_e_a_l_m _r_e_a_l_m);
|
|---|
| 60 |
|
|---|
| 61 | DDEESSCCRRIIPPTTIIOONN
|
|---|
| 62 | kk__hhaassaaffss() initializes some library internal structures, and tests for
|
|---|
| 63 | the presence of AFS in the kernel, none of the other functions should be
|
|---|
| 64 | called before kk__hhaassaaffss() is called, or if it fails.
|
|---|
| 65 |
|
|---|
| 66 | kk__hhaassaaffss__rreecchheecckk() forces a recheck if a AFS client has started since
|
|---|
| 67 | last time kk__hhaassaaffss() or kk__hhaassaaffss__rreecchheecckk() was called.
|
|---|
| 68 |
|
|---|
| 69 | kkaaffss__sseett__vveerrbboossee() set a log function that will be called each time the
|
|---|
| 70 | kafs library does something important so that the application using
|
|---|
| 71 | libkafs can output verbose logging. Calling the function
|
|---|
| 72 | _k_a_f_s___s_e_t___v_e_r_b_o_s_e with the function argument set to NULL will stop libkafs
|
|---|
| 73 | from calling the logging function (if set).
|
|---|
| 74 |
|
|---|
| 75 | kkaaffss__sseettttookkeenn__rrxxkkaadd() set rxkad with the _t_o_k_e_n and _t_i_c_k_e_t (that have the
|
|---|
| 76 | length _t_i_c_k_e_t___l_e_n) for a given _c_e_l_l.
|
|---|
| 77 |
|
|---|
| 78 | kkaaffss__sseettttookkeenn() and kkaaffss__sseettttookkeenn55() work the same way as
|
|---|
| 79 | kkaaffss__sseettttookkeenn__rrxxkkaadd() but internally converts the Kerberos 4 or 5 creden-
|
|---|
| 80 | tial to a afs cleartoken and ticket.
|
|---|
| 81 |
|
|---|
| 82 | kkrrbb__aaffsslloogg(), and kkrrbb__aaffsslloogg__uuiidd() obtains new tokens (and possibly tick-
|
|---|
| 83 | ets) for the specified _c_e_l_l and _r_e_a_l_m. If _c_e_l_l is NULL, the local cell
|
|---|
| 84 | is used. If _r_e_a_l_m is NULL, the function tries to guess what realm to use.
|
|---|
| 85 | Unless you have some good knowledge of what cell or realm to use, you
|
|---|
| 86 | should pass NULL. kkrrbb__aaffsslloogg() will use the real user-id for the ViceId
|
|---|
| 87 | field in the token, kkrrbb__aaffsslloogg__uuiidd() will use _u_i_d.
|
|---|
| 88 |
|
|---|
| 89 | kkrrbb55__aaffsslloogg(), and kkrrbb55__aaffsslloogg__uuiidd() are the Kerberos 5 equivalents of
|
|---|
| 90 | kkrrbb__aaffsslloogg(), and kkrrbb__aaffsslloogg__uuiidd().
|
|---|
| 91 |
|
|---|
| 92 | kkrrbb55__aaffsslloogg(), kkaaffss__sseettttookkeenn55() can be configured to behave differently
|
|---|
| 93 | via a kkrrbb55__aappppddeeffaauulltt option afs-use-524 in _k_r_b_5_._c_o_n_f. Possible values
|
|---|
| 94 | for afs-use-524 are:
|
|---|
| 95 |
|
|---|
| 96 | yes use the 524 server in the realm to convert the ticket
|
|---|
| 97 |
|
|---|
| 98 | no use the Kerberos 5 ticket directly, can be used with if the afs
|
|---|
| 99 | cell support 2b token.
|
|---|
| 100 |
|
|---|
| 101 | local, 2b
|
|---|
| 102 | convert the Kerberos 5 credential to a 2b token locally (the same
|
|---|
| 103 | work as a 2b 524 server should have done).
|
|---|
| 104 |
|
|---|
| 105 | Example:
|
|---|
| 106 |
|
|---|
| 107 | [appdefaults]
|
|---|
| 108 | SU.SE = { afs-use-524 = local }
|
|---|
| 109 | PDC.KTH.SE = { afs-use-524 = yes }
|
|---|
| 110 | afs-use-524 = yes
|
|---|
| 111 |
|
|---|
| 112 | libkafs will use the libkafs as application name when running the
|
|---|
| 113 | kkrrbb55__aappppddeeffaauulltt function call.
|
|---|
| 114 |
|
|---|
| 115 | The (uppercased) cell name is used as the realm to the kkrrbb55__aappppddeeffaauulltt
|
|---|
| 116 | ffuunnccttiioonn..
|
|---|
| 117 |
|
|---|
| 118 | kk__aaffss__cceellll__ooff__ffiillee() will in _c_e_l_l return the cell of a specified file, no
|
|---|
| 119 | more than _l_e_n characters is put in _c_e_l_l.
|
|---|
| 120 |
|
|---|
| 121 | kk__ppiiooccttll() does a ppiiooccttll() system call with the specified arguments. This
|
|---|
| 122 | function is equivalent to llppiiooccttll().
|
|---|
| 123 |
|
|---|
| 124 | kk__sseettppaagg() initializes a new PAG.
|
|---|
| 125 |
|
|---|
| 126 | kk__uunnlloogg() removes destroys all tokens in the current PAG.
|
|---|
| 127 |
|
|---|
| 128 | RREETTUURRNN VVAALLUUEESS
|
|---|
| 129 | kk__hhaassaaffss() returns 1 if AFS is present in the kernel, 0 otherwise.
|
|---|
| 130 | kkrrbb__aaffsslloogg() and kkrrbb__aaffsslloogg__uuiidd() returns 0 on success, or a Kerberos
|
|---|
| 131 | error number on failure. kk__aaffss__cceellll__ooff__ffiillee(), kk__ppiiooccttll(), kk__sseettppaagg(),
|
|---|
| 132 | and kk__uunnlloogg() all return the value of the underlaying system call, 0 on
|
|---|
| 133 | success.
|
|---|
| 134 |
|
|---|
| 135 | EENNVVIIRROONNMMEENNTT
|
|---|
| 136 | The following environment variable affect the mode of operation of kkaaffss:
|
|---|
| 137 |
|
|---|
| 138 | AFS_SYSCALL Normally, kkaaffss will try to figure out the correct system
|
|---|
| 139 | call(s) that are used by AFS by itself. If it does not man-
|
|---|
| 140 | age to do that, or does it incorrectly, you can set this
|
|---|
| 141 | variable to the system call number or list of system call
|
|---|
| 142 | numbers that should be used.
|
|---|
| 143 |
|
|---|
| 144 | EEXXAAMMPPLLEESS
|
|---|
| 145 | The following code from llooggiinn will obtain a new PAG and tokens for the
|
|---|
| 146 | local cell and the cell of the users home directory.
|
|---|
| 147 |
|
|---|
| 148 | if (k_hasafs()) {
|
|---|
| 149 | char cell[64];
|
|---|
| 150 | k_setpag();
|
|---|
| 151 | if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0)
|
|---|
| 152 | krb_afslog(cell, NULL);
|
|---|
| 153 | krb_afslog(NULL, NULL);
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | EERRRROORRSS
|
|---|
| 157 | If any of these functions (apart from kk__hhaassaaffss()) is called without AFS
|
|---|
| 158 | being present in the kernel, the process will usually (depending on the
|
|---|
| 159 | operating system) receive a SIGSYS signal.
|
|---|
| 160 |
|
|---|
| 161 | SSEEEE AALLSSOO
|
|---|
| 162 | krb5_appdefault(3), krb5.conf(5)
|
|---|
| 163 |
|
|---|
| 164 | Transarc Corporation, "File Server/Cache Manager Interface", _A_F_S_-_3
|
|---|
| 165 | _P_r_o_g_r_a_m_m_e_r_'_s _R_e_f_e_r_e_n_c_e, 1991.
|
|---|
| 166 |
|
|---|
| 167 | FFIILLEESS
|
|---|
| 168 | libkafs will search for _T_h_i_s_C_e_l_l _a_n_d _T_h_e_s_e_C_e_l_l_s in the following loca-
|
|---|
| 169 | tions: _/_u_s_r_/_v_i_c_e_/_e_t_c, _/_e_t_c_/_o_p_e_n_a_f_s, _/_v_a_r_/_d_b_/_o_p_e_n_a_f_s_/_e_t_c, _/_u_s_r_/_a_r_l_a_/_e_t_c,
|
|---|
| 170 | _/_e_t_c_/_a_r_l_a, and _/_e_t_c_/_a_f_s
|
|---|
| 171 |
|
|---|
| 172 | BBUUGGSS
|
|---|
| 173 | AFS_SYSCALL has no effect under AIX.
|
|---|
| 174 |
|
|---|
| 175 | HEIMDAL May 1, 2006 HEIMDAL
|
|---|