]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use the ID for calculating CHAP.
authorAlan T. DeKok <aland@freeradius.org>
Wed, 22 Jul 2020 13:10:56 +0000 (09:10 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 22 Jul 2020 13:32:49 +0000 (09:32 -0400)
We do NOT want to skip that.  It's BAD!

Add test cases so that this doesn't happen again.

src/protocols/radius/encode.c
src/tests/auth/chap_mac_auth [new file with mode: 0644]
src/tests/auth/chap_mac_auth.attrs [new file with mode: 0644]
src/tests/auth/chap_mac_auth_2 [new file with mode: 0644]
src/tests/auth/chap_mac_auth_2.attrs [new file with mode: 0644]

index 4d757ce22c83bd10f9f36a881f8eaab153c53f00..5f9a2fddfe81f5b39168cf684320f085cf9d7843 100644 (file)
@@ -63,8 +63,9 @@ void fr_radius_encode_chap_password(uint8_t out[static 1 + RADIUS_CHAP_CHALLENGE
        md5_ctx = fr_md5_ctx_alloc(true);
 
        /*
-        *      First ingest the password
+        *      First ingest the ID and the password.
         */
+       fr_md5_update(md5_ctx, (uint8_t const *)&id, 1);
        fr_md5_update(md5_ctx, (uint8_t const *)password, password_len);
 
        /*
diff --git a/src/tests/auth/chap_mac_auth b/src/tests/auth/chap_mac_auth
new file mode 100644 (file)
index 0000000..8005111
--- /dev/null
@@ -0,0 +1,3 @@
+update control {
+       &Cleartext-Password := &User-Name
+}
diff --git a/src/tests/auth/chap_mac_auth.attrs b/src/tests/auth/chap_mac_auth.attrs
new file mode 100644 (file)
index 0000000..1276d90
--- /dev/null
@@ -0,0 +1,5 @@
+User-Name = "08000f510d1e"
+CHAP-Password = 0x9fdc274c2e3ca36a66a0581a10d44a7dd2
+CHAP-Challenge = 0xe7714b9a5d8463e7947041bdbf399c17
+
+Packet-Type == Access-Accept
diff --git a/src/tests/auth/chap_mac_auth_2 b/src/tests/auth/chap_mac_auth_2
new file mode 100644 (file)
index 0000000..8005111
--- /dev/null
@@ -0,0 +1,3 @@
+update control {
+       &Cleartext-Password := &User-Name
+}
diff --git a/src/tests/auth/chap_mac_auth_2.attrs b/src/tests/auth/chap_mac_auth_2.attrs
new file mode 100644 (file)
index 0000000..ac3f7b1
--- /dev/null
@@ -0,0 +1,5 @@
+User-Name =  "08000f510d1e"
+CHAP-Password = 0xa1526f5b6d5cc40d3d87df334515befc07
+CHAP-Challenge = 0xbf61a943b98f4d1b9e9885677705a6b8
+
+Packet-Type == Access-Accept