[RADIATOR] Realm processing via hook

Robert Blayzor rblayzor.bulk at inoc.net
Tue Nov 14 17:54:30 UTC 2017


I’m trying to figure out the best way to set a realm but need to fill in some blanks on the order of operation.

Using a PreHandlerHook I am looking at the request and trying to set a Realm if one does not exist.


My question is, if a Client has a DefaultRealm I assume that would appear in get_attr('Realm’) ?

I have clients that cannot have no DefaultRealm so need to set them based on other attribute clues so..
Second question is, if RADIUS request comes in with user at realm in the UserName, get_attr(‘Realm’) should be set with user supplied realm ?


If no value is returned in get_attr('Realm’) I’m trying to set the realm based on clues from another attribute; ie:


    my $p = ${$_[0]};
    #
    unless (my $r = $p->get_attr('Realm')) {
        if ($p->get_attr('Connect-Info') =~ /([^\.]+\.[^\.]+)$/) {
            $p->add_attr('Realm') = $1;
        }
    }


Does the above make sense or should I be using change_attr instead of add_attr for the realm?


--
inoc.net!rblayzor
XMPP: rblayzor.AT.inoc.net
PGP:  https://inoc.net/~rblayzor/
















More information about the radiator mailing list