size_t iterations = 0;
fr_dict_t const *dict;
+ fr_pair_parse_t root, relative;
fr_pair_list_init(&head);
+
slen = load_test_point_by_command((void **)&tp, p, "tp_encode_pair");
if (!tp) {
fr_strerror_const_push("Failed locating encode testpoint");
}
dict = cc->tmpl_rules.attr.dict_def ? cc->tmpl_rules.attr.dict_def : cc->config->dict;
- if (fr_pair_list_afrom_str(cc->tmp_ctx, fr_dict_root(dict),
- p, in + inlen - p, &head) != T_EOL) {
+
+ root = (fr_pair_parse_t) {
+ .ctx = cc->tmp_ctx,
+ .da = fr_dict_root(dict),
+ .list = &head,
+ };
+ relative = (fr_pair_parse_t) { };
+
+ slen = fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(p, inlen - (p - in)));
+ if (slen <= 0) {
CLEAR_TEST_POINT(cc);
RETURN_OK_WITH_ERROR();
}
+ PAIR_LIST_VERIFY(&head);
+
/*
* Outer loop implements truncate test
*/
fr_pair_list_t head;
fr_dict_t const *dict;
+ fr_pair_parse_t root, relative;
fr_pair_list_init(&head);
}
dict = cc->tmpl_rules.attr.dict_def ? cc->tmpl_rules.attr.dict_def : cc->config->dict;
- if (fr_pair_list_afrom_str(cc->tmp_ctx, fr_dict_root(dict),
- p, in + inlen - p, &head) != T_EOL) {
+
+ root = (fr_pair_parse_t) {
+ .ctx = cc->tmp_ctx,
+ .da = fr_dict_root(dict),
+ .list = &head,
+ };
+ relative = (fr_pair_parse_t) { };
+
+ slen = fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(p, inlen - (p - in)));
+ if (slen <= 0) {
CLEAR_TEST_POINT(cc);
RETURN_OK_WITH_ERROR();
}
fr_pair_list_t head;
ssize_t slen;
fr_dict_t const *dict = cc->tmpl_rules.attr.dict_def ? cc->tmpl_rules.attr.dict_def : cc->config->dict;
+ fr_pair_parse_t root, relative;
fr_pair_list_init(&head);
- if (fr_pair_list_afrom_str(NULL, fr_dict_root(dict), in, inlen, &head) != T_EOL) {
+ root = (fr_pair_parse_t) {
+ .ctx = cc->tmp_ctx,
+ .da = fr_dict_root(dict),
+ .list = &head,
+ };
+ relative = (fr_pair_parse_t) { };
+
+ slen = fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(in, inlen));
+ if (slen <= 0) {
+// fr_strerror_printf_push_head("ERROR offset %d", (int) -slen);
fr_pair_list_free(&head);
RETURN_OK_WITH_ERROR();
}
decode-proto 020200eb8b7a26bee11f1ca308233d49733187720506000030391217506f776572656420627920467265655241444955531a0c000004d23806deadbeef1a0c000000141e06cafecafe1a0c000000141e06cadecade1a1200000be1130c6d792070726f66696c651a0c00000be11006000000051a0c000001370706000000011a2a0000013711248701b3e481d72fa1333b9838a3cd448837eaed62a843295f1c9dd153c6866e499f201a2a0000013710249385f7dc0fd758b02dd0dc43f68266508ec93c678a5fa38525749016edede8eeea0e4f0603fc0004501200e9e565eb053138254850edb41fc013
match Packet-Type = Access-Accept, Packet-Authentication-Vector = 0x8b7a26bee11f1ca308233d4973318772, NAS-Port = 12345, Reply-Message = "Powered by FreeRADIUS", Vendor-Specific = { raw.1234 = { raw.56 = 0xdeadbeef }, raw.20 = { raw.30 = 0xcafecafe }, raw.20 = { raw.30 = 0xcadecade }, Alcatel = { FR-Direct-Profile = "my profile", Home-Agent-UDP-Port = 5 }, Microsoft = { MPPE-Encryption-Policy = Encryption-Allowed, raw.MPPE-Recv-Key = 0x8701b3e481d72fa1333b9838a3cd448837eaed62a843295f1c9dd153c6866e499f20, raw.MPPE-Send-Key = 0x9385f7dc0fd758b02dd0dc43f68266508ec93c678a5fa38525749016edede8eeea0e } }, EAP-Message = 0x03fc0004, Message-Authenticator = 0x00e9e565eb053138254850edb41fc013
+pair Vendor-Specific = { raw.1234 = { raw.56 = 0xdeadbeef } }
+match Vendor-Specific = { raw.1234 = { raw.56 = 0xdeadbeef } }
+
encode-pair Vendor-Specific = { raw.1234 = { raw.56 = 0xdeadbeef } }
match 1a 0c 00 00 04 d2 38 06 de ad be ef
match NAS-Port = 12345, Reply-Message = "Powered by FreeRADIUS", Vendor-Specific = { raw.1234 = { raw.56 = 0xdeadbeef }, raw.20 = { raw.30 = 0xcafecafe }, raw.20 = { raw.30 = 0xcadecade }, Alcatel = { FR-Direct-Profile = "my profile", Home-Agent-UDP-Port = 5 } }
count
-match 15
+match 17
match Tag-1 = { Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
pair Tag-2 = { &Vendor-Specific.Unisphere.Service-Activate = "PPPOE_SERVICE(3072000,2048000)" }
-match Tag-2 = { Vendor-Specific.Unisphere.Service-Activate = "PPPOE_SERVICE(3072000,2048000)" }
+match Tag-2 = { Vendor-Specific = { Unisphere = { Service-Activate = "PPPOE_SERVICE(3072000,2048000)" } } }
encode-pair Tag-2 = { Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED" }
match 1a 12 00 00 13 0a 41 0c 02 55 4e 50 4f 4c 49 43 45 44
match Tag-1 = { Tunnel-Private-Group-Id = "foo", Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
-#
-# This returns "Service-Activate", but ignores Tag-1
-#
-# fr_pair_list_afrom_str() calls fr_dict_attr_by_oid_substr() which just
-# ends up finding the leaf. So if there are intermediate groups, they are
-# skipped.w
-#
-#pair Tag-1.Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED"
-#match Tag-1 = { Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
+pair Tag-1.Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED"
+match Tag-1 = { Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
-#encode-pair Tag-1.Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED"
-#match 1a 12 00 00 13 0a 41 0c 01 55 4e 50 4f 4c 49 43 45 44
+encode-pair Tag-1.Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED"
+match 1a 12 00 00 13 0a 41 0c 01 55 4e 50 4f 4c 49 43 45 44
-#decode-pair -
-#match Tag1 = { Vendor-Specific = { Unsiphere = { Service-Activate = "UNPLOICED" } } }
+decode-pair -
+match Tag-1 = { Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
-#
-# This doesn't work for the same reason as Tag-1 above.
-#
-#pair Tmp-Group-0.Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED"
-#match Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } }
+pair Tmp-Group-0.Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED"
+match Tmp-Group-0 = { Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
count
-match 17
+match 25