Add example how to use krb5_get_credentials.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16176 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-10-13 14:24:49 +00:00
parent 8592c8225b
commit 45d2b74ced

View File

@@ -149,6 +149,36 @@ if the credential exists there first.
.Fn krb5_get_kdc_cred .Fn krb5_get_kdc_cred
does the same as the functions above, but the caller must fill in all does the same as the functions above, but the caller must fill in all
the information andits closer to the wire protocol. 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 <krb5.h>
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 .Sh SEE ALSO
.Xr krb5 3 , .Xr krb5 3 ,
.Xr krb5_get_forwarded_creds 3 , .Xr krb5_get_forwarded_creds 3 ,