xref: /freebsd/crypto/heimdal/lib/kafs/kafs.3 (revision 8373020d34ceb1ac55d8f43333c1ca3680185b39)
18373020dSJacques Vidrine.\"	$Id: kafs.3,v 1.8 2002/08/28 20:04:31 joda Exp $
2b528cefcSMark Murray.\"
3b528cefcSMark Murray.Dd May 7, 1997
4b528cefcSMark Murray.Os KTH-KRB
5b528cefcSMark Murray.Dt KAFS 3
6b528cefcSMark Murray.Sh NAME
7b528cefcSMark Murray.Nm k_hasafs ,
8b528cefcSMark Murray.Nm k_pioctl ,
9b528cefcSMark Murray.Nm k_unlog ,
10b528cefcSMark Murray.Nm k_setpag ,
11b528cefcSMark Murray.Nm k_afs_cell_of_file ,
12b528cefcSMark Murray.Nm krb_afslog ,
13b528cefcSMark Murray.Nm krb_afslog_uid
145e9cd1aeSAssar Westerlund.\" .Nm krb5_afslog ,
155e9cd1aeSAssar Westerlund.\" .Nm krb5_afslog_uid
16b528cefcSMark Murray.Nd AFS library
178373020dSJacques Vidrine.Sh LIBRARY
188373020dSJacques VidrineAFS cache manager access library (libkafs, -lkafs)
19b528cefcSMark Murray.Sh SYNOPSIS
20b528cefcSMark Murray.Fd #include <kafs.h>
21b528cefcSMark Murray.Ft int
22b528cefcSMark Murray.Fn k_afs_cell_of_file "const char *path" "char *cell" "int len"
23b528cefcSMark Murray.Ft int
24b528cefcSMark Murray.Fn k_hasafs
25b528cefcSMark Murray.Ft int
26b528cefcSMark Murray.Fn k_pioctl "char *a_path" "int o_opcode" "struct ViceIoctl *a_paramsP" "int a_followSymlinks"
27b528cefcSMark Murray.Ft int
28b528cefcSMark Murray.Fn k_setpag
29b528cefcSMark Murray.Ft int
30b528cefcSMark Murray.Fn k_unlog
31b528cefcSMark Murray.Ft int
32b528cefcSMark Murray.Fn krb_afslog "char *cell" "char *realm"
33b528cefcSMark Murray.Ft int
34b528cefcSMark Murray.Fn krb_afslog_uid "char *cell" "char *realm" "uid_t uid"
355e9cd1aeSAssar Westerlund.\" .Ft krb5_error_code
365e9cd1aeSAssar Westerlund.\" .Fn krb5_afslog_uid "krb5_context context" "krb5_ccache id" "const char *cell" "krb5_const_realm realm" "uid_t uid"
375e9cd1aeSAssar Westerlund.\" .Ft krb5_error_code
385e9cd1aeSAssar Westerlund.\" .Fn krb5_afslog "krb5_context context" "krb5_ccache id" "const char *cell" "krb5_const_realm realm"
39b528cefcSMark Murray.Sh DESCRIPTION
40b528cefcSMark Murray.Fn k_hasafs
41b528cefcSMark Murrayinitializes some library internal structures, and tests for the
424137ff4cSJacques Vidrinepresence of AFS in the kernel, none of the other functions should be
43b528cefcSMark Murraycalled before
44b528cefcSMark Murray.Fn k_hasafs
45b528cefcSMark Murrayis called, or if it fails.
465e9cd1aeSAssar Westerlund.Pp
47b528cefcSMark Murray.Fn krb_afslog ,
48b528cefcSMark Murrayand
49b528cefcSMark Murray.Fn krb_afslog_uid
50b528cefcSMark Murrayobtains new tokens (and possibly tickets) for the specified
51b528cefcSMark Murray.Fa cell
52b528cefcSMark Murrayand
53b528cefcSMark Murray.Fa realm .
54b528cefcSMark MurrayIf
55b528cefcSMark Murray.Fa cell
56b528cefcSMark Murrayis
57b528cefcSMark Murray.Dv NULL ,
58b528cefcSMark Murraythe local cell is used. If
59b528cefcSMark Murray.Fa realm
60b528cefcSMark Murrayis
61b528cefcSMark Murray.Dv NULL ,
62b528cefcSMark Murraythe function tries to guess what realm to use. Unless you  have some good knowledge of what cell or realm to use, you should pass
63b528cefcSMark Murray.Dv NULL .
64b528cefcSMark Murray.Fn krb_afslog
65b528cefcSMark Murraywill use the real user-id for the
66b528cefcSMark Murray.Dv ViceId
67b528cefcSMark Murrayfield in the token,
68b528cefcSMark Murray.Fn krb_afslog_uid
69b528cefcSMark Murraywill use
70b528cefcSMark Murray.Fa uid .
715e9cd1aeSAssar Westerlund.Pp
725e9cd1aeSAssar Westerlund.\" .Fn krb5_afslog ,
735e9cd1aeSAssar Westerlund.\" and
745e9cd1aeSAssar Westerlund.\" .Fn krb5_afslog_uid
755e9cd1aeSAssar Westerlund.\" are the Kerberos 5 equivalents of
765e9cd1aeSAssar Westerlund.\" .Fn krb_afslog ,
775e9cd1aeSAssar Westerlund.\" and
785e9cd1aeSAssar Westerlund.\" .Fn krb_afslog_uid .
795e9cd1aeSAssar Westerlund.\" The extra arguments are the ubiquitous context, and the cache id where
805e9cd1aeSAssar Westerlund.\" to store any obtained tickets. Since AFS servers normally can't handle
815e9cd1aeSAssar Westerlund.\" Kerberos 5 tickets directly, these functions will first obtain version
825e9cd1aeSAssar Westerlund.\" 5 tickets for the requested cells, and then convert them to version 4
835e9cd1aeSAssar Westerlund.\" tickets, that can be stashed in the kernel. To convert tickets the
845e9cd1aeSAssar Westerlund.\" .Fn krb524_convert_creds_kdc
855e9cd1aeSAssar Westerlund.\" function will be used.
865e9cd1aeSAssar Westerlund.\" .Pp
87b528cefcSMark Murray.Fn k_afs_cell_of_file
88b528cefcSMark Murraywill in
89b528cefcSMark Murray.Fa cell
90b528cefcSMark Murrayreturn the cell of a specified file, no more than
91b528cefcSMark Murray.Fa len
92b528cefcSMark Murraycharacters is put in
93b528cefcSMark Murray.Fa cell .
945e9cd1aeSAssar Westerlund.Pp
95b528cefcSMark Murray.Fn k_pioctl
96b528cefcSMark Murraydoes a
97b528cefcSMark Murray.Fn pioctl
98b528cefcSMark Murraysyscall with the specified arguments. This function is equivalent to
99b528cefcSMark Murray.Fn lpioctl .
1005e9cd1aeSAssar Westerlund.Pp
101b528cefcSMark Murray.Fn k_setpag
102b528cefcSMark Murrayinitializes a new PAG.
1035e9cd1aeSAssar Westerlund.Pp
104b528cefcSMark Murray.Fn k_unlog
105b528cefcSMark Murrayremoves destroys all tokens in the current PAG.
106b528cefcSMark Murray.Sh RETURN VALUES
107b528cefcSMark Murray.Fn k_hasafs
108b528cefcSMark Murrayreturns 1 if AFS is present in the kernel, 0 otherwise.
109b528cefcSMark Murray.Fn krb_afslog
110b528cefcSMark Murrayand
111b528cefcSMark Murray.Fn krb_afslog_uid
112b528cefcSMark Murrayreturns 0 on success, or a kerberos error number on failure.
113b528cefcSMark Murray.Fn k_afs_cell_of_file ,
114b528cefcSMark Murray.Fn k_pioctl ,
115b528cefcSMark Murray.Fn k_setpag ,
116b528cefcSMark Murrayand
117b528cefcSMark Murray.Fn k_unlog
118b528cefcSMark Murrayall return the value of the underlaying system call, 0 on success.
1198373020dSJacques Vidrine.Sh ENVIRONMENT
1208373020dSJacques VidrineThe following environment variable affect the mode of operation of
1218373020dSJacques Vidrine.Nm kafs :
1228373020dSJacques Vidrine.Bl -tag -width AFS_SYSCALL
1238373020dSJacques Vidrine.It Ev AFS_SYSCALL
1248373020dSJacques VidrineNormally,
1258373020dSJacques Vidrine.Nm kafs
1268373020dSJacques Vidrinewill try to figure out the correct system call(s) that are used by AFS
1278373020dSJacques Vidrineby itself.  If it does not manage to do that, or does it incorrectly,
1288373020dSJacques Vidrineyou can set this variable to the system call number or list of system
1298373020dSJacques Vidrinecall numbers that should be used.
1308373020dSJacques Vidrine.El
131b528cefcSMark Murray.Sh EXAMPLES
132b528cefcSMark MurrayThe following code from
133b528cefcSMark Murray.Nm login
134b528cefcSMark Murraywill obtain a new PAG and tokens for the local cell and the cell of
135b528cefcSMark Murraythe users home directory.
136b528cefcSMark Murray.Bd -literal
137b528cefcSMark Murrayif (k_hasafs()) {
138b528cefcSMark Murray	char cell[64];
139b528cefcSMark Murray	k_setpag();
140b528cefcSMark Murray	if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0)
141b528cefcSMark Murray		krb_afslog(cell, NULL);
142b528cefcSMark Murray	krb_afslog(NULL, NULL);
143b528cefcSMark Murray}
144b528cefcSMark Murray.Ed
145b528cefcSMark Murray.Sh ERRORS
1464137ff4cSJacques VidrineIf any of these functions (apart from
147b528cefcSMark Murray.Fn k_hasafs )
148b528cefcSMark Murrayis called without AFS beeing present in the kernel, the process will
149b528cefcSMark Murrayusually (depending on the operating system) receive a SIGSYS signal.
150b528cefcSMark Murray.Sh SEE ALSO
151b528cefcSMark Murray.Rs
152b528cefcSMark Murray.%A Transarc Corporation
153b528cefcSMark Murray.%J AFS-3 Programmer's Reference
154b528cefcSMark Murray.%T File Server/Cache Manager Interface
155b528cefcSMark Murray.%D 1991
156b528cefcSMark Murray.Re
157b528cefcSMark Murray.Sh BUGS
158b528cefcSMark Murray.Ev AFS_SYSCALL
159b528cefcSMark Murrayhas no effect under AIX.
160