From: Alan Buxey Date: Wed, 26 Mar 2014 20:19:07 +0000 (+0000) Subject: expose server version to xlat X-Git-Tag: release_3_0_3~705 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=8a70ba95d9dacf7b9822a82fb061d3a0f1b4589d;p=freeradius.git expose server version to xlat expose server version to slat (so we can print it out in e.g. line log with %v). I note that a few expansions are present but are in variables.rst - e.g. %C, %V and %Z --- diff --git a/src/main/xlat.c b/src/main/xlat.c index 9f94190..47c5672 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -104,6 +104,7 @@ static char const * const xlat_foreach_names[] = {"Foreach-Variable-0", #endif static int xlat_inst[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; /* up to 8 for regex */ +char const *radiusd_short_version = RADIUSD_VERSION_STRING; #ifdef WITH_UNLANG /** Convert the value on a VALUE_PAIR to string @@ -1238,7 +1239,7 @@ static ssize_t xlat_tokenize_literal(TALLOC_CTX *ctx, char *fmt, xlat_exp_t **he ssize_t slen; xlat_exp_t *next; - if (!p[1] || !strchr("%dlmtDGHISTY", p[1])) { + if (!p[1] || !strchr("%dlmtDGHISTYv", p[1])) { talloc_free(node); *error = "Invalid variable expansion"; p++; @@ -1965,6 +1966,10 @@ static char *xlat_aprint(TALLOC_CTX *ctx, REQUEST *request, xlat_exp_t const * c strftime(str, freespace, "%Y", &ts); break; + case 'v': /* Version of code */ + snprintf(str, freespace, "%s", radiusd_short_version); + break; + default: rad_assert(0 == 1); break;