From: Alan T. DeKok Date: Tue, 11 Sep 2012 08:08:10 +0000 (+0200) Subject: Make %{Stripped-User-Name:-%{User-Name}} work again X-Git-Tag: release_2_2_1~284 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a01dd0fd6d0aaf65d52057a17bf2c9038444b7ac;p=thirdparty%2Ffreeradius-server.git Make %{Stripped-User-Name:-%{User-Name}} work again --- diff --git a/src/main/xlat.c b/src/main/xlat.c index 3dd9dc9f8bc..3d45a070708 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -210,7 +210,7 @@ static size_t xlat_packet(void *instance, REQUEST *request, * value of the tag. */ p = strchr(buffer, ':'); - if (p) { + if (p && (p[1] != '-')) { tag = atoi(p + 1); *p = '\0'; p++; @@ -1021,7 +1021,15 @@ static int decode_attribute(const char **from, char **to, int freespace, } if (*l == ':') { - if (l[1] == '-') break; + if (l[1] == '-') { + RDEBUG2("WARNING: Deprecated conditional expansion \":-\". See \"man unlang\" for details"); + module_name = internal_xlat[1]; + xlat_str = p; + *l = '\0'; + next = l + 2; + goto do_xlat; + } + if (isdigit(l[1])) break; module_name = p; /* start of name */ @@ -1050,18 +1058,6 @@ static int decode_attribute(const char **from, char **to, int freespace, goto do_xlat; } - /* - * Maybe it's the old-style %{foo:-bar} - */ - if (*p == '-') { - RDEBUG2("WARNING: Deprecated conditional expansion \":-\". See \"man unlang\" for details"); - p++; - - xlat_str = module_name; - next = p; - goto do_xlat; - } - /* * FIXME: For backwards "WTF" compatibility, check for * {...}, (after the :), and copy that, too.