From da1429dbc973d7747f452ffc4658874488c17a5d Mon Sep 17 00:00:00 2001 From: Alan Buxey Date: Thu, 27 Mar 2014 11:03:24 +0000 Subject: [PATCH] expose server version to slat and document --- doc/variables.rst | 2 ++ src/main/xlat.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/doc/variables.rst b/doc/variables.rst index e128899e3b..88eaa93214 100644 --- a/doc/variables.rst +++ b/doc/variables.rst @@ -109,6 +109,8 @@ release. They also do NOT permit the use of conditional syntax +-----------+---------------------------+-----------------------+ |%u |User name |%{User-Name} | +-----------+---------------------------+-----------------------+ +|%v |Server Version | | ++-----------+---------------------------+-----------------------+ |%A |radacct_dir |%{config:radacctdir} | +-----------+---------------------------+-----------------------+ |%C |clientname | | diff --git a/src/main/xlat.c b/src/main/xlat.c index 9b97db0820..3b231a4bed 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -62,6 +62,8 @@ static const char * const internal_xlat[] = {"check", #endif static const 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; + /** * @brief Convert the value on a VALUE_PAIR to string */ @@ -1348,6 +1350,11 @@ int radius_xlat(char *out, int outlen, const char *fmt, q += valuepair2str(q,freespace,pairfind(request->packet->vps,PW_USER_NAME),PW_TYPE_STRING, func); p++; break; + case 'v': /* server version */ + strlcpy(q,radiusd_short_version,freespace); + q += strlen(q); + p++; + break; case 'A': /* radacct_dir */ strlcpy(q,radacct_dir,freespace); q += strlen(q); -- 2.47.2