Allow use of larger RADIUS attributes in krad library
In kr_attrset_decode(), explicitly treat the length byte as unsigned. Otherwise attributes longer than 125 characters will be rejected with EBADMSG. Add a 253-character-long NAS-Identifier attribute to the tests to make sure that attributes with the maximal number of characters are working as expected. [ghudson@mit.edu: used uint8_t cast per current practices; edited commit message] ticket: 9036 (new) From upstream, needed in preparation for OAuth2 support for FreeIPA and SSSD. Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
2ef37ab30d
commit
0ceb166d96
69
krb5-krad-larger-attrs.patch
Normal file
69
krb5-krad-larger-attrs.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
From f35077bfc570205092eca2a9d44e50ce265622f4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sumit Bose <sbose@redhat.com>
|
||||||
|
Date: Mon, 8 Nov 2021 17:48:50 +0100
|
||||||
|
Subject: [PATCH] Support larger RADIUS attributes in libkrad
|
||||||
|
|
||||||
|
In kr_attrset_decode(), explicitly treat the length byte as unsigned.
|
||||||
|
Otherwise attributes longer than 125 characters will be rejected with
|
||||||
|
EBADMSG.
|
||||||
|
|
||||||
|
Add a 253-character-long NAS-Identifier attribute to the tests to make
|
||||||
|
sure that attributes with the maximal number of characters are working
|
||||||
|
as expected.
|
||||||
|
|
||||||
|
[ghudson@mit.edu: used uint8_t cast per current practices; edited
|
||||||
|
commit message]
|
||||||
|
|
||||||
|
ticket: 9036 (new)
|
||||||
|
---
|
||||||
|
src/lib/krad/attrset.c | 2 +-
|
||||||
|
src/lib/krad/t_packet.c | 13 +++++++++++++
|
||||||
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/lib/krad/attrset.c b/src/lib/krad/attrset.c
|
||||||
|
index 03c613716..f309f1581 100644
|
||||||
|
--- a/src/lib/krad/attrset.c
|
||||||
|
+++ b/src/lib/krad/attrset.c
|
||||||
|
@@ -217,7 +217,7 @@ kr_attrset_decode(krb5_context ctx, const krb5_data *in, const char *secret,
|
||||||
|
|
||||||
|
for (i = 0; i + 2 < in->length; ) {
|
||||||
|
type = in->data[i++];
|
||||||
|
- tmp = make_data(&in->data[i + 1], in->data[i] - 2);
|
||||||
|
+ tmp = make_data(&in->data[i + 1], (uint8_t)in->data[i] - 2);
|
||||||
|
i += tmp.length + 1;
|
||||||
|
|
||||||
|
retval = (in->length < i) ? EBADMSG : 0;
|
||||||
|
diff --git a/src/lib/krad/t_packet.c b/src/lib/krad/t_packet.c
|
||||||
|
index 0a92e9cc2..c22489144 100644
|
||||||
|
--- a/src/lib/krad/t_packet.c
|
||||||
|
+++ b/src/lib/krad/t_packet.c
|
||||||
|
@@ -57,6 +57,14 @@ make_packet(krb5_context ctx, const krb5_data *username,
|
||||||
|
krb5_error_code retval;
|
||||||
|
const krb5_data *data;
|
||||||
|
int i = 0;
|
||||||
|
+ krb5_data nas_id;
|
||||||
|
+
|
||||||
|
+ nas_id = string2data("12345678901234567890123456789012345678901234567890"
|
||||||
|
+ "12345678901234567890123456789012345678901234567890"
|
||||||
|
+ "12345678901234567890123456789012345678901234567890"
|
||||||
|
+ "12345678901234567890123456789012345678901234567890"
|
||||||
|
+ "12345678901234567890123456789012345678901234567890"
|
||||||
|
+ "123");
|
||||||
|
|
||||||
|
retval = krad_attrset_new(ctx, &set);
|
||||||
|
if (retval != 0)
|
||||||
|
@@ -71,6 +79,11 @@ make_packet(krb5_context ctx, const krb5_data *username,
|
||||||
|
if (retval != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
+ retval = krad_attrset_add(set, krad_attr_name2num("NAS-Identifier"),
|
||||||
|
+ &nas_id);
|
||||||
|
+ if (retval != 0)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
retval = krad_packet_new_request(ctx, "foo",
|
||||||
|
krad_code_name2num("Access-Request"),
|
||||||
|
set, iterator, &i, &tmp);
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -42,7 +42,7 @@
|
|||||||
Summary: The Kerberos network authentication system
|
Summary: The Kerberos network authentication system
|
||||||
Name: krb5
|
Name: krb5
|
||||||
Version: 1.19.2
|
Version: 1.19.2
|
||||||
Release: %{?zdpd}7%{?dist}
|
Release: %{?zdpd}8{?dist}
|
||||||
|
|
||||||
# rharwood has trust path to signing key and verifies on check-in
|
# rharwood has trust path to signing key and verifies on check-in
|
||||||
Source0: https://web.mit.edu/kerberos/dist/krb5/%{version}/krb5-%{version}%{?dashpre}.tar.gz
|
Source0: https://web.mit.edu/kerberos/dist/krb5/%{version}/krb5-%{version}%{?dashpre}.tar.gz
|
||||||
@ -95,6 +95,7 @@ Patch34: Use-OpenSSL-s-KBKDF-and-KRB5KDF-for-deriving-long-te.patch
|
|||||||
Patch35: Handle-OpenSSL-3-s-providers.patch
|
Patch35: Handle-OpenSSL-3-s-providers.patch
|
||||||
Patch36: Remove-TCL-based-libkadm5-API-tests.patch
|
Patch36: Remove-TCL-based-libkadm5-API-tests.patch
|
||||||
Patch37: Use-SHA256-instead-of-SHA1-for-PKINIT-CMS-digest.patch
|
Patch37: Use-SHA256-instead-of-SHA1-for-PKINIT-CMS-digest.patch
|
||||||
|
Patch38: krb5-krad-larger-attrs.patch
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://web.mit.edu/kerberos/www/
|
URL: https://web.mit.edu/kerberos/www/
|
||||||
@ -644,6 +645,9 @@ exit 0
|
|||||||
%{_libdir}/libkadm5srv_mit.so.*
|
%{_libdir}/libkadm5srv_mit.so.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 05 2022 Alexander Bokovoy <abokovoy@redhat.com> - 1.19.2-8
|
||||||
|
- Allow use of larger RADIUS attributes in krad library
|
||||||
|
|
||||||
* Wed Mar 23 2022 Julien Rische <jrische@redhat.com> - 1.19.2-7
|
* Wed Mar 23 2022 Julien Rische <jrische@redhat.com> - 1.19.2-7
|
||||||
- Use SHA-256 instead of SHA-1 for PKINIT CMS digest
|
- Use SHA-256 instead of SHA-1 for PKINIT CMS digest
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user