1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
KAFS(3) BSD Library Functions Manual KAFS(3)
NNAAMMEE
kk__hhaassaaffss, kk__hhaassaaffss__rreecchheecckk, 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
##iinncclluuddee <<kkaaffss..hh>>
_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__hhaassaaffss__rreecchheecckk(_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.
kk__hhaassaaffss__rreecchheecckk() forces a recheck if a AFS client has started since
last time kk__hhaassaaffss() or kk__hhaassaaffss__rreecchheecckk() was called.
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 differently
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) cell name 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() system call 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
error 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
success.
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
krb5_appdefault(3), krb5.conf(5)
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.
FFIILLEESS
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-
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,
_/_e_t_c_/_a_r_l_a, and _/_e_t_c_/_a_f_s
BBUUGGSS
AFS_SYSCALL has no effect under AIX.
HEIMDAL May 1, 2006 HEIMDAL
|