*/
RDEBUG2("%s %s %s", current->lhs.vpt->name, fr_tokens[T_OP_SUB_EQ], current->rhs.vpt->name);
- while (vp) {
+ for ( ; vp != NULL; vp = next) {
fr_pair_list_t *list;
next = fr_dcursor_next(&cursor);
list = fr_pair_parent_list(vp);
fr_assert(list != NULL);
+ if (fr_pair_immutable(vp)) continue;
+
if (fr_edit_list_pair_delete(current->el, list, vp) < 0) {
tmpl_dcursor_clear(&cc);
return -1;
}
-
- vp = next;
}
tmpl_dcursor_clear(&cc);
// &control := ...
}
- if (fr_pair_immutable(vp)) {
+ /*
+ * We forbid operations on immutable leaf attributes.
+ *
+ * If a list contains an immutable attribute, then we can still operate on the list, but instead
+ * we look at each VP we're operating on.
+ */
+ if (fr_type_is_leaf(vp->vp_type) && vp->vp_immutable) {
RWDEBUG("Cannot modify immutable value for %s", current->lhs.vpt->name);
return -1;
}
test_fail
}
+#
+# Add a non-immutable NAS-Port
+#
+&request += {
+ &NAS-Port = 6809
+}
+
+debug_request
+
+if !(&NAS-Port[1] == 6809) {
+ test_fail
+}
+
+&request -= &NAS-Port[*]
+if !(&NAS-Port == 1813) {
+ test_fail
+}
+
+if (&NAS-Port[#] != 1) {
+ test_fail
+}
+
success