From: Arran Cudbard-Bell Date: Wed, 20 Sep 2017 03:07:47 +0000 (+0700) Subject: Don't create empty stripped-user-domain attributes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ca82ed4e2824e310c0627689b82b79cb65f5de2;p=thirdparty%2Ffreeradius-server.git Don't create empty stripped-user-domain attributes --- diff --git a/raddb/policy.d/canonicalization b/raddb/policy.d/canonicalization index b861b965acf..6d90e37b754 100644 --- a/raddb/policy.d/canonicalization +++ b/raddb/policy.d/canonicalization @@ -16,7 +16,15 @@ split_username_nai { if (&User-Name && (&User-Name =~ /${policy.nai_regexp}/)) { update request { &Stripped-User-Name := "%{1}" - &Stripped-User-Domain = "%{3}" + } + + # Only add the Stripped-User-Domain attribute if + # we have a domain. This means presence checks + # for Stripped-User-Domain work. + if ("%{3}" != '') { + update request { + &Stripped-User-Domain = "%{3}" + } } # If any of the expansions result in a null @@ -36,7 +44,15 @@ split_username_nai.post-proxy { if (&proxy-reply:User-Name && (&proxy-reply:User-Name =~ /${policy.nai_regexp}/)) { update proxy-reply { &Stripped-User-Name := "%{1}" - &Stripped-User-Domain = "%{3}" + } + + # Only add the Stripped-User-Domain attribute if + # we have a domain. This means presence checks + # for Stripped-User-Domain work. + if ("%{3}" != '') { + update proxy-reply { + &Stripped-User-Domain = "%{3}" + } } updated }