summaryrefslogtreecommitdiff
path: root/lib/tests
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/Makefile.am9
-rw-r--r--lib/tests/README27
-rw-r--r--lib/tests/demoCA/index.txt6
-rw-r--r--lib/tests/demoCA/newcerts/01.pem64
-rw-r--r--lib/tests/demoCA/newcerts/02.pem61
-rw-r--r--lib/tests/demoCA/newcerts/03.pem61
-rw-r--r--lib/tests/demoCA/private/c2key.pem9
-rw-r--r--lib/tests/demoCA/private/c3key.pem9
-rw-r--r--lib/tests/demoCA/private/cakey.pem14
-rw-r--r--lib/tests/demoCA/private/cli1.key9
-rw-r--r--lib/tests/demoCA/private/srv1.key9
-rw-r--r--lib/tests/test-udp.c106
-rw-r--r--lib/tests/test.conf2
-rw-r--r--lib/tests/udp-server.c3
-rw-r--r--lib/tests/udp.c6
-rw-r--r--lib/tests/udp.h3
16 files changed, 191 insertions, 207 deletions
diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 30f5e0f..fcd016b 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -1,16 +1,15 @@
AUTOMAKE_OPTIONS = foreign
-INCLUDES = -I$(top_srcdir)/include
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)
AM_CFLAGS = -Wall -Werror -g
TESTS = test-udp
check_PROGRAMS = test-udp udp-server tls-server
-test_udp_SOURCES = test-udp.c udp.c
-test_udp_LDADD = ../libradsec.la -lcgreen -lm
+test_udp_SOURCES = test-udp.c udp.c udp.h
+test_udp_LDADD = ../libradsec.la -lcunit -lm
-udp_server_SOURCES = udp-server.c udp.c
+udp_server_SOURCES = udp-server.c udp.c udp.h
tls_server_SOURCES = server.c
tls_server_LDADD = ../libradsec.la
-
diff --git a/lib/tests/README b/lib/tests/README
index 4d68bde..33bddc1 100644
--- a/lib/tests/README
+++ b/lib/tests/README
@@ -1,8 +1,14 @@
+This is the README file for the test directory of libradsec.
+
Build
-----
-In order to build and run the tests, you'll need to have libcgreen
-installed (http://www.lastcraft.com/cgreen.php).
+In order to build and run the tests, you'll need to have CUnit
+installed.
+
+Source code: http://cunit.sourceforge.net/
+Debian package: libcunit1-dev
+FreeBSD port: devel/cunit
Run
@@ -23,12 +29,11 @@ Run the tests by typing
The output should read something like
- Completed "main": 32 passes, 0 failures, 0 exceptions.
-
-
-When trying to debug the test programs under GDB you might run into
-trouble with multiple threads being executed by the test framework.
-If so, make sure to run a single test rather than the full test suite.
-For example:
-
- libtool --mode execute gdb --args test-udp test_auth
+ --Run Summary: Type Total Ran Passed Failed
+ suites 2 2 n/a 0
+ tests 2 2 2 0
+ asserts 23 23 23 0
+ PASS: test-udp
+ =============
+ 1 test passed
+ =============
diff --git a/lib/tests/demoCA/index.txt b/lib/tests/demoCA/index.txt
index d28b575..51f934f 100644
--- a/lib/tests/demoCA/index.txt
+++ b/lib/tests/demoCA/index.txt
@@ -1,3 +1,3 @@
-V 240216122242Z 01 unknown /C=SE/ST=Bogus State/O=Bogus Ltd/OU=Bogus/CN=My Bogus CA for testing libradsec
-V 240216123520Z 02 unknown /C=SE/ST=Bogus State/O=Bogus Ltd/OU=Bogus/CN=My Bogus Certificate for testing libradsec
-V 240216150052Z 03 unknown /C=SE/ST=Bogus State/O=Bogus Ltd/OU=Bogus/CN=My Bogus Client Certificate for testing libradsec
+V 250806115449Z 01 unknown /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=ca
+V 250806115457Z 02 unknown /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=srv1
+V 250806115504Z 03 unknown /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=cli1
diff --git a/lib/tests/demoCA/newcerts/01.pem b/lib/tests/demoCA/newcerts/01.pem
index 79fa539..29cb5ee 100644
--- a/lib/tests/demoCA/newcerts/01.pem
+++ b/lib/tests/demoCA/newcerts/01.pem
@@ -2,51 +2,45 @@ Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=SE, ST=Bogus State, O=Bogus Ltd, OU=Bogus, CN=My Bogus CA for testing libradsec
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=ca
Validity
- Not Before: Mar 25 12:22:42 2011 GMT
- Not After : Feb 16 12:22:42 2024 GMT
- Subject: C=SE, ST=Bogus State, O=Bogus Ltd, OU=Bogus, CN=My Bogus CA for testing libradsec
+ Not Before: Sep 12 11:54:49 2012 GMT
+ Not After : Aug 6 11:54:49 2025 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=ca
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public Key: (512 bit)
- Modulus (512 bit):
- 00:aa:27:7d:3b:29:12:1e:39:8d:9f:43:ad:ae:83:
- 6f:22:88:08:07:92:b9:1d:d4:88:5f:58:b9:76:ec:
- 4a:e9:c9:6a:73:ed:70:66:5e:6f:dc:02:15:9f:dd:
- 7a:5f:cc:3b:98:8a:27:b1:f5:98:fb:6b:c7:ab:5e:
- 5e:ea:3c:c4:5f
+ Public-Key: (512 bit)
+ Modulus:
+ 00:eb:9e:52:bf:1a:7c:32:63:9f:96:80:71:f1:98:
+ 87:90:97:f1:7a:4a:81:6d:66:7e:8e:7c:50:5f:f9:
+ 6e:94:1a:b0:7b:46:87:b5:9e:23:48:04:ad:f3:55:
+ a1:f9:31:50:a1:10:ab:ca:ba:70:ac:58:95:4e:9d:
+ 3a:2b:52:36:df
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
- 5A:9B:BA:E8:A6:9B:E9:78:73:1E:0B:83:00:49:94:46:13:9C:1C:89
+ 11:57:40:0B:F0:33:2F:AE:C2:DA:A4:3A:00:BA:E9:34:B3:75:20:05
X509v3 Authority Key Identifier:
- keyid:5A:9B:BA:E8:A6:9B:E9:78:73:1E:0B:83:00:49:94:46:13:9C:1C:89
- DirName:/C=SE/ST=Bogus State/O=Bogus Ltd/OU=Bogus/CN=My Bogus CA for testing libradsec
- serial:01
+ keyid:11:57:40:0B:F0:33:2F:AE:C2:DA:A4:3A:00:BA:E9:34:B3:75:20:05
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha1WithRSAEncryption
- 18:a2:21:92:a6:2a:e0:a4:4d:57:c0:89:94:5c:b0:26:64:f8:
- b1:0c:97:f8:cd:d5:af:c8:38:3e:a3:68:47:82:e1:a6:2e:63:
- 97:4d:c0:79:f5:9a:ff:38:67:10:d6:22:61:44:89:84:50:85:
- ee:38:87:6d:4f:06:10:36:33:39
+ 15:12:3b:79:3d:61:d2:c7:d2:a8:0c:df:82:ea:66:76:26:cb:
+ ab:b5:83:a3:52:a0:23:1a:a9:92:8e:93:41:f7:6c:3f:8a:2c:
+ bd:32:3d:70:3f:b6:fd:f2:37:50:0a:66:8c:1c:44:bf:ef:50:
+ 24:33:bd:48:47:04:ee:8c:61:88
-----BEGIN CERTIFICATE-----
-MIICqDCCAlKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJTRTEU
-MBIGA1UECBMLQm9ndXMgU3RhdGUxEjAQBgNVBAoTCUJvZ3VzIEx0ZDEOMAwGA1UE
-CxMFQm9ndXMxKjAoBgNVBAMTIU15IEJvZ3VzIENBIGZvciB0ZXN0aW5nIGxpYnJh
-ZHNlYzAeFw0xMTAzMjUxMjIyNDJaFw0yNDAyMTYxMjIyNDJaMHMxCzAJBgNVBAYT
-AlNFMRQwEgYDVQQIEwtCb2d1cyBTdGF0ZTESMBAGA1UEChMJQm9ndXMgTHRkMQ4w
-DAYDVQQLEwVCb2d1czEqMCgGA1UEAxMhTXkgQm9ndXMgQ0EgZm9yIHRlc3Rpbmcg
-bGlicmFkc2VjMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKonfTspEh45jZ9Dra6D
-byKICAeSuR3UiF9YuXbsSunJanPtcGZeb9wCFZ/del/MO5iKJ7H1mPtrx6teXuo8
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7b98jdQCmaMHES/71Ak
+M71IRwTujGGI
-----END CERTIFICATE-----
diff --git a/lib/tests/demoCA/newcerts/02.pem b/lib/tests/demoCA/newcerts/02.pem
index 4345003..2e1cccb 100644
--- a/lib/tests/demoCA/newcerts/02.pem
+++ b/lib/tests/demoCA/newcerts/02.pem
@@ -2,21 +2,21 @@ Certificate:
Data:
Version: 3 (0x2)
Serial Number: 2 (0x2)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=SE, ST=Bogus State, O=Bogus Ltd, OU=Bogus, CN=My Bogus CA for testing libradsec
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=ca
Validity
- Not Before: Mar 25 12:35:20 2011 GMT
- Not After : Feb 16 12:35:20 2024 GMT
- Subject: C=SE, ST=Bogus State, O=Bogus Ltd, OU=Bogus, CN=My Bogus Certificate for testing libradsec
+ Not Before: Sep 12 11:54:57 2012 GMT
+ Not After : Aug 6 11:54:57 2025 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=srv1
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public Key: (512 bit)
- Modulus (512 bit):
- 00:c3:e5:16:74:47:84:bb:26:bc:50:fe:dc:b5:70:
- 21:ad:21:b6:ff:cb:ac:b2:24:9e:08:75:39:5d:ba:
- f4:b1:59:f6:a8:14:02:62:c3:68:6d:f2:08:9b:fe:
- 66:5c:72:92:16:04:60:b5:08:83:66:28:3b:46:f0:
- cf:95:37:b7:d7
+ Public-Key: (512 bit)
+ Modulus:
+ 00:ac:21:78:6f:cb:1c:10:c2:71:7b:72:03:e3:4b:
+ b2:c7:f6:63:3f:69:d3:d3:48:e0:90:16:0f:5a:44:
+ f5:9c:ed:b9:6b:72:be:11:6e:26:09:32:0c:51:25:
+ 10:35:fe:a0:33:fe:cf:90:9f:2c:8b:3a:c5:98:86:
+ c2:a9:5c:ba:a7
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -24,27 +24,26 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- 89:23:42:95:2B:52:A4:77:FC:5E:59:CA:8D:E0:30:AF:D3:B5:C3:C2
+ 08:13:6F:A0:93:47:21:31:9F:02:79:A5:CF:24:4A:D1:0B:A7:10:09
X509v3 Authority Key Identifier:
- keyid:5A:9B:BA:E8:A6:9B:E9:78:73:1E:0B:83:00:49:94:46:13:9C:1C:89
+ keyid:11:57:40:0B:F0:33:2F:AE:C2:DA:A4:3A:00:BA:E9:34:B3:75:20:05
Signature Algorithm: sha1WithRSAEncryption
- 60:71:c8:00:ba:88:67:97:75:97:0a:f7:77:70:7d:dc:91:24:
- 35:5b:ce:5b:cf:24:00:9b:d1:8f:f0:63:58:76:24:f3:67:06:
- a3:ad:e3:43:13:30:d0:d4:62:64:d5:78:4a:aa:9c:13:bc:ea:
- 7c:99:8e:5f:b6:c6:5f:11:0d:c9
+ 2c:7e:61:65:48:cc:46:50:58:cc:9d:1b:b2:e7:2d:2b:72:e2:
+ a1:2f:2c:14:35:4d:b8:42:87:66:57:77:c4:02:17:fa:3c:db:
+ 83:3f:89:37:ae:f8:e9:00:fe:96:d8:4b:80:63:db:08:7a:c6:
+ e1:c7:59:ec:d9:76:4a:be:1a:19
-----BEGIN CERTIFICATE-----
-MIICWzCCAgWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJTRTEU
-MBIGA1UECBMLQm9ndXMgU3RhdGUxEjAQBgNVBAoTCUJvZ3VzIEx0ZDEOMAwGA1UE
-CxMFQm9ndXMxKjAoBgNVBAMTIU15IEJvZ3VzIENBIGZvciB0ZXN0aW5nIGxpYnJh
-ZHNlYzAeFw0xMTAzMjUxMjM1MjBaFw0yNDAyMTYxMjM1MjBaMHwxCzAJBgNVBAYT
-AlNFMRQwEgYDVQQIEwtCb2d1cyBTdGF0ZTESMBAGA1UEChMJQm9ndXMgTHRkM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Q4EFgQUCBNvoJNHITGfAnmlzyRK0QunEAkwHwYDVR0jBBgwFoAU
+EVdAC/AzL67C2qQ6ALrpNLN1IAUwDQYJKoZIhvcNAQEFBQADQQAsfmFlSMxGUFjM
+nRuy5y0rcuKhLywUNU24QodmV3fEAhf6PNuDP4k3rvjpAP6W2EuAY9sIesbhx1ns
+2XZKvhoZ
-----END CERTIFICATE-----
diff --git a/lib/tests/demoCA/newcerts/03.pem b/lib/tests/demoCA/newcerts/03.pem
index ab42785..d07be19 100644
--- a/lib/tests/demoCA/newcerts/03.pem
+++ b/lib/tests/demoCA/newcerts/03.pem
@@ -2,21 +2,21 @@ Certificate:
Data:
Version: 3 (0x2)
Serial Number: 3 (0x3)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C=SE, ST=Bogus State, O=Bogus Ltd, OU=Bogus, CN=My Bogus CA for testing libradsec
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=ca
Validity
- Not Before: Mar 25 15:00:52 2011 GMT
- Not After : Feb 16 15:00:52 2024 GMT
- Subject: C=SE, ST=Bogus State, O=Bogus Ltd, OU=Bogus, CN=My Bogus Client Certificate for testing libradsec
+ Not Before: Sep 12 11:55:04 2012 GMT
+ Not After : Aug 6 11:55:04 2025 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=cli1
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public Key: (512 bit)
- Modulus (512 bit):
- 00:ae:ba:06:81:e2:7c:a8:ee:4e:fa:46:a3:dd:c7:
- d4:f8:33:80:c0:43:09:bd:a7:7d:59:4a:c8:af:3f:
- 07:54:72:4c:b1:ac:2e:53:5a:c0:b6:6c:06:55:97:
- 55:36:cb:fc:7d:5d:c1:c1:97:95:52:a7:a8:da:b0:
- b3:3a:0d:b7:87
+ Public-Key: (512 bit)
+ Modulus:
+ 00:99:7b:86:e0:46:de:f1:69:10:97:f8:4e:78:c8:
+ ee:c2:c8:65:64:90:72:dd:51:4f:c6:58:78:49:07:
+ 61:b9:ed:0a:77:7b:d2:6a:c3:49:e5:91:6c:bf:78:
+ d0:fc:8a:5c:80:1a:b0:03:28:b2:ea:e8:c8:a0:b6:
+ be:a1:42:30:5d
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -24,27 +24,26 @@ Certificate:
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
- 70:83:4E:39:98:5A:B6:8E:C7:18:95:57:E9:44:BC:26:0F:78:95:45
+ 10:17:90:80:D8:B0:7E:91:91:13:32:27:8C:EF:A6:DE:9F:C1:C4:A7
X509v3 Authority Key Identifier:
- keyid:5A:9B:BA:E8:A6:9B:E9:78:73:1E:0B:83:00:49:94:46:13:9C:1C:89
+ keyid:11:57:40:0B:F0:33:2F:AE:C2:DA:A4:3A:00:BA:E9:34:B3:75:20:05
Signature Algorithm: sha1WithRSAEncryption
- 72:ea:52:71:bf:6e:9c:de:0d:3a:e7:18:ed:21:46:37:3a:d4:
- 7f:21:ff:21:6a:09:fd:4e:fa:85:0a:fb:46:b5:2d:53:3a:25:
- 2d:40:44:ee:48:81:9d:6d:5e:cf:20:aa:a1:e8:a7:22:d5:ae:
- 58:35:92:ea:bb:b5:a6:f7:29:5c
+ b1:08:87:88:7d:90:78:01:da:4a:e7:be:82:22:3f:58:07:f7:
+ 46:a9:9a:42:a4:88:d9:b8:6a:69:bf:cb:d0:39:2d:c9:49:06:
+ fa:31:80:66:17:32:cc:e8:ae:36:9c:c1:d5:ae:6d:3c:eb:72:
+ 77:55:92:fa:ab:f5:a3:bc:19:2d
-----BEGIN CERTIFICATE-----
-MIICYzCCAg2gAwIBAgIBAzANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJTRTEU
-MBIGA1UECBMLQm9ndXMgU3RhdGUxEjAQBgNVBAoTCUJvZ3VzIEx0ZDEOMAwGA1UE
-CxMFQm9ndXMxKjAoBgNVBA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8WkQl/hOeMjuwshlZJBy3VFPxlh4SQdh
+ue0Kd3vSasNJ5ZFsv3jQ/IpcgBqwAyiy6ujIoLa+oUIwXQIDAQABo3sweTAJBgNV
+HRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZp
+Y2F0ZTAdBgNVHQ4EFgQUEBeQgNiwfpGREzInjO+m3p/BxKcwHwYDVR0jBBgwFoAU
+EVdAC/AzL67C2qQ6ALrpNLN1IAUwDQYJKoZIhvcNAQEFBQADQQCxCIeIfZB4AdpK
+576CIj9YB/dGqZpCpIjZuGppv8vQOS3JSQb6MYBmFzLM6K42nMHVrm0863J3VZL6
+q/WjvBkt
-----END CERTIFICATE-----
diff --git a/lib/tests/demoCA/private/c2key.pem b/lib/tests/demoCA/private/c2key.pem
deleted file mode 100644
index 6b0c1ee..0000000
--- a/lib/tests/demoCA/private/c2key.pem
+++ /dev/null
@@ -1,9 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIBOQIBAAJBAMPlFnRHhLsmvFD+3LVwIa0htv/LrLIkngh1OV269LFZ9qgUAmLD
-aG3yCJv+ZlxykhYEYLUIg2YoO0bwz5U3t9cCAwEAAQJAZtVEg0fj2mbMJmyTqb8y
-PnNbYE4n2uA0AVagBZ8Vwl7+rV84tSxXqfZt+G+I9iIwdGZzw9PKEgITX802MTjx
-cQIhAPJmBKucvt8d/a9BjvWaOT51anzWBiG+2FJ3dsM9t1+vAiEAzuMPCITPXNlL
-1frMDuqqcY8XuEN4Drru/Bs/ChlIzFkCIQDuge1Ugt3YoiTsniAxj7eFuni2Ls1H
-xQYLVtr3zzEwpwIfTMX1zjN6v/njKoTnNKHgnkN7ieV/p/e2t9dkjVrUqQIgYzK1
-atYmygSrgsaPkwpYXNVrNBJmBDJpd68pb59wM2Y=
------END RSA PRIVATE KEY-----
diff --git a/lib/tests/demoCA/private/c3key.pem b/lib/tests/demoCA/private/c3key.pem
deleted file mode 100644
index 21b8b3b..0000000
--- a/lib/tests/demoCA/private/c3key.pem
+++ /dev/null
@@ -1,9 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIBOgIBAAJBAK66BoHifKjuTvpGo93H1PgzgMBDCb2nfVlKyK8/B1RyTLGsLlNa
-wLZsBlWXVTbL/H1dwcGXlVKnqNqwszoNt4cCAwEAAQJAWnD6G1Mj2cF46f2UpqDg
-cRUfqOVKbnv62zRliqiiX6fqpGV85mIcBKzh2GhqtL9xxdFSa7MXxllsKQ5M+EkF
-kQIhAOY0HjDtlknbkXCUJyBeOdJsw8F7RaeEdjBOlUMCuQwpAiEAwk5u7RsIy3m3
-TRiAFVpqOWuFZ6WB+0Hsx13tOS7AHC8CIF6iwl6e7Y/DYhED9unJkr+80uTxhnsN
-a4EEbTw1HFmxAiA1rOUHqsgrLVxtd68qNufRJNqdXyMg/X0jNdcqTLfVEQIhAKYP
-+3yM6TAtaTu+lSdhqQokBp77Reco0hYkLkRm3aPO
------END RSA PRIVATE KEY-----
diff --git a/lib/tests/demoCA/private/cakey.pem b/lib/tests/demoCA/private/cakey.pem
index 6c60bc7..e7df9d0 100644
--- a/lib/tests/demoCA/private/cakey.pem
+++ b/lib/tests/demoCA/private/cakey.pem
@@ -1,9 +1,9 @@
-----BEGIN RSA PRIVATE KEY-----
-MIIBOwIBAAJBAKonfTspEh45jZ9Dra6DbyKICAeSuR3UiF9YuXbsSunJanPtcGZe
-b9wCFZ/del/MO5iKJ7H1mPtrx6teXuo8xF8CAwEAAQJASypsqPDIvy9ff6avF/OZ
-6aA8I9ROEH5ty+ju7TkPEt0dgtcA20m20FtbkKuv1ymEAQk2DbfibWgVfu8NtXia
-gQIhAN04azjSAO94wlahTblo9NOe3Sl9VoSju/P2vPZhMbufAiEAxOfIdv7eUYxW
-tfdF58H6R5SKt/PJ3f5ofIAcIMqQP0ECIGTacdeHtjF2xnKkO0EKHoPT61Qc9jKm
-SuvgUymoCfpVAiEAigtdlV9ViaJz4Bq9nZ920dwn7JMzwTjtE+vUzIB25IECIQC4
-Hp8D00gBVlUgW0OlpmA3PWa3TfkEL3pghZqgeYZzXA==
+MIIBOgIBAAJBAOueUr8afDJjn5aAcfGYh5CX8XpKgW1mfo58UF/5bpQasHtGh7We
+I0gErfNVofkxUKEQq8q6cKxYlU6dOitSNt8CAwEAAQJAR+SmQPN24/Ur88M7gUlW
+TBNgtjzXoyb8BMP/zlkQmZW5Tcv1xCa1UwK33u2wSmhSNP6zA1QrC2d2pv/7XZEp
+wQIhAPpf2QuEooR5BPrvDiAVPlKp31EROrZOiOV5hbV1Kzx/AiEA8OmZZrvgrdQu
+3PKRLfxD11NKf0yhC+7WdVWguYZ1VaECIF99XMcyz9TcXxThRa7gy0M1vJErlAvh
+yf5TKba6OEI7AiBpNctdl11G7OxOZ8zJZWsHRYO6Vm/as0KLWYromvTxIQIhAK0c
+r+G23R+dHDUdNEBSi6G74dbaJqaA8LsVr9w9m5gY
-----END RSA PRIVATE KEY-----
diff --git a/lib/tests/demoCA/private/cli1.key b/lib/tests/demoCA/private/cli1.key
new file mode 100644
index 0000000..09381f1
--- /dev/null
+++ b/lib/tests/demoCA/private/cli1.key
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOQIBAAJBAJl7huBG3vFpEJf4TnjI7sLIZWSQct1RT8ZYeEkHYbntCnd70mrD
+SeWRbL940PyKXIAasAMosuroyKC2vqFCMF0CAwEAAQJAEozki1zle0YYlFWVnnGi
+sfYokxQGXguC2dU9jI4Q2LjGut6mVx/zLIU59BS4nUq2aYHg0hxwwzOba92c0lT/
+HQIhAMp0+k7FtDdRQzIaDzeEY6MYyLhhhukhI3xpyXYVuyx7AiEAwhLQl6hYlsgh
+78CzTAhAdbheAwIQWyvY7XjKzxdpGwcCIG/hr0YC2bHMNZ8laY1bmxhRpPLH6p9A
+0fR6HXwlTDerAiA1y21SfHGB6huuD2Yjry3e86nrf4j1HKRWvuLIoJ6bxQIgWmyj
+YOSFsaBwj9ptkY0d4H84SDHnt7GRypm0/98OSg8=
+-----END RSA PRIVATE KEY-----
diff --git a/lib/tests/demoCA/private/srv1.key b/lib/tests/demoCA/private/srv1.key
new file mode 100644
index 0000000..284f1e1
--- /dev/null
+++ b/lib/tests/demoCA/private/srv1.key
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBAKwheG/LHBDCcXtyA+NLssf2Yz9p09NI4JAWD1pE9ZztuWtyvhFu
+JgkyDFElEDX+oDP+z5CfLIs6xZiGwqlcuqcCAwEAAQJAbviJF7GfH2LsHISt4vyr
+fuTmqTxF1wI13E6MiUrJ+eftT7Hq1Wq6B7gmlI1iJiJLlAH6o93PYhp8559Dfp+q
+wQIhAOMbFp0NJPrVpycx5dQAYpM/edqXoOENQf1lMLOmOHlhAiEAwgfTbAaGNfQS
+uXfzj0sx+IvoKE/MXfLKZ/uE9futCQcCIQC/mMjZMo+yNrHQdV5KHxEK3RB2hFmr
+xD2aA9a0mVUnwQIgbYjHdNNWDr1DmMo7h+g2RI6Ot7scruiyFPNrgwXaEB8CICMa
+8wjF27wlJ2nmhM9ZXUBtvBKgU+jspsA8n+wU+o+f
+-----END RSA PRIVATE KEY-----
diff --git a/lib/tests/test-udp.c b/lib/tests/test-udp.c
index ccad607..ed176c0 100644
--- a/lib/tests/test-udp.c
+++ b/lib/tests/test-udp.c
@@ -1,24 +1,26 @@
+/* Copyright 2011,2013, NORDUnet A/S. All rights reserved. */
+/* See LICENSE for licensing information. */
+
#include <stdlib.h>
-#include <cgreen/cgreen.h>
+#include <assert.h>
+#include <CUnit/Basic.h>
+#include "radius/client.h"
#include "radsec/radsec.h"
#include "radsec/request.h"
#include "udp.h"
-#define true 1 /* FIXME: Bug report cgreen. */
-#define false 0
-
static void
authenticate (struct rs_connection *conn, const char *user, const char *pw)
{
struct rs_request *req;
struct rs_packet *msg, *resp;
- assert_true (rs_request_create (conn, &req) == 0);
- assert_true (rs_packet_create_authn_request (conn, &msg, user, pw) == 0);
+ CU_ASSERT (rs_request_create (conn, &req) == 0);
+ CU_ASSERT (!rs_packet_create_authn_request (conn, &msg, user, pw));
rs_request_add_reqpkt (req, msg);
- assert_true (rs_request_send (req, &resp) == 0);
+ CU_ASSERT (rs_request_send (req, &resp) == 0);
//printf ("%s\n", rs_err_msg (rs_err_conn_pop (conn), 1));
- assert_true (rs_packet_code(resp) == PW_ACCESS_ACCEPT);
+ CU_ASSERT (rs_packet_code(resp) == PW_ACCESS_ACCEPT);
rs_request_destroy (req);
}
@@ -28,10 +30,10 @@ send_more_than_one_msg_in_one_packet (struct rs_connection *conn)
{
struct rs_packet *msg0, *msg1;
- assert_true (rs_packet_create_authn_request (conn, &msg0, NULL, NULL) == 0);
- assert_true (rs_packet_create_authn_request (conn, &msg1, NULL, NULL) == 0);
- assert_true (rs_packet_send (msg0, NULL) == 0);
- assert_true (rs_packet_send (msg1, NULL) == 0);
+ CU_ASSERT (rs_packet_create_authn_request (conn, &msg0, NULL, NULL) == 0);
+ CU_ASSERT (rs_packet_create_authn_request (conn, &msg1, NULL, NULL) == 0);
+ CU_ASSERT (rs_packet_send (msg0, NULL) == 0);
+ CU_ASSERT (rs_packet_send (msg1, NULL) == 0);
}
#if 0
@@ -44,18 +46,18 @@ send_large_packet (struct rs_connection *conn)
int f;
buf = malloc (RS_MAX_PACKET_LEN);
- assert_true (buf != NULL);
+ CU_ASSERT (buf != NULL);
memset (buf, 0, RS_MAX_PACKET_LEN);
- assert_true (rs_packet_create (conn, &msg0) == 0);
+ CU_ASSERT (rs_packet_create (conn, &msg0) == 0);
/* 16 chunks --> heap corruption in evbuffer_drain detected by free() */
for (f = 0; f < 15; f++)
{
memset (buf, 'a' + f, 252);
//vp = pairmake ("EAP-Message", buf, T_OP_EQ);
- assert_true (rs_packet_append_avp (msg0, fixme...) == RSE_OK);
+ CU_ASSERT (rs_packet_append_avp (msg0, fixme...) == RSE_OK);
}
- assert_true (rs_packet_send (msg0, NULL) == 0);
+ CU_ASSERT (rs_packet_send (msg0, NULL) == 0);
}
#endif /* 0 */
@@ -78,10 +80,9 @@ test_auth ()
setup.username = "molgan@PROJECT-MOONSHOT.ORG";
setup.pw = "password";
- assert_true (rs_context_create (&ctx) == 0);
- assert_true (rs_context_read_config (ctx, setup.config_file) == 0);
- assert_true (rs_context_init_freeradius_dict (ctx, NULL) == 0);
- assert_true (rs_conn_create (ctx, &conn, setup.config_name) == 0);
+ CU_ASSERT (rs_context_create (&ctx) == 0);
+ CU_ASSERT (rs_context_read_config (ctx, setup.config_file) == 0);
+ CU_ASSERT (rs_conn_create (ctx, &conn, setup.config_name) == 0);
authenticate (conn, setup.username, setup.pw);
@@ -97,9 +98,9 @@ test_buffering_cb (const uint8_t *buf, ssize_t len)
#if 0
hd (buf, len);
#endif
- assert_true (len >= 20);
- assert_true (len <= RS_MAX_PACKET_LEN);
- assert_true ((buf[2] << 8) + buf[3] == len);
+ CU_ASSERT (len >= 20);
+ CU_ASSERT (len <= RS_MAX_PACKET_LEN);
+ CU_ASSERT ((buf[2] << 8) + buf[3] == len);
return len;
}
@@ -111,34 +112,19 @@ test_buffering ()
struct timeval timeout;
struct polldata *polldata;
- assert_true (rs_context_create (&ctx) == 0);
- assert_true (rs_context_read_config (ctx, "test.conf") == 0);
- assert_true (rs_conn_create (ctx, &conn, "test-udp-buffering") == 0);
+ CU_ASSERT (rs_context_create (&ctx) == 0);
+ CU_ASSERT (rs_context_read_config (ctx, "test.conf") == 0);
+ CU_ASSERT (rs_conn_create (ctx, &conn, "test-udp-buffering") == 0);
timeout.tv_sec = 0;
timeout.tv_usec = 150000;
polldata = udp_server ("11820", &timeout, test_buffering_cb);
- assert_true (polldata != NULL);
+ CU_ASSERT (polldata != NULL);
send_more_than_one_msg_in_one_packet (conn);
- assert_true (udp_poll (polldata) > 0);
- assert_true (udp_poll (polldata) > 0);
+ CU_ASSERT (udp_poll (polldata) > 0);
+ CU_ASSERT (udp_poll (polldata) > 0);
-#if 0
-"
-send_large_packet() disabled, it's hanging after
-
-Sending Access-Request of id 1 to (null) port 0
- Message-Authenticator = 0x00000000000000000000000000000000
-packet_do_send: about to send this to localhost:11820:
- Code: 1, Identifier: 1, Lenght: 38
-rs_packet_send: entering event loop
-_evcb: fd=5 what = WRITE
-rs_packet_send: event loop done
-"
- send_large_packet (conn);
- assert_true (udp_poll (polldata) > 0);
-#endif /* 0 */
udp_free_polldata (polldata);
rs_conn_destroy (conn);
@@ -146,28 +132,22 @@ rs_packet_send: event loop done
}
/* ************************************************************ */
-static void
-setup_auth (TestSuite *ts)
-{
- add_test (ts, test_auth);
-}
-
-static void
-setup_buffering (TestSuite *ts)
-{
- add_test (ts, test_buffering);
-}
-
int
main (int argc, char *argv[])
{
- TestSuite *ts = create_test_suite ();
+ CU_pSuite s = NULL;
+ CU_pTest t = NULL;
+ unsigned int nfail;
+
+ assert (CU_initialize_registry () == CUE_SUCCESS);
+ s = CU_add_suite ("auth", NULL, NULL); assert (s);
+ t = CU_ADD_TEST (s, test_auth); assert (t);
+ s = CU_add_suite ("buffering", NULL, NULL); assert (s);
+ t = CU_ADD_TEST (s, test_buffering); assert (t);
- setup_auth (ts);
- setup_buffering (ts);
+ assert (CU_basic_run_tests () == CUE_SUCCESS);
+ nfail = CU_get_number_of_failures();
- if (argc > 1)
- return run_single_test (ts, argv[1], create_text_reporter ());
- else
- return run_test_suite (ts, create_text_reporter ());
+ CU_cleanup_registry ();
+ return nfail;
}
diff --git a/lib/tests/test.conf b/lib/tests/test.conf
index 839fd75..98d0330 100644
--- a/lib/tests/test.conf
+++ b/lib/tests/test.conf
@@ -1,5 +1,3 @@
-dictionary = "/home/linus/usr/moonshot/share/freeradius/dictionary"
-
realm test-udp-auth {
type = "UDP"
server {
diff --git a/lib/tests/udp-server.c b/lib/tests/udp-server.c
index ce0136a..77a35df 100644
--- a/lib/tests/udp-server.c
+++ b/lib/tests/udp-server.c
@@ -1,3 +1,6 @@
+/* Copyright 2011, NORDUnet A/S. All rights reserved. */
+/* See LICENSE for licensing information. */
+
#include <stdlib.h>
#include <stdio.h>
#include "udp.h"
diff --git a/lib/tests/udp.c b/lib/tests/udp.c
index 47ea595..2c580da 100644
--- a/lib/tests/udp.c
+++ b/lib/tests/udp.c
@@ -1,3 +1,6 @@
+/* Copyright 2011,2013, NORDUnet A/S. All rights reserved. */
+/* See LICENSE for licensing information. */
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -10,6 +13,7 @@
#include <netdb.h>
#include <sys/select.h>
#include <sys/time.h>
+#include "radius/client.h"
#include "udp.h"
static struct addrinfo *
@@ -57,7 +61,7 @@ ssize_t
udp_poll (struct polldata *data)
{
int r;
- long timeout;
+ long timeout = 0;
fd_set rfds;
ssize_t len;
uint8_t buf[RS_MAX_PACKET_LEN];
diff --git a/lib/tests/udp.h b/lib/tests/udp.h
index 004b7ca..a8d5f23 100644
--- a/lib/tests/udp.h
+++ b/lib/tests/udp.h
@@ -1,3 +1,6 @@
+/* Copyright 2011, NORDUnet A/S. All rights reserved. */
+/* See LICENSE for licensing information. */
+
#include <stdint.h>
#include <unistd.h>
#include <sys/time.h>