Drop changing the password, really need kadmin/ldap support to do it
[Samba.git] / lib / krb5 / krb5_get_credentials.3
blobdcdde78b6349f25a2bdd4d5cdf4e7b08790a35d5
1 .\" Copyright (c) 2004 - 2005 Kungliga Tekniska Högskolan
2 .\" (Royal Institute of Technology, Stockholm, Sweden).
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\"
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\"
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.
15 .\"
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.
19 .\"
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
30 .\" SUCH DAMAGE.
31 .\"
32 .\" $Id$
33 .\"
34 .Dd July 26, 2004
35 .Dt KRB5_GET_CREDENTIALS 3
36 .Os HEIMDAL
37 .Sh NAME
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
45 .Sh LIBRARY
46 Kerberos 5 Library (libkrb5, -lkrb5)
47 .Sh SYNOPSIS
48 .In krb5.h
49 .Ft krb5_error_code
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"
56 .Fc
57 .Ft krb5_error_code
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"
65 .Fc
66 .Ft krb5_error_code
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"
73 .Fc
74 .Ft krb5_error_code
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"
82 .Fc
83 .Ft krb5_error_code
84 .Fo krb5_get_kdc_cred
85 .Fa "krb5_context context"
86 .Fa "krb5_ccache id"
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"
92 .Fc
93 .Ft krb5_error_code
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"
101 .Sh DESCRIPTION
102 .Fn krb5_get_credentials_with_flags
103 get credentials specified by
104 .Fa in_creds->server
106 .Fa in_creds->client
107 (the rest of the
108 .Fa in_creds
109 structure is ignored)
110 by first looking in the
111 .Fa ccache
112 and if doesn't exists or is expired, fetch the credential from the KDC
113 using the krbtgt in
114 .Fa ccache .
115 The credential is returned in
116 .Fa out_creds
117 and should be freed using the function
118 .Fn krb5_free_creds .
120 Valid flags to pass into
121 .Fa options
122 argument are:
124 .Bl -tag -width "KRB5_GC_EXPIRED_OK" -compact
125 .It KRB5_GC_CACHED
126 Only check the
127 .Fa ccache ,
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
133 .Fa ccache .
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.
139 .Fa Flags
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
146 except that the
147 .Fa flags
148 field is missing.
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 ,
155 but doesn't look in the
156 .Fa ccache
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
165 .Fa in_tkt_service
167 .Dv NULL
168 the default
169 .Li krbtgt )
170 using the credential cache
171 .Fa ccache .
172 The result is stored in
173 .Fa creds
174 and should be freed using
175 .Fa krb5_free_creds .
176 .Sh EXAMPLES
177 Here is a example function that get a credential from a credential cache
178 .Fa id
179 or the KDC and returns it to the caller.
180 .Bd -literal
181 #include <krb5.h>
184 getcred(krb5_context context, krb5_ccache id, krb5_creds **creds)
186     krb5_error_code ret;
187     krb5_creds in;
189     ret = krb5_parse_name(context, "client@EXAMPLE.COM",
190                           &in.client);
191     if (ret)
192         krb5_err(context, 1, ret, "krb5_parse_name");
194     ret = krb5_parse_name(context, "host/server.example.com@EXAMPLE.COM",
195                           &in.server);
196     if (ret)
197         krb5_err(context, 1, ret, "krb5_parse_name");
199     ret = krb5_get_credentials(context, 0, id, &in, creds);
200     if (ret)
201         krb5_err(context, 1, ret, "krb5_get_credentials");
203     return 0;
206 .Sh SEE ALSO
207 .Xr krb5 3 ,
208 .Xr krb5_get_forwarded_creds 3 ,
209 .Xr krb5.conf 5