(RADIATOR) unblessed reference

Hugh Irvine hugh at open.com.au
Tue Jun 17 18:38:51 CDT 2008


Hello Alex -

I always find it useful to dereference the pointers at the start of  
the hook processing, so its not forgotten later.

I also find it clearer to to use $p->get_attr('NAS-IP-Address'), but  
of course you can do whatever you are comfortable with.

See my examples in "goodies/hooks.txt".

regards

Hugh



On 18 Jun 2008, at 00:22, Alex Sharaz wrote:

> Hi,
> I'm trying to set up a post processing hook that'll return a vlan  
> id in
> an
> access-reject packet. The vlan id value is dependent upon the nas ip
> address
> that initially did the access-request. I'm running radiator 4.2
>
> A snippet of the perl hook is :-
>
> sub
> {
>         my ($req, $rep, $handled, $reason) = @_;
>
> #
> # $p=current request
> # $rp=response packet
> # $result result of the authentication
> #
>     my $vlanid='-1';
>     my $tag;
>     my $ASCIIvlan;
>     my $nasip = $req->getNasId();
>
>     &main::log($main::LOG_DEBUG, "Calling db2_gen_vlanid.pl\n");
>     if (${$rep}->code() eq 'Access-Accept' )
>     {
>
> ..........
>     }
>     If ((${$rep}->code() eq 'Access-Reject' )
>     {
> .....
>     }
>
> Below is what happens when an incoming access request occurs. (
> basically we
> want to reject any auth requests from host machines and tell the  
> switch
> to
> place the port in an appropriate default vlan)
>
>
> *** Received from 150.237.162.254 port 2440 ....
> Code:       Access-Request
> Identifier: 112
> Authentic:  <242>,\<172>1M2<175><135>=<143>;>n<197><170>
> Attributes:
>         Framed-MTU = 1466
>         NAS-IP-Address = 150.237.162.254
>         NAS-Identifier = "CC_PC2_HP2900-48"
>         User-Name = "host/to55er.adir.hull.ac.uk"
>         Service-Type = Framed-User
>         Framed-Protocol = PPP
>         NAS-Port = 30
>         NAS-Port-Type = Ethernet
>         NAS-Port-Id = "30"
>         Called-Station-Id = "00-1c-2e-11-4b-40"
>         Calling-Station-Id = "00-13-d3-c9-24-d0"
>         Connect-Info = "CONNECT Ethernet 1000Mbps Full duplex"
>         Tunnel-Type = 0:VLAN
>         Tunnel-Medium-Type = 0:802
>         Tunnel-Private-Group-ID = 1620
>         EAP-Message = <2><18><0> <1>host/to55er.adir.hull.ac.uk
>         Message-Authenticator =
> <175><26><215>1<229><221><10><210><154><210><183><146>rb<219><229>
>
> Mon Jun 16 11:56:05 2008: DEBUG: Handling request with Handler
> 'Client-Identifier=/^HP/,Realm=,User-Name=/^host/>'
> Mon Jun 16 11:56:05 2008: DEBUG: Handling with AuthINTERNAL:
> rejectAuthAttempt
> Mon Jun 16 11:56:05 2008: DEBUG: AuthBy INTERNAL result: REJECT,  
> "Realm
> required/Machine auth not allowed"
> Mon Jun 16 11:56:05 2008: INFO: Access rejected for
> host/to55er.adir.hull.ac.uk: "Realm required/Machine auth not allowed"
> Mon Jun 16 11:56:05 2008: DEBUG: do query is: 'insert into
> db2inst3.RADAUTHLOG (TIME_STAMP, USERNAME, AUTH_TYPE,
> REASON,radauth_xml)
> values (1213613
> 765, 'host/to55er.adir.hull.ac.uk', 0, '"Realm required/Machine  
> auth not
> allowed"','<radauthrec><time_stamp>1213613765</ 
> time_stamp><username>host
> /to
> 55er.adir.hull.ac.uk</username><auth_type>fail</auth_type><reason/ 
> ></rad
> auth
> rec>')':
> Mon Jun 16 11:56:05 2008: ERR: Error in PostProcessingHook(): Can't  
> call
> method "getNasId" on unblessed reference at (eval 202) line 23.
>
> So how do i get round the unblessed reference?
> Alex
>
> ********************************************************************** 
> *******************
> To view the terms under which this email is distributed, please go  
> to http://www.hull.ac.uk/legal/email_disclaimer.html
> ********************************************************************** 
> *******************



NB:

Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive (www.open.com.au/archives/ 
radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?
Have you checked the RadiusExpert wiki:
http://www.open.com.au/wiki/index.php/Main_Page

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
Includes support for reliable RADIUS transport (RadSec),
and DIAMETER translation agent.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.


--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list