More / better errors and tests
authorAlan T. DeKok <aland@freeradius.org>
Tue, 23 Apr 2013 16:13:28 +0000 (12:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 23 Apr 2013 16:14:50 +0000 (12:14 -0400)
src/main/parser.c
src/tests/condition.txt

index 7fbd6f6..a6bfde2 100644 (file)
@@ -280,12 +280,22 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, char const *start, int brace,
        }
 
        /*
-        *      !COND == !(COND)
+        *      !COND
         */
        if (*p == '!') {
                p++;
                c->negate = TRUE;
                while (isspace((int) *p)) p++; /* skip spaces after negation */
+
+               /*
+                *  Just for stupidity
+                */
+               if (*p == '!') {
+                       talloc_free(c);
+                       COND_DEBUG("RETURN %d", __LINE__);
+                       *error = "Double negation is invalid";
+                       return -(p - start);
+               }
        }
 
        /*
index c5094a7..36fea4c 100644 (file)
@@ -69,6 +69,15 @@ data a == b
 condition (!a)
 data !a
 
+condition !(a)
+data !a
+
+condition !!a
+data ERROR offset 1 Double negation is invalid
+
+condition !(!a)
+data a
+
 #
 #  Hmm... these next two should really be identical.
 #