1 .\" $NetBSD: kafs.3,v 1.1.1.3 2014/04/24 12:45:49 pettai Exp $
3 .\" Copyright (c) 1998 - 2006 Kungliga Tekniska Högskolan
4 .\" (Royal Institute of Technology, Stockholm, Sweden).
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the Institute nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 .Nm k_hasafs_recheck ,
45 .Nm k_afs_cell_of_file ,
46 .Nm kafs_set_verbose ,
47 .Nm kafs_settoken_rxkad ,
56 AFS cache manager access library (libkafs, -lkafs)
60 .Fn k_afs_cell_of_file "const char *path" "char *cell" "int len"
64 .Fn k_hasafs_recheck "void"
66 .Fn k_pioctl "char *a_path" "int o_opcode" "struct ViceIoctl *a_paramsP" "int a_followSymlinks"
72 .Fn kafs_set_verbose "void (*func)(void *, const char *, int)" "void *"
74 .Fn kafs_settoken_rxkad "const char *cell" "struct ClearToken *token" "void *ticket" "size_t ticket_len"
76 .Fn kafs_settoken "const char *cell" "uid_t uid" "CREDENTIALS *c"
77 .Fn krb_afslog "char *cell" "char *realm"
79 .Fn krb_afslog_uid "char *cell" "char *realm" "uid_t uid"
81 .Fn krb5_afslog_uid "krb5_context context" "krb5_ccache id" "const char *cell" "krb5_const_realm realm" "uid_t uid"
83 .Fn kafs_settoken5 "const char *cell" "uid_t uid" "krb5_creds *c"
85 .Fn krb5_afslog "krb5_context context" "krb5_ccache id" "const char *cell" "krb5_const_realm realm"
88 initializes some library internal structures, and tests for the
89 presence of AFS in the kernel, none of the other functions should be
92 is called, or if it fails.
95 forces a recheck if a AFS client has started since last time
102 set a log function that will be called each time the kafs library does
103 something important so that the application using libkafs can output
107 with the function argument set to
109 will stop libkafs from calling the logging function (if set).
111 .Fn kafs_settoken_rxkad
118 (that have the length
127 .Fn kafs_settoken_rxkad
128 but internally converts the Kerberos 4 or 5 credential to a afs
129 cleartoken and ticket.
134 obtains new tokens (and possibly tickets) for the specified
142 the local cell is used. If
146 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
149 will use the real user-id for the
159 are the Kerberos 5 equivalents of
166 can be configured to behave differently via a
175 .Bl -tag -width local
177 use the 524 server in the realm to convert the ticket
179 use the Kerberos 5 ticket directly, can be used with if the afs cell
182 convert the Kerberos 5 credential to a 2b token locally (the same work
183 as a 2b 524 server should have done).
190 SU.SE = { afs-use-524 = local }
191 PDC.KTH.SE = { afs-use-524 = yes }
197 as application name when running the
201 The (uppercased) cell name is used as the realm to the
202 .Nm krb5_appdefault function.
204 .\" The extra arguments are the ubiquitous context, and the cache id where
205 .\" to store any obtained tickets. Since AFS servers normally can't handle
206 .\" Kerberos 5 tickets directly, these functions will first obtain version
207 .\" 5 tickets for the requested cells, and then convert them to version 4
208 .\" tickets, that can be stashed in the kernel. To convert tickets the
209 .\" .Fn krb524_convert_creds_kdc
210 .\" function will be used.
212 .Fn k_afs_cell_of_file
215 return the cell of a specified file, no more than
223 system call with the specified arguments. This function is equivalent to
227 initializes a new PAG.
230 removes destroys all tokens in the current PAG.
233 returns 1 if AFS is present in the kernel, 0 otherwise.
237 returns 0 on success, or a Kerberos error number on failure.
238 .Fn k_afs_cell_of_file ,
243 all return the value of the underlaying system call, 0 on success.
245 The following environment variable affect the mode of operation of
247 .Bl -tag -width AFS_SYSCALL
251 will try to figure out the correct system call(s) that are used by AFS
252 by itself. If it does not manage to do that, or does it incorrectly,
253 you can set this variable to the system call number or list of system
254 call numbers that should be used.
257 The following code from
259 will obtain a new PAG and tokens for the local cell and the cell of
260 the users home directory.
265 if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0)
266 krb_afslog(cell, NULL);
267 krb_afslog(NULL, NULL);
271 If any of these functions (apart from
273 is called without AFS being present in the kernel, the process will
274 usually (depending on the operating system) receive a SIGSYS signal.
276 .Xr krb5_appdefault 3 ,
279 .%A Transarc Corporation
280 .%J AFS-3 Programmer's Reference
281 .%T File Server/Cache Manager Interface
285 libkafs will search for
288 in the following locations:
291 .Pa /var/db/openafs/etc ,
298 has no effect under AIX.