]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
empty strings are OK
authorAlan T. DeKok <aland@freeradius.org>
Thu, 5 Sep 2019 22:24:29 +0000 (18:24 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 5 Sep 2019 22:24:29 +0000 (18:24 -0400)
with tests

src/lib/server/cond_tokenize.c
src/tests/unit/condition.txt

index ee2cd6dda4656bb20c38ad9d9c677c78c7601c47..715483ca93f0d3e11befbbf56eab0452855600d2 100644 (file)
@@ -617,7 +617,7 @@ static ssize_t cond_preparse(char const **out, size_t *outlen, char const *start
        my_slen = tmpl_preparse(out, outlen, buffer, type, error, castda, require_regex);
        if (my_slen <= 0) return my_slen;
 
-       if (!*out || *outlen == 0) return 0; /* for sanity checks */
+       if (!*out) return 0; /* for sanity checks, *outlen can be 0 for empty strings */
 
        /*
         *      'out' now points to 'buffer', which we don't want.  So
index 78f66963f5b90c12d807612601372857cbee0dcf..ecfae7b5d438784e8dae06f544b6bf9ff4927a3c 100644 (file)
@@ -647,3 +647,10 @@ data <ipv4prefix>&NAS-IP-Address < `/bin/echo 192.168/16`
 #
 condition (&reply:)
 data &reply:
+
+#
+#  Expansions of environment variables
+#  and empty strings
+#
+condition ("$ENV{SOMETHING_OR_OTHER}" == '')
+data true