1.\" Copyright (c) 2001 Kungliga Tekniska H�gskolan 2.\" $Id: krb5_verify_user.3,v 1.2 2001/11/09 09:38:29 joda Exp $ 3.Dd June 27, 2001 4.Dt KRB5_VERIFY_USER 3 5.Os HEIMDAL 6.Sh NAME 7.Nm krb5_verify_user , 8.Nm krb5_verify_user_lrealm 9.Nd Heimdal password verifying functions 10.Sh SYNOPSIS 11.Fd #include <krb5.h> 12.Ft krb5_error_code 13.Fn "krb5_verify_user" "krb5_context context" " krb5_principal principal" "krb5_ccache ccache" "const char *password" "krb5_boolean secure" "const char *service" 14.Ft krb5_error_code 15.Fn "krb5_verify_user_lrealm" "krb5_context context" "krb5_principal principal" "krb5_ccache ccache" "const char *password" "krb5_boolean secure" "const char *service" 16.Sh DESCRIPTION 17The 18.Nm krb5_verify_user 19function verifies the password supplied by a user. 20The principal whose 21password will be verified is specified in 22.Fa principal . 23New tickets will be obtained as a side-effect and stored in 24.Fa ccache 25(if NULL, the default ccache is used). 26If the password is not supplied in 27.Fa password 28(and is given as 29.Dv NULL ) 30the user will be prompted for it. 31If 32.Fa secure 33the ticket will be verified against the locally stored service key 34.Fa service 35(by default 36.Ql host 37if given as 38.Dv NULL 39). 40.Pp 41The 42.Nm krb5_verify_user_lrealm 43function does the same, except that it ignores the realm in 44.Fa principal 45and tries all the local realms (see 46.Xr krb5.conf 5 ) . 47.Sh EXAMPLE 48Here is a example program that verifies a password. it uses the 49.Ql host/`hostname` 50service principal in 51.Pa krb5.keytab . 52.Bd -literal 53#include <krb5.h> 54 55int 56main(int argc, char **argv) 57{ 58 char *user; 59 krb5_error_code error; 60 krb5_principal princ; 61 krb5_context context; 62 63 if (argc != 2) 64 errx(1, "usage: verify_passwd <principal-name>"); 65 66 user = argv[1]; 67 68 if (krb5_init_context(&context) < 0) 69 errx(1, "krb5_init_context"); 70 71 if ((error = krb5_parse_name(context, user, &princ)) != 0) 72 krb5_err(context, 1, error, "krb5_parse_name"); 73 74 error = krb5_verify_user(context, princ, NULL, NULL, TRUE, NULL); 75 if (error) 76 krb5_err(context, 1, error, "krb5_verify_user"); 77 78 return 0; 79} 80.Ed 81.Sh SEE ALSO 82.Xr krb5_err 3 , 83.Xr krb5_init_context 3 , 84.Xr krb5_kt_default 3 , 85.Xr krb5.conf 5 86