1 .\" Copyright (c) 2004 - 2005 Kungliga Tekniska Högskolan
2 .\" (Royal Institute of Technology, Stockholm, Sweden).
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the Institute nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Dt KRB5_GET_CREDENTIALS 3
38 .Nm krb5_get_credentials ,
39 .Nm krb5_get_credentials_with_flags ,
40 .Nm krb5_get_cred_from_kdc ,
41 .Nm krb5_get_cred_from_kdc_opt ,
42 .Nm krb5_get_kdc_cred ,
43 .Nm krb5_get_renewed_creds
44 .Nd get credentials from the KDC using krbtgt
46 Kerberos 5 Library (libkrb5, -lkrb5)
50 .Fo krb5_get_credentials
51 .Fa "krb5_context context"
52 .Fa "krb5_flags options"
53 .Fa "krb5_ccache ccache"
54 .Fa "krb5_creds *in_creds"
55 .Fa "krb5_creds **out_creds"
58 .Fo krb5_get_credentials_with_flags
59 .Fa "krb5_context context"
60 .Fa "krb5_flags options"
61 .Fa "krb5_kdc_flags flags"
62 .Fa "krb5_ccache ccache"
63 .Fa "krb5_creds *in_creds"
64 .Fa "krb5_creds **out_creds"
67 .Fo krb5_get_cred_from_kdc
68 .Fa "krb5_context context"
69 .Fa "krb5_ccache ccache"
70 .Fa "krb5_creds *in_creds"
71 .Fa "krb5_creds **out_creds"
72 .Fa "krb5_creds ***ret_tgts"
75 .Fo krb5_get_cred_from_kdc_opt
76 .Fa "krb5_context context"
77 .Fa "krb5_ccache ccache"
78 .Fa "krb5_creds *in_creds"
79 .Fa "krb5_creds **out_creds"
80 .Fa "krb5_creds ***ret_tgts"
81 .Fa "krb5_flags flags"
85 .Fa "krb5_context context"
87 .Fa "krb5_kdc_flags flags"
88 .Fa "krb5_addresses *addresses"
89 .Fa "Ticket *second_ticket"
90 .Fa "krb5_creds *in_creds"
91 .Fa "krb5_creds **out_creds"
94 .Fo krb5_get_renewed_creds
95 .Fa "krb5_context context"
96 .Fa "krb5_creds *creds"
97 .Fa "krb5_const_principal client"
98 .Fa "krb5_ccache ccache"
99 .Fa "const char *in_tkt_service"
102 .Fn krb5_get_credentials_with_flags
103 get credentials specified by
109 structure is ignored)
110 by first looking in the
112 and if doesn't exists or is expired, fetch the credential from the KDC
115 The credential is returned in
117 and should be freed using the function
118 .Fn krb5_free_creds .
120 Valid flags to pass into
124 .Bl -tag -width "KRB5_GC_USER_USER" -compact
128 don't got out on network to fetch credential.
129 .It KRB5_GC_USER_USER
130 Request a user to user ticket.
131 This option doesn't store the resulting user to user credential in
134 .It KRB5_GC_EXPIRED_OK
135 returns the credential even if it is expired, default behavior is trying
136 to refetch the credential from the KDC.
140 are KDCOptions, note the caller must fill in the bit-field and not
141 use the integer associated structure.
143 .Fn krb5_get_credentials
144 works the same way as
145 .Fn krb5_get_credentials_with_flags
150 .Fn krb5_get_cred_from_kdc
152 .Fn krb5_get_cred_from_kdc_opt
153 fetches the credential from the KDC very much like
154 .Fn krb5_get_credentials, but doesn't look in the
156 if the credential exists there first.
158 .Fn krb5_get_kdc_cred
159 does the same as the functions above, but the caller must fill in all
160 the information andits closer to the wire protocol.
162 .Fn krb5_get_renewed_creds
163 renews a credential given by
169 using the credential cache
171 The result is stored in
173 and should be freed using
174 .Fa krb5_free_creds .
176 Here is a example function that get a credential from a credential cache
178 or the KDC and returns it to the caller.
183 getcred(krb5_context context, krb5_ccache id, krb5_creds **creds)
188 ret = krb5_parse_name(context, "client@EXAMPLE.COM",
191 krb5_err(context, 1, ret, "krb5_parse_name");
193 ret = krb5_parse_name(context, "host/server.example.com@EXAMPLE.COM",
196 krb5_err(context, 1, ret, "krb5_parse_name");
198 ret = krb5_get_credentials(context, 0, id, &in, creds);
200 krb5_err(context, 1, ret, "krb5_get_credentials");
207 .Xr krb5_get_forwarded_creds 3 ,