From 45d2b74ced4f8941b09c6437151cace82b274445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 13 Oct 2005 14:24:49 +0000 Subject: [PATCH] Add example how to use krb5_get_credentials. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16176 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/krb5_get_credentials.3 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/krb5/krb5_get_credentials.3 b/lib/krb5/krb5_get_credentials.3 index 6dd835f43..34e0c8294 100644 --- a/lib/krb5/krb5_get_credentials.3 +++ b/lib/krb5/krb5_get_credentials.3 @@ -149,6 +149,36 @@ if the credential exists there first. .Fn krb5_get_kdc_cred does the same as the functions above, but the caller must fill in all the information andits closer to the wire protocol. +.Sh EXAMPLES +Here is a example function that get a credential from a credential cache +.Fa id +or the KDC and returns it to the caller. +.Bd -literal +#include + +int +getcred(krb5_context context, krb5_ccache id, krb5_creds **creds) +{ + krb5_error_code ret; + krb5_creds in; + + ret = krb5_parse_name(context, "client@EXAMPLE.COM", + &in.client); + if (ret) + krb5_err(context, 1, ret, "krb5_parse_name"); + + ret = krb5_parse_name(context, "host/server.example.com@EXAMPLE.COM", + &in.server); + if (ret) + krb5_err(context, 1, ret, "krb5_parse_name"); + + ret = krb5_get_credentials(context, 0, id, &in, creds); + if (ret) + krb5_err(context, 1, ret, "krb5_get_credentials"); + + return 0; +} +.Ed .Sh SEE ALSO .Xr krb5 3 , .Xr krb5_get_forwarded_creds 3 ,