On Thu, Jun 12, 2003 at 08:25:07PM +0200, Rob Hartzenberg wrote:

> Why when using searchfor = "[EMAIL PROTECTED]"
> Does it drop the "$" (As show in previous logs)
> but when using searchfor = "[EMAIL PROTECTED]"
> It works fine?

I posted a patch while ago and, i just find that my message doesn't
appear in the archive mailing-list... here is a copy:

Subject: XLAT patch
Date: Wed, 14 May 2003 17:03:53 +0200
From: Christophe Boyanique <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

[-- Attachement #1 --]
[-- Type : text/plain, Codage : 7bit, Taille : 1,0K --]

Hi,

I had problems while trying to work with rlm_attr_rewrite and especially
with a regexp containing the end of string $ character. After many
mailing-list archive searches and sources tweakings I ended up modifying
the xlat.c file by adding in the radius_xlat function the handling of \$
character, replaced by $ (patch is attached).

Now I can have things like that in the radiusd.conf:

        attr_rewrite force_username {
                attribute = User-Name
                searchin = packet
                searchfor = "^%{Called-Station-Id}\\$"
                #searchfor = "^[0-9]+\\$"
                replacewith = "[EMAIL PROTECTED]:Realm}"
                append = no
                new_attribute = no
                max_matches = 1
        }

and it works ! (Note the double backslash).

I don't know if this modification would break anything else and/or it
should be repeated in other xlat.c' functions... Feel free to comment :)

Christophe.

[-- Attachement #2: freeradius-xlat.patch --]
[-- Type : text/plain, Codage : 7bit, Taille : 0,2K --]

--- xlat.c.orig Wed May 14 16:55:49 2003
+++ xlat.c      Wed May 14 16:05:27 2003
@@ -411,6 +411,9 @@
                        case 'n':
                                *q++ = '\n';
                                break;
+                       case '$':
+                               *q++ = '$';
+                               break;
                        default:
                                *q++ = c;
                                *q++ = *p;


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to