Browse code

Add krb5 patch to skip unnecessary mech calls

Change-Id: I6dc2132802bb278d197b2a7af3e16b0164008955
Reviewed-on: http://photon-jenkins.eng.vmware.com/650
Reviewed-by: suezzelur <anishs@vmware.com>
Tested-by: suezzelur <anishs@vmware.com>

suezzelur authored on 2016/03/19 07:02:26
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+From e353652831978d3cf1b756def7782b52dc495668 Mon Sep 17 00:00:00 2001
1
+From: Greg Hudson <ghudson@mit.edu>
2
+Date: Mon, 29 Feb 2016 16:51:22 -0500
3
+Subject: [PATCH] Skip unnecessary mech calls in gss_inquire_cred()
4
+
5
+If the caller does not request a name, lifetime, or cred_usage when
6
+calling gss_inquire_cred(), service the call by copying the mechanism
7
+list (if requested) but do not call into the mech.
8
+
9
+This change alleviates an issue (reported by Adam Bernstein) where
10
+SPNEGO can fail in the presence of expired krb5 credentials rather
11
+than proceeding with a different mechanism, or can resolve a krb5
12
+credential with the benefit of the target name.
13
+
14
+ticket: 8373
15
+target_version: 1.14-next
16
+target_version: 1.13-next
17
+tags: pullup
18
+---
19
+ src/lib/gssapi/mechglue/g_inq_cred.c | 39 ++++++++++++++++++++----------------
20
+ 1 file changed, 22 insertions(+), 17 deletions(-)
21
+
22
+diff --git a/src/lib/gssapi/mechglue/g_inq_cred.c b/src/lib/gssapi/mechglue/g_inq_cred.c
23
+index c5577d4..9111962 100644
24
+--- a/src/lib/gssapi/mechglue/g_inq_cred.c
25
+@@ -92,27 +92,32 @@ gss_OID_set *		mechanisms;
26
+ 	mech_cred = GSS_C_NO_CREDENTIAL;
27
+ 	mech = gssint_get_mechanism(GSS_C_NULL_OID);
28
+     }
29
+-    if (mech == NULL)
30
+-	return (GSS_S_DEFECTIVE_CREDENTIAL);
31
+-    if (!mech->gss_inquire_cred)
32
+-	return (GSS_S_UNAVAILABLE);
33
+ 
34
+-    status = mech->gss_inquire_cred(minor_status, mech_cred,
35
+-				    name ? &mech_name : NULL,
36
+-				    lifetime, cred_usage, NULL);
37
+-    if (status != GSS_S_COMPLETE) {
38
+-	map_error(minor_status, mech);
39
+-	return(status);
40
+-    }
41
++    /* Skip the call into the mech if the caller doesn't care about any of the
42
++     * values we would ask for. */
43
++    if (name != NULL || lifetime != NULL || cred_usage != NULL) {
44
++	if (mech == NULL)
45
++	    return (GSS_S_DEFECTIVE_CREDENTIAL);
46
++	if (!mech->gss_inquire_cred)
47
++	    return (GSS_S_UNAVAILABLE);
48
+ 
49
+-    if (name) {
50
+-	/* Convert mech_name into a union_name equivalent. */
51
+-	status = gssint_convert_name_to_union_name(&temp_minor_status,
52
+-						   mech, mech_name, name);
53
++	status = mech->gss_inquire_cred(minor_status, mech_cred,
54
++					name ? &mech_name : NULL,
55
++					lifetime, cred_usage, NULL);
56
+ 	if (status != GSS_S_COMPLETE) {
57
+-	    *minor_status = temp_minor_status;
58
+ 	    map_error(minor_status, mech);
59
+-	    return (status);
60
++	    return(status);
61
++	}
62
++
63
++	if (name) {
64
++	    /* Convert mech_name into a union_name equivalent. */
65
++	    status = gssint_convert_name_to_union_name(&temp_minor_status,
66
++						       mech, mech_name, name);
67
++	    if (status != GSS_S_COMPLETE) {
68
++		*minor_status = temp_minor_status;
69
++		map_error(minor_status, mech);
70
++		return (status);
71
++	    }
72
+ 	}
73
+     }
74
+ 
75
+
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	The Kerberos newtork authentication system
2 2
 Name:		krb5
3 3
 Version:	1.14
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	MIT
6 6
 URL:		http://cyrusimap.web.cmu.edu/
7 7
 Group:		System Environment/Security
... ...
@@ -9,6 +9,7 @@ Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0:	http://web.mit.edu/kerberos/www/dist/%{name}/%{version}/%{name}-%{version}.tar.gz
11 11
 %define sha1 krb5=02973f6605b1170bec812af9c8da4e447eeca9a9
12
+Patch0:         krb5-1.14-skip-unnecessary-mech-calls.patch
12 13
 Requires:	openssl
13 14
 Requires:	e2fsprogs
14 15
 BuildRequires: 	openssl-devel
... ...
@@ -19,6 +20,7 @@ which can improve your network's security by eliminating the insecure
19 19
 practice of clear text passwords.
20 20
 %prep
21 21
 %setup -q
22
+%patch0 -p1
22 23
 %build
23 24
 
24 25
 cd src &&
... ...
@@ -88,6 +90,8 @@ rm -rf %{buildroot}/*
88 88
 %{_datarootdir}/man/man5/.k5login.5.gz
89 89
 %{_docdir}/%{name}-%{version}
90 90
 %changelog
91
+* 	Fri Mar 18 2016 Anish Swaminathan <anishs@vmware.com>  1.14-2
92
+- 	Add patch for skipping unnecessary mech calls in gss_inquire_cred
91 93
 *	Thu Jan 21 2016 Anish Swaminathan <anishs@vmware.com> 1.14-1
92 94
 -	Upgrade version
93 95
 *	Tue Oct 07 2014 Divya Thaluru <dthaluru@vmware.com> 1.12.2-1