fr_pair_list_t head;
fr_dcursor_t tlv_cursor;
fr_pair_t *vp;
+ bool concat;
fr_pair_list_init(&head);
if (data_len < 3) return -1; /* type, length, value */
if (fr_radius_decode_tlv_ok(p, data_len, 1, 1) < 0) return -1;
- vp = fr_pair_afrom_da(ctx, parent);
+ /*
+ * We don't have a "pair find in cursor"
+ */
+ if (flag_concat(&parent->flags)) {
+ vp = fr_pair_find_by_da(fr_pair_list_from_dcursor(cursor), parent);
+ concat = (vp != NULL);
+ } else {
+ vp = NULL;
+ concat = false;
+ }
+
+ if (!vp) vp = fr_pair_afrom_da(ctx, parent);
if (!vp) return PAIR_DECODE_OOM;
/*
child = fr_dict_unknown_attr_afrom_num(packet_ctx->tmp_ctx, parent, p[0]);
if (!child) {
error:
- talloc_free(vp);
+ if (!concat) talloc_free(vp);
return -1;
}
}
}
fr_pair_list_append(&vp->vp_group, &head);
- fr_dcursor_append(cursor, vp);
+ if (!concat) fr_dcursor_append(cursor, vp);
return data_len;
}
decode-pair -
match Digest-Attributes = { Realm = "biloxi.com", Nonce = "dcd98b7102dd2f0e8b11d0f600bfb0c093", Method = "INVITE", URI = "sip:bob@biloxi.com", User-Name = "bob", QOP = "auth", Algorithm = "MD5", Nonce-Count = "00000001", CNonce = "0a4f113b" }
+encode-pair Digest-Attributes = { Realm = "biloxi.com" }
+match cf 0e 01 0c 62 69 6c 6f 78 69 2e 63 6f 6d
+
+encode-pair Digest-Attributes = { User-Name = "bob" }
+match cf 07 0a 05 62 6f 62
+
+#
+# The two previous things, concatenated as attributes.
+#
+# The Digest-Attributes dictionary entry is marked "concat",
+# so the decoder MUST create one Digest-Attributes VP, instead of two.
+#
+decode-pair cf 0e 01 0c 62 69 6c 6f 78 69 2e 63 6f 6d cf 07 0a 05 62 6f 62
+match Digest-Attributes = { Realm = "biloxi.com", User-Name = "bob" }
+
+#
+# And on encoding it, we mash everything together.
+#
+encode-pair -
+match cf 13 01 0c 62 69 6c 6f 78 69 2e 63 6f 6d 0a 05 62 6f 62
+
+
count
match 6