1KAFS(3) BSD Library Functions Manual KAFS(3)
2
4 k_hasafs, k_pioctl, k_unlog, k_setpag, k_afs_cell_of_file, krb_afslog,
5 krb_afslog_uid — AFS library
6
8 AFS cache manager access library (libkrbafs, -lkrbafs)
9
11 #include <krbafs.h>
12
13 int
14 k_afs_cell_of_file(const char *path, char *cell, int len);
15
16 int
17 k_hasafs();
18
19 int
20 k_pioctl(char *a_path, int o_opcode, struct ViceIoctl *a_paramsP,
21 int a_followSymlinks);
22
23 int
24 k_setpag();
25
26 int
27 k_unlog();
28
29 int
30 krb_afslog(char *cell, char *realm);
31
32 int
33 krb_afslog_uid(char *cell, char *realm, uid_t uid);
34
36 k_hasafs() initializes some library internal structures, and tests for
37 the presence of AFS in the kernel, none of the other functions should be
38 called before k_hasafs() is called, or if it fails.
39
40 krb_afslog(), and krb_afslog_uid() obtains new tokens (and possibly tick‐
41 ets) for the specified cell and realm. If cell is NULL, the local cell
42 is used. If realm is NULL, the function tries to guess what realm to use.
43 Unless you have some good knowledge of what cell or realm to use, you
44 should pass NULL. krb_afslog() will use the real user-id for the ViceId
45 field in the token, krb_afslog_uid() will use uid.
46
47 k_afs_cell_of_file() will in cell return the cell of a specified file, no
48 more than len characters is put in cell.
49
50 k_pioctl() does a pioctl() syscall with the specified arguments. This
51 function is equivalent to lpioctl().
52
53 k_setpag() initializes a new PAG.
54
55 k_unlog() removes destroys all tokens in the current PAG.
56
58 k_hasafs() returns 1 if AFS is present in the kernel, 0 otherwise.
59 krb_afslog() and krb_afslog_uid() returns 0 on success, or a kerberos
60 error number on failure. k_afs_cell_of_file(), k_pioctl(), k_setpag(),
61 and k_unlog() all return the value of the underlaying system call, 0 on
62 success.
63
65 The following environment variable affect the mode of operation of
66 krbafs:
67
68 AFS_SYSCALL Normally, krbafs will try to figure out the correct system
69 call(s) that are used by AFS by itself. If it does not man‐
70 age to do that, or does it incorrectly, you can set this
71 variable to the system call number or list of system call
72 numbers that should be used.
73
75 The following code from login will obtain a new PAG and tokens for the
76 local cell and the cell of the users home directory.
77
78 if (k_hasafs()) {
79 char cell[64];
80 k_setpag();
81 if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0)
82 krb_afslog(cell, NULL);
83 krb_afslog(NULL, NULL);
84 }
85
87 If any of these functions (apart from k_hasafs()) is called without AFS
88 beeing present in the kernel, the process will usually (depending on the
89 operating system) receive a SIGSYS signal.
90
92 Transarc Corporation, "File Server/Cache Manager Interface", AFS-3
93 Programmer's Reference, 1991.
94
96 AFS_SYSCALL has no effect under AIX.
97
98KTH-KRB May 7, 1997 KTH-KRB