]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow %{date:} as a synonym for %{date:now}
authorAlan T. DeKok <aland@freeradius.org>
Tue, 14 Jun 2022 21:54:05 +0000 (16:54 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 17 Jun 2022 12:26:15 +0000 (08:26 -0400)
src/modules/rlm_date/rlm_date.c

index ddebcdc4df9db50decc1e774fdb267f9d89a0151..4e8fd27acfaa01cb036b2f5791af31a410c9ef43 100644 (file)
@@ -175,6 +175,8 @@ static xlat_action_t xlat_date_convert(TALLOC_CTX *ctx, fr_dcursor_t *out,
 
        memset(&tminfo, 0, sizeof(tminfo));
 
+       if (!arg) goto now;
+
        /*
         *      Certain strings have magical meanings.
         */
@@ -185,6 +187,7 @@ static xlat_action_t xlat_date_convert(TALLOC_CTX *ctx, fr_dcursor_t *out,
                }
 
                if (strcmp(arg->vb_strvalue, "now") == 0) {
+               now:
                        return date_encode_strftime(ctx, out, inst, request, fr_time_to_sec(fr_time()));
                }
        }