PKGBUILDs/core/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
2012-02-15 20:34:17 -05:00

69 lines
1.8 KiB
Diff

diff -Naur nfs-utils-1.1.6.orig/utils/gssd/krb5_util.c nfs-utils-1.1.6/utils/gssd/krb5_util.c
--- utils/gssd/krb5_util.c 2009-04-20 19:32:50.000000000 +0200
+++ utils/gssd/krb5_util.c 2009-04-20 20:57:31.000000000 +0200
@@ -940,9 +940,37 @@
{
krb5_error_code ret;
krb5_creds creds;
- krb5_cc_cursor cur;
int found = 0;
+#ifdef HAVE_HEIMDAL
+ krb5_creds pattern;
+ krb5_realm *client_realm;
+
+ krb5_cc_clear_mcred(&pattern);
+
+ client_realm = krb5_princ_realm (context, principal);
+
+ ret = krb5_make_principal (context, &pattern.server,
+ *client_realm, KRB5_TGS_NAME, *client_realm,
+ NULL);
+ if (ret)
+ krb5_err (context, 1, ret, "krb5_make_principal");
+ pattern.client = principal;
+
+ ret = krb5_cc_retrieve_cred (context, ccache, 0, &pattern, &creds);
+ krb5_free_principal (context, pattern.server);
+ if (ret) {
+ if (ret == KRB5_CC_END)
+ return 1;
+ krb5_err (context, 1, ret, "krb5_cc_retrieve_cred");
+ }
+
+ found = creds.times.endtime > time(NULL);
+
+ krb5_free_cred_contents (context, &creds);
+#else
+ krb5_cc_cursor cur;
+
ret = krb5_cc_start_seq_get(context, ccache, &cur);
if (ret)
return 0;
@@ -962,6 +990,7 @@
krb5_free_cred_contents(context, &creds);
}
krb5_cc_end_seq_get(context, ccache, &cur);
+#endif
return found;
}
@@ -1008,6 +1037,9 @@
}
krb5_free_principal(context, principal);
err_princ:
+#ifdef HAVE_HEIMDAL
+#define KRB5_TC_OPENCLOSE 0x00000001
+#endif
krb5_cc_set_flags(context, ccache, KRB5_TC_OPENCLOSE);
krb5_cc_close(context, ccache);
err_cache:
@@ -1262,7 +1294,7 @@
if (context != NULL) {
origmsg = krb5_get_error_message(context, code);
msg = strdup(origmsg);
- krb5_free_error_message(context, origmsg);
+ krb5_free_error_string(context, origmsg);
}
#endif
if (msg != NULL)