From: Alan T. DeKok Date: Sun, 29 Mar 2009 20:52:15 +0000 (-0700) Subject: Add support for !* filtering. X-Git-Tag: release_2_1_7~224 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27d45e2b799b369a22699d34edcf67c2fd6462cd;p=thirdparty%2Ffreeradius-server.git Add support for !* filtering. All attributes will be deleted --- diff --git a/man/man5/unlang.5 b/man/man5/unlang.5 index 1391f77ed33..4c1da751aa4 100644 --- a/man/man5/unlang.5 +++ b/man/man5/unlang.5 @@ -559,32 +559,28 @@ Remove all matching attributes from the list. Both the attribute name and value have to match in order for the attribute to be removed from the list. .IP == -Remove all non-matching attributes from the list. Both the attribute -name and value have to match in order for the attribute to remain in -the list. +Keep all matching attributes. Both the attribute name and value have +to match in order for the attribute to remain in the list. Note that this operator is very different than the '=' operator listed above! .IP <= -Enforce that the integer value of the attribute is less than or equal -to the value given here. If there is no attribute of the same name in -the list, the attribute is added with the given value, is with "+=". -If an attribute in the list exists, and has value less than given -here, it's value is unchanged. If an attribute in the list exists, -and has a value greater than given here, then that value is replaced -with the one given here. +Keep all attributes having values less than, or equal to, the value +given here. Any larger value is replaced by the value given here. If +no attribute exists, it is added with the value given here, as with +"+=". This operator is valid only for attributes of integer type. .IP >= -Enforce that the integer value of the attribute is greater than or -equal to the value given here. If there is no attribute of the same -name in the list, the attribute is added with the given value, is with -"+=". If an attribute in the list exists, and has value greater than -given here, it's value is unchanged. If an attribute in the list -exists, and has value less than given here, then that value is -replaced with the one given here. +Keep all attributes having values greater than, or equal to, the value +given here. Any larger value is replaced by the value given here. If +no attribute exists, it is added with the value given here, as with +"+=". This operator is valid only for attributes of integer type. +.IP !* +Delete all occurances of the named attribute, no matter what the +value. .RE .IP Values .br diff --git a/src/main/evaluate.c b/src/main/evaluate.c index 467a6d6b41e..35067b4bc53 100644 --- a/src/main/evaluate.c +++ b/src/main/evaluate.c @@ -1013,6 +1013,14 @@ void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from) break; } + /* + * Delete every attribute, independent + * of its value. + */ + if (from_list[i]->operator == T_OP_CMP_FALSE) { + goto delete; + } + /* * Delete all matching attributes from * "to"