nfs-utils: Include legacy or TI-RPC headers, not both
[nfs-utils.git] / utils / gssd / krb5_util.h
1 #ifndef KRB5_UTIL_H
2 #define KRB5_UTIL_H
3
4 #include <krb5.h>
5
6 #ifdef HAVE_LIBTIRPC
7 #include <rpc/auth_gss.h>
8 #else
9 #include "gss_oids.h"
10 #endif
11
12 /*
13  * List of principals from our keytab that we
14  * will try to use to obtain credentials
15  * (known as a principal list entry (ple))
16  */
17 struct gssd_k5_kt_princ {
18         struct gssd_k5_kt_princ *next;
19         krb5_principal princ;
20         char *ccname;
21         char *realm;
22         krb5_timestamp endtime;
23 };
24
25
26 int gssd_setup_krb5_user_gss_ccache(uid_t uid, char *servername,
27                                      char *dirname);
28 int  gssd_get_krb5_machine_cred_list(char ***list);
29 void gssd_free_krb5_machine_cred_list(char **list);
30 void gssd_setup_krb5_machine_gss_ccache(char *servername);
31 void gssd_destroy_krb5_machine_creds(void);
32 int  gssd_refresh_krb5_machine_credential(char *hostname,
33                                           struct gssd_k5_kt_princ *ple);
34 const char *
35 gssd_k5_err_msg(krb5_context context, krb5_error_code code);
36 void gssd_k5_get_default_realm(char **def_realm);
37
38 #ifdef HAVE_SET_ALLOWABLE_ENCTYPES
39 int limit_krb5_enctypes(struct rpc_gss_sec *sec, uid_t uid);
40 #endif
41
42 /*
43  * Hide away some of the MIT vs. Heimdal differences
44  * here with macros...
45  */
46
47 #ifdef HAVE_KRB5
48 #define k5_free_unparsed_name(ctx, name)        krb5_free_unparsed_name((ctx), (name))
49 #define k5_free_default_realm(ctx, realm)       krb5_free_default_realm((ctx), (realm))
50 #define k5_free_kt_entry(ctx, kte)              krb5_free_keytab_entry_contents((ctx),(kte))
51 #else   /* Heimdal */
52 #define k5_free_unparsed_name(ctx, name)        free(name)
53 #define k5_free_default_realm(ctx, realm)       free(realm)
54 #define k5_free_kt_entry(ctx, kte)              krb5_kt_free_entry((ctx),(kte))
55 #undef USE_GSS_KRB5_CCACHE_NAME
56 #define USE_GSS_KRB5_CCACHE_NAME 1
57 #endif
58
59 #endif /* KRB5_UTIL_H */