1 .\" Copyright (c) 2001 - 2006 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_verify_user.3 22071 2007-11-14 20:04:50Z lha $
36 .Dt KRB5_VERIFY_USER 3
39 .Nm krb5_verify_user ,
40 .Nm krb5_verify_user_lrealm ,
41 .Nm krb5_verify_user_opt ,
42 .Nm krb5_verify_opt_init ,
43 .Nm krb5_verify_opt_alloc ,
44 .Nm krb5_verify_opt_free ,
45 .Nm krb5_verify_opt_set_ccache ,
46 .Nm krb5_verify_opt_set_flags ,
47 .Nm krb5_verify_opt_set_service ,
48 .Nm krb5_verify_opt_set_secure ,
49 .Nm krb5_verify_opt_set_keytab
50 .Nd Heimdal password verifying functions
52 Kerberos 5 Library (libkrb5, -lkrb5)
56 .Fn "krb5_verify_user" "krb5_context context" " krb5_principal principal" "krb5_ccache ccache" "const char *password" "krb5_boolean secure" "const char *service"
58 .Fn "krb5_verify_user_lrealm" "krb5_context context" "krb5_principal principal" "krb5_ccache ccache" "const char *password" "krb5_boolean secure" "const char *service"
60 .Fn krb5_verify_opt_init "krb5_verify_opt *opt"
62 .Fn krb5_verify_opt_alloc "krb5_verify_opt **opt"
64 .Fn krb5_verify_opt_free "krb5_verify_opt *opt"
66 .Fn krb5_verify_opt_set_ccache "krb5_verify_opt *opt" "krb5_ccache ccache"
68 .Fn krb5_verify_opt_set_keytab "krb5_verify_opt *opt" "krb5_keytab keytab"
70 .Fn krb5_verify_opt_set_secure "krb5_verify_opt *opt" "krb5_boolean secure"
72 .Fn krb5_verify_opt_set_service "krb5_verify_opt *opt" "const char *service"
74 .Fn krb5_verify_opt_set_flags "krb5_verify_opt *opt" "unsigned int flags"
76 .Fo krb5_verify_user_opt
77 .Fa "krb5_context context"
78 .Fa "krb5_principal principal"
79 .Fa "const char *password"
80 .Fa "krb5_verify_opt *opt"
85 function verifies the password supplied by a user.
86 The principal whose password will be verified is specified in
88 New tickets will be obtained as a side-effect and stored in
92 the default ccache is used).
95 .Fn krb5_cc_initialize
100 must only initialized with
103 .Fn krb5_cc_gen_new .
104 If the password is not supplied in
108 the user will be prompted for it.
111 the ticket will be verified against the locally stored service key
120 .Fn krb5_verify_user_lrealm
121 function does the same, except that it ignores the realm in
123 and tries all the local realms (see
125 After a successful return, the principal is set to the authenticated
126 realm. If the call fails, the principal will not be meaningful, and
127 should only be freed with
128 .Xr krb5_free_principal 3 .
130 .Fn krb5_verify_opt_alloc
132 .Fn krb5_verify_opt_free
133 allocates and frees a
134 .Li krb5_verify_opt .
135 You should use the the alloc and free function instead of allocation
136 the structure yourself, this is because in a future release the
137 structure wont be exported.
139 .Fn krb5_verify_opt_init
140 resets all opt to default values.
142 None of the krb5_verify_opt_set function makes a copy of the data
143 structure that they are called with. It's up the caller to free them
145 .Fn krb5_verify_user_opt
148 .Fn krb5_verify_opt_set_ccache
153 will use. If not set, the default credential cache will be used.
155 .Fn krb5_verify_opt_set_keytab
160 will use. If not set, the default keytab will be used.
162 .Fn krb5_verify_opt_set_secure
165 if true, the password verification will require that the ticket will
166 be verified against the locally stored service key. If not set,
167 default value is true.
169 .Fn krb5_verify_opt_set_service
172 principal that user of
174 will use. If not set, the
176 service will be used.
178 .Fn krb5_verify_opt_set_flags
185 .Dv KRB5_VERIFY_LREALMS
188 will be modified like
189 .Fn krb5_verify_user_lrealm
192 .Fn krb5_verify_user_opt
193 function verifies the
196 The principal whose password will be verified is specified in
198 Options the to the verification process is pass in in
201 Here is a example program that verifies a password. it uses the
206 #include <krb5/krb5.h>
209 main(int argc, char **argv)
212 krb5_error_code error;
213 krb5_principal princ;
214 krb5_context context;
217 errx(1, "usage: verify_passwd <principal-name>");
221 if (krb5_init_context(&context) < 0)
222 errx(1, "krb5_init_context");
224 if ((error = krb5_parse_name(context, user, &princ)) != 0)
225 krb5_err(context, 1, error, "krb5_parse_name");
227 error = krb5_verify_user(context, princ, NULL, NULL, TRUE, NULL);
229 krb5_err(context, 1, error, "krb5_verify_user");
235 .Xr krb5_cc_gen_new 3 ,
236 .Xr krb5_cc_initialize 3 ,
237 .Xr krb5_cc_resolve 3 ,
239 .Xr krb5_free_principal 3 ,
240 .Xr krb5_init_context 3 ,
241 .Xr krb5_kt_default 3 ,