Regex remove realm from username
Eric Martell
workoutexcite at yahoo.com
Fri Oct 10 18:19:48 CEST 2008
Hi..
I searched thru the forums but not getting the right username after using regex.
The request I am getting is : test at google.com and I need to strip everything after @ and pass the username as test.
I am using ldap for auth. This is the config I have in ldap.
if (User-Name =~ /^([^@]+)(@.*)$/) { // just want to dblchck is the right regex
update request {
Stripped-User-Name := "%{0}"
}
}
filter = "(uid=%{Stripped-User-Name})"
//filter = "(uid=%{Stripped-User-Name:-%{User-Name}})"
//filter = "(uid=%{Stripped-User-Name})"
encryption_scheme = crypt
I get the following while ldap lookup expand: (uid=%{Stripped-User-Name}) -> (uid=)
Here is the radius -X log ;
rad_recv: Access-Request packet from host 216.2.193.1 port 55751, id=107, length=65
User-Name = "test at google.com"
User-Password = "test123"
+- entering group authorize
++[preprocess] returns ok
++[chap] returns noop
++[mschap] returns noop
rlm_realm: Looking up realm "google.com" for User-Name = "test at google.com"
rlm_realm: No such realm "google.com"
++[suffix] returns noop
rlm_eap: No EAP-Message, not doing EAP
++[eap] returns noop
++[unix] returns notfound
++[files] returns noop
++- entering group
rlm_ldap: - authorize
rlm_ldap: performing user authorization for test at google.com
expand: (uid=%{Stripped-User-Name}) -> (uid=)
expand: dc=xyz,dc=net,o=internet -> dc=xyz,dc=net,o=internet
rlm_ldap: ldap_get_conn: Checking Id: 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20081010/09d1ffca/attachment.html>
More information about the Freeradius-Users
mailing list