]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't create empty stripped-user-domain attributes
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 20 Sep 2017 03:07:47 +0000 (10:07 +0700)
committerGitHub <noreply@github.com>
Wed, 20 Sep 2017 03:07:47 +0000 (10:07 +0700)
raddb/policy.d/canonicalization

index b861b965acf64937f0fdb0b040d96613f291eae5..6d90e37b7545fe58cfb6adf52f42577ed6ae447c 100644 (file)
@@ -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
        }