summaryrefslogtreecommitdiff
path: root/core/nfs-utils/nfs-utils-1.1.6-heimdal_functions.patch
blob: 7f6c7a751564856fa499330511b9aa443c20bc9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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)