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
32 .\" $Heimdal: krb5_get_credentials.3 22071 2007-11-14 20:04:50Z lha $
36 .Dt KRB5_GET_CREDENTIALS 3
39 .Nm krb5_get_credentials ,
40 .Nm krb5_get_credentials_with_flags ,
41 .Nm krb5_get_cred_from_kdc ,
42 .Nm krb5_get_cred_from_kdc_opt ,
43 .Nm krb5_get_kdc_cred ,
44 .Nm krb5_get_renewed_creds
45 .Nd get credentials from the KDC using krbtgt
47 Kerberos 5 Library (libkrb5, -lkrb5)
51 .Fo krb5_get_credentials
52 .Fa "krb5_context context"
53 .Fa "krb5_flags options"
54 .Fa "krb5_ccache ccache"
55 .Fa "krb5_creds *in_creds"
56 .Fa "krb5_creds **out_creds"
59 .Fo krb5_get_credentials_with_flags
60 .Fa "krb5_context context"
61 .Fa "krb5_flags options"
62 .Fa "krb5_kdc_flags flags"
63 .Fa "krb5_ccache ccache"
64 .Fa "krb5_creds *in_creds"
65 .Fa "krb5_creds **out_creds"
68 .Fo krb5_get_cred_from_kdc
69 .Fa "krb5_context context"
70 .Fa "krb5_ccache ccache"
71 .Fa "krb5_creds *in_creds"
72 .Fa "krb5_creds **out_creds"
73 .Fa "krb5_creds ***ret_tgts"
76 .Fo krb5_get_cred_from_kdc_opt
77 .Fa "krb5_context context"
78 .Fa "krb5_ccache ccache"
79 .Fa "krb5_creds *in_creds"
80 .Fa "krb5_creds **out_creds"
81 .Fa "krb5_creds ***ret_tgts"
82 .Fa "krb5_flags flags"
86 .Fa "krb5_context context"
88 .Fa "krb5_kdc_flags flags"
89 .Fa "krb5_addresses *addresses"
90 .Fa "Ticket *second_ticket"
91 .Fa "krb5_creds *in_creds"
92 .Fa "krb5_creds **out_creds"
95 .Fo krb5_get_renewed_creds
96 .Fa "krb5_context context"
97 .Fa "krb5_creds *creds"
98 .Fa "krb5_const_principal client"
99 .Fa "krb5_ccache ccache"
100 .Fa "const char *in_tkt_service"
103 .Fn krb5_get_credentials_with_flags
104 get credentials specified by
110 structure is ignored)
111 by first looking in the
113 and if doesn't exists or is expired, fetch the credential from the KDC
116 The credential is returned in
118 and should be freed using the function
119 .Fn krb5_free_creds .
121 Valid flags to pass into
125 .Bl -tag -width "KRB5_GC_USER_USER" -compact
129 don't got out on network to fetch credential.
130 .It KRB5_GC_USER_USER
131 Request a user to user ticket.
132 This option doesn't store the resulting user to user credential in
135 .It KRB5_GC_EXPIRED_OK
136 returns the credential even if it is expired, default behavior is trying
137 to refetch the credential from the KDC.
141 are KDCOptions, note the caller must fill in the bit-field and not
142 use the integer associated structure.
144 .Fn krb5_get_credentials
145 works the same way as
146 .Fn krb5_get_credentials_with_flags
151 .Fn krb5_get_cred_from_kdc
153 .Fn krb5_get_cred_from_kdc_opt
154 fetches the credential from the KDC very much like
155 .Fn krb5_get_credentials, but doesn't look in the
157 if the credential exists there first.
159 .Fn krb5_get_kdc_cred
160 does the same as the functions above, but the caller must fill in all
161 the information andits closer to the wire protocol.
163 .Fn krb5_get_renewed_creds
164 renews a credential given by
170 using the credential cache
172 The result is stored in
174 and should be freed using
175 .Fa krb5_free_creds .
177 Here is a example function that get a credential from a credential cache
179 or the KDC and returns it to the caller.
181 #include <krb5/krb5.h>
184 getcred(krb5_context context, krb5_ccache id, krb5_creds **creds)
189 ret = krb5_parse_name(context, "client@EXAMPLE.COM",
192 krb5_err(context, 1, ret, "krb5_parse_name");
194 ret = krb5_parse_name(context, "host/server.example.com@EXAMPLE.COM",
197 krb5_err(context, 1, ret, "krb5_parse_name");
199 ret = krb5_get_credentials(context, 0, id, &in, creds);
201 krb5_err(context, 1, ret, "krb5_get_credentials");
208 .Xr krb5_get_forwarded_creds 3 ,