1 .\" $NetBSD: krb5_get_credentials.3,v 1.1.1.2 2011/04/14 14:09:23 elric Exp $
3 .\" Copyright (c) 2004 - 2005 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
37 .Dt KRB5_GET_CREDENTIALS 3
40 .Nm krb5_get_credentials ,
41 .Nm krb5_get_credentials_with_flags ,
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"
68 .Fa "krb5_context context"
70 .Fa "krb5_kdc_flags flags"
71 .Fa "krb5_addresses *addresses"
72 .Fa "Ticket *second_ticket"
73 .Fa "krb5_creds *in_creds"
74 .Fa "krb5_creds **out_creds"
77 .Fo krb5_get_renewed_creds
78 .Fa "krb5_context context"
79 .Fa "krb5_creds *creds"
80 .Fa "krb5_const_principal client"
81 .Fa "krb5_ccache ccache"
82 .Fa "const char *in_tkt_service"
85 .Fn krb5_get_credentials_with_flags
86 get credentials specified by
93 by first looking in the
95 and if doesn't exists or is expired, fetch the credential from the KDC
98 The credential is returned in
100 and should be freed using the function
101 .Fn krb5_free_creds .
103 Valid flags to pass into
107 .Bl -tag -width "KRB5_GC_EXPIRED_OK" -compact
111 don't got out on network to fetch credential.
112 .It KRB5_GC_USER_USER
113 Request a user to user ticket.
114 This option doesn't store the resulting user to user credential in
117 .It KRB5_GC_EXPIRED_OK
118 returns the credential even if it is expired, default behavior is trying
119 to refetch the credential from the KDC.
123 are KDCOptions, note the caller must fill in the bit-field and not
124 use the integer associated structure.
126 .Fn krb5_get_credentials
127 works the same way as
128 .Fn krb5_get_credentials_with_flags
133 .Fn krb5_get_kdc_cred
134 does the same as the functions above, but the caller must fill in all
135 the information andits closer to the wire protocol.
137 .Fn krb5_get_renewed_creds
138 renews a credential given by
144 using the credential cache
146 The result is stored in
148 and should be freed using
149 .Fa krb5_free_creds .
151 Here is a example function that get a credential from a credential cache
153 or the KDC and returns it to the caller.
155 #include <krb5/krb5.h>
158 getcred(krb5_context context, krb5_ccache id, krb5_creds **creds)
163 ret = krb5_parse_name(context, "client@EXAMPLE.COM",
166 krb5_err(context, 1, ret, "krb5_parse_name");
168 ret = krb5_parse_name(context, "host/server.example.com@EXAMPLE.COM",
171 krb5_err(context, 1, ret, "krb5_parse_name");
173 ret = krb5_get_credentials(context, 0, id, &in, creds);
175 krb5_err(context, 1, ret, "krb5_get_credentials");
182 .Xr krb5_get_forwarded_creds 3 ,