1KRB5_GET_CREDENTIALS(3)  BSD Library Functions Manual  KRB5_GET_CREDENTIALS(3)
2

NAME

4     krb5_get_credentials, krb5_get_credentials_with_flags, krb5_get_kdc_cred,
5     krb5_get_renewed_creds — get credentials from the KDC using krbtgt
6

LIBRARY

8     Kerberos 5 Library (libkrb5, -lkrb5)
9

SYNOPSIS

11     #include <krb5.h>
12
13     krb5_error_code
14     krb5_get_credentials(krb5_context context, krb5_flags options,
15         krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds);
16
17     krb5_error_code
18     krb5_get_credentials_with_flags(krb5_context context, krb5_flags options,
19         krb5_kdc_flags flags, krb5_ccache ccache, krb5_creds *in_creds,
20         krb5_creds **out_creds);
21
22     krb5_error_code
23     krb5_get_kdc_cred(krb5_context context, krb5_ccache id,
24         krb5_kdc_flags flags, krb5_addresses *addresses,
25         Ticket *second_ticket, krb5_creds *in_creds, krb5_creds **out_creds);
26
27     krb5_error_code
28     krb5_get_renewed_creds(krb5_context context, krb5_creds *creds,
29         krb5_const_principal client, krb5_ccache ccache,
30         const char *in_tkt_service);
31

DESCRIPTION

33     krb5_get_credentials_with_flags() get credentials specified by
34     in_creds->server and in_creds->client (the rest of the in_creds structure
35     is ignored) by first looking in the ccache and if doesn't exists or is
36     expired, fetch the credential from the KDC using the krbtgt in ccache.
37     The credential is returned in out_creds and should be freed using the
38     function krb5_free_creds().
39
40     Valid flags to pass into options argument are:
41
42     KRB5_GC_CACHED      Only check the ccache, don't got out on network to
43                         fetch credential.
44     KRB5_GC_USER_USER   Request a user to user ticket.  This option doesn't
45                         store the resulting user to user credential in the
46                         ccache.
47     KRB5_GC_EXPIRED_OK  returns the credential even if it is expired, default
48                         behavior is trying to refetch the credential from the
49                         KDC.
50
51     Flags are KDCOptions, note the caller must fill in the bit-field and not
52     use the integer associated structure.
53
54     krb5_get_credentials() works the same way as
55     krb5_get_credentials_with_flags() except that the flags field is missing.
56
57     krb5_get_kdc_cred() does the same as the functions above, but the caller
58     must fill in all the information andits closer to the wire protocol.
59
60     krb5_get_renewed_creds() renews a credential given by in_tkt_service (if
61     NULL the default krbtgt) using the credential cache ccache.  The result
62     is stored in creds and should be freed using krb5_free_creds.
63

EXAMPLES

65     Here is a example function that get a credential from a credential cache
66     id or the KDC and returns it to the caller.
67
68     #include <krb5.h>
69
70     int
71     getcred(krb5_context context, krb5_ccache id, krb5_creds **creds)
72     {
73         krb5_error_code ret;
74         krb5_creds in;
75
76         ret = krb5_parse_name(context, "client@EXAMPLE.COM",
77                               &in.client);
78         if (ret)
79             krb5_err(context, 1, ret, "krb5_parse_name");
80
81         ret = krb5_parse_name(context, "host/server.example.com@EXAMPLE.COM",
82                               &in.server);
83         if (ret)
84             krb5_err(context, 1, ret, "krb5_parse_name");
85
86         ret = krb5_get_credentials(context, 0, id, &in, creds);
87         if (ret)
88             krb5_err(context, 1, ret, "krb5_get_credentials");
89
90         return 0;
91     }
92

SEE ALSO

94     krb5(3), krb5_get_forwarded_creds(3), krb5.conf(5)
95
96HEIMDAL                          July 26, 2004                         HEIMDAL
Impressum