Control: tag -1 patch
Control: forwarded -1 https://rt.cpan.org/Ticket/Display.html?id=129869
On Wed, Jun 19, 2019 at 08:27:51PM +0300, Niko Tyni wrote:
> On Tue, Jun 18, 2019 at 10:52:03AM +0200, Ferenc Wágner wrote:
> > Package: libauthen-radius-perl
> > Version: 0.29-1
> > Severity: important
>
> > I recently upgraded to buster and noticed that our RADIUS test plugin
> > does not work anymore. Downgrading libauthen-radius-perl to 0.27-1
> > fixes the issue. Take the first example from the top of the man page:
> >
> > use Authen::Radius;
> > $r = new Authen::Radius(Host => 'myserver', Secret => 'mysecret');
> > print "auth result=", $r->check_pwd('myname', 'mypwd'), "\n";
> > unknown attr name 1 at /usr/share/perl5/Authen/Radius.pm line 865.
> This needs to be reported and fixed upstream; I'll look at it in the
> next few days unless someone else beats me to it.
I've reported this upstream with the attached proposed patch.
Will wait a bit before applying the patch for Debian in case upstream
has comments.
--
Niko Tyni [email protected]
>From ba0078591c35d1d6a404828aab9d06fb43c4d5fc Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Thu, 20 Jun 2019 16:43:30 +0300
Subject: [PATCH] Fix 0.28 regression with check_pwd()
add_attributes() is documented to accept raw numeric attributes,
and check_pwd() uses those.
Bug-Debian: https://bugs.debian.org/930671
---
Radius.pm | 3 ++-
t/error.t | 13 ++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Radius.pm b/Radius.pm
index fd0a6c9..3497e99 100644
--- a/Radius.pm
+++ b/Radius.pm
@@ -862,7 +862,8 @@ sub add_attributes {
$attr_name = $1;
}
- die 'unknown attr name '.$attr_name if (! exists $dict_name{$attr_name});
+ die 'unknown attr name '.$attr_name
+ if ($attr_name =~ /\D/ and ! exists $dict_name{$attr_name});
$id = $dict_name{$attr_name}{id} // int($attr_name);
$vendor = vendorID($attr);
diff --git a/t/error.t b/t/error.t
index 6a02cb3..e1c8f5f 100644
--- a/t/error.t
+++ b/t/error.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 12;
use Test::NoWarnings;
BEGIN { use_ok('Authen::Radius') };
@@ -17,3 +17,14 @@ ok( $auth->clear_attributes, 'clear attributes');
is($auth->get_error(), 'ENONE', 'error was reset');
is(Authen::Radius->get_error(), 'ENONE', 'global error also reset');
+
+my @attributes = (
+ { Name => 1, Value => 'user', Type => 'string' },
+ { Name => 2, Value => 'pass', Type => 'string' },
+ { Name => 4, Value => '127.0.0.1', Type => 'ipaddr' }
+);
+
+# called by check_pwd()
+ok( $auth->add_attributes(@attributes), 'add attributes');
+is($auth->get_error(), 'ENONE', 'no error with add_attributes');
+is(Authen::Radius->get_error(), 'ENONE', 'no global error either');
--
2.20.1