da = parent;
}
+ /*
+ * TLVs are special, they cannot hold values. The caller should know this!
+ */
+ if (da->type == FR_TYPE_TLV) {
+ if (!value) return slen;
+
+ fr_strerror_const("TLVs cannot hold values");
+ return -(slen);
+ }
+
MEM(vp = fr_pair_afrom_da(ctx, da));
/*
*/
if (!value) {
switch (da->type) {
- /*
- * We can blame the authors of RFC 6929 for
- * this hack. Apparently the presence or absence
- * of an attribute isn't considered a useful means
- * of conveying information, so empty TLVs are
- * disallowed.
- */
- case FR_TYPE_TLV:
- fr_pair_to_unknown(vp);
- FALL_THROUGH;
-
case FR_TYPE_OCTETS:
fr_pair_value_memdup(vp, (uint8_t const *)"\0", 1, true);
break;
return slen;
}
- if (da->type == FR_TYPE_TLV) {
- fr_strerror_const("TLVs cannot hold values");
- return -(slen);
- }
-
ret = fr_pair_value_from_str(vp, value, strlen(value), NULL, true);
if (ret < 0) {
slen = -(slen);