summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2017-04-26 16:22:05 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2017-04-27 11:14:58 +0200
commitab68fcadbfa51e6cdd5edd950c4252da2d16de53 (patch)
tree7436e1467b64a7538c9de32afbea510d318b6018
parent8bdaca3f6688d138d7359190824dbff305a3fc9f (diff)
downloadmeta-openembedded-ab68fcadbfa51e6cdd5edd950c4252da2d16de53.tar.gz
libauthen-radius-perl: add new recipe
The Authen::Radius module provides a simple class that allows you to send/receive Radius requests/responses to/from a Radius server. Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-perl/recipes-perl/libauthen/libauthen-radius-perl/run-ptest21
-rw-r--r--meta-perl/recipes-perl/libauthen/libauthen-radius-perl/test.pl-adjust-for-ptest.patch90
-rw-r--r--meta-perl/recipes-perl/libauthen/libauthen-radius-perl_0.22.bb39
3 files changed, 150 insertions, 0 deletions
diff --git a/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/run-ptest b/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/run-ptest
new file mode 100644
index 000000000..f1c833e6c
--- /dev/null
+++ b/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/run-ptest
@@ -0,0 +1,21 @@
1#!/bin/sh
2#
3
4# prepare testing config
5CONF_USERS=`readlink -f /etc/raddb/users`
6mv ${CONF_USERS} ${CONF_USERS}_orig
7echo "testing Cleartext-Password := \"testpassword\"" > ${CONF_USERS}
8cat ${CONF_USERS}_orig >> ${CONF_USERS}
9
10# restart radiusd server
11systemctl restart radiusd || /etc/init.d/radiusd restart || {
12 echo "FAIL: Start radiusd service."
13 exit 1
14}
15
16# run teests
17perl test.pl
18
19# restore the config and restart
20mv ${CONF_USERS}_orig ${CONF_USERS}
21systemctl restart radiusd || /etc/init.d/radiusd restart
diff --git a/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/test.pl-adjust-for-ptest.patch b/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/test.pl-adjust-for-ptest.patch
new file mode 100644
index 000000000..9798af497
--- /dev/null
+++ b/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/test.pl-adjust-for-ptest.patch
@@ -0,0 +1,90 @@
1From 829302792bf0e4935d29efc23ca1f2e9e7ee7dfd Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Thu, 7 Jan 2016 03:12:38 -0500
4Subject: [PATCH] test.pl: adjust for ptest
5
6* Don't use interactive inputs, set default test
7 settings instead.
8* Change the test results output to the ptest format
9
10Upstream-Status: Inappropriate [OE ptest specific]
11
12Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
13---
14 test.pl | 31 ++++++++++++++++++-------------
15 1 file changed, 18 insertions(+), 13 deletions(-)
16
17diff --git a/test.pl b/test.pl
18index cfd1c1e..9b4f10e 100644
19--- a/test.pl
20+++ b/test.pl
21@@ -7,11 +7,11 @@
22 # Change 1..1 below to 1..last_test_to_print .
23 # (It may become useful if the test is moved to ./t subdirectory.)
24
25-BEGIN {print "1..5\n";}
26-END {print "not ok 1\n" unless $loaded;}
27+BEGIN {print "Start testing for libauthen-radius-perl\n";}
28+END {print "\nFAIL: test1\n" unless $loaded;}
29 use Authen::Radius;
30 $loaded = 1;
31-print "ok 1\n";
32+print "\nPASS: test1\n";
33
34 ######################### End of black magic.
35
36@@ -19,26 +19,31 @@ print "ok 1\n";
37 # (correspondingly "not ok 13") depending on the success of chunk 13
38 # of the test code):
39
40+$host = "127.0.0.1";
41+$secret = "testing123";
42+$user = "testing";
43+$pwd = "testpassword";
44+
45 print "Make sure this machine is in your Radius clients file!\n";
46-print "Enter hostname[:port] of your Radius server: "; chomp ($host = <STDIN>);
47-print "Enter shared-secret of your Radius server: "; chomp ($secret = <STDIN>);
48-print "Enter a username to be validated: "; chomp ($user = <STDIN>);
49-print "Enter this user's password: "; chomp ($pwd = <STDIN>);
50+print "hostname of your Radius server: $host\n";
51+print "shared-secret of your Radius server: $secret\n";
52+print "The username to be validated: $user\n";
53+print "The user's password: $pwd\n";
54
55 $t = 2;
56 if ($host ne '') {
57 $r = new Authen::Radius(Host => $host, Secret => $secret, Debug => 1);
58- print defined($r) ? "" : "not ", "ok $t\n"; $t++;
59+ print defined($r) ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++;
60 #Authen::Radius->load_dictionary;
61- print $r->check_pwd($user, $pwd) ? "" : "not ", "ok $t\n"; $t++;
62+ print $r->check_pwd($user, $pwd) ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++;
63 @a = $r->get_attributes;
64- print $#a != -1 ? "" : "not ", "ok $t\n"; $t++;
65+ print $#a != -1 ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++;
66 #for $a (@a) {
67 # print "attr: name=$a->{'Name'} value=$a->{'Value'}\n";
68 #}
69 } else {
70 foreach my $t (2..4) {
71- print "skipped $t\n";
72+ print "\nSKIP test$t\n";
73 }
74 }
75
76@@ -53,9 +58,9 @@ my $data = "what do ya want for nothing?";
77 my $etalon_digest = hex_to_ascii("750c783e6ab0b503eaa86e310a5db738");
78 my $digest = Authen::Radius::hmac_md5(undef, $data, $key);
79 if ($etalon_digest eq $digest) {
80- print "ok 5\n";
81+ print "\nPASS: test5\n";
82 } else {
83- print "not ok 5\n";
84+ print "\nFAIL: test5\n";
85 }
86
87 exit;
88--
891.9.1
90
diff --git a/meta-perl/recipes-perl/libauthen/libauthen-radius-perl_0.22.bb b/meta-perl/recipes-perl/libauthen/libauthen-radius-perl_0.22.bb
new file mode 100644
index 000000000..ea5bb1b0c
--- /dev/null
+++ b/meta-perl/recipes-perl/libauthen/libauthen-radius-perl_0.22.bb
@@ -0,0 +1,39 @@
1SUMMARY = "Authen::Radius - provide simple Radius client facilities"
2DESCRIPTION = "The Authen::Radius module provides a simple class that \
3 allows you to send/receive Radius requests/responses to/from a \
4 Radius server. \
5"
6
7HOMEPAGE = "http://search.cpan.org/~manowar/RadiusPerl"
8SECTION = "libs"
9
10LICENSE = "Artistic-2.0"
11LIC_FILES_CHKSUM = "file://LICENSE;md5=78ab6ea0cba1f1ec1680ebb149e3bc11"
12
13DEPENDS = "perl"
14
15SRC_URI = "http://search.cpan.org/CPAN/authors/id/M/MA/MANOWAR/RadiusPerl-${PV}.tar.gz \
16 file://test.pl-adjust-for-ptest.patch \
17 file://run-ptest \
18"
19SRC_URI[md5sum] = "d1fe2d6ecf7ea99299e4e3a8f945aad8"
20SRC_URI[sha256sum] = "3b276506986ccaa4949d92b13ce053a0017ad11562a991cc753364923fe81ca7"
21
22S = "${WORKDIR}/Authen-Radius-${PV}"
23
24inherit cpan ptest
25
26do_install_ptest() {
27 install -m 0755 ${S}/test.pl ${D}${PTEST_PATH}
28}
29
30RDEPENDS_${PN} += "\
31 libdata-hexdump-perl \
32 perl-module-digest-md5 \
33 perl-module-data-dumper \
34 perl-module-io-select \
35 perl-module-io-socket \
36"
37RDEPENDS_${PN}-ptest += "${PN} freeradius"
38
39BBCLASSEXTEND = "native"