Reverse string concatenation for multiple attributes

Franks Andy (IT Technical Architecture Manager) Andy.Franks at sath.nhs.uk
Mon Dec 14 11:58:45 CET 2015


Hi,
  Just tried this and still no go..

rlm_sql (sql_SP_rsh-radius-lant): Reserved connection (0)
(0)         Executing select query: call get_active_sessions_for_switchport ('192.168.105.86', '2', 864000)

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff08f3ce0 in mysql_num_fields () from /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
(gdb) bt
#0  0x00007ffff08f3ce0 in mysql_num_fields () from /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
#1  0x00007ffff0df4f0c in sql_fields (out=0x7fffffffd540, handle=0xd57ec0, config=0xb41660) at src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c:450
#2  0x00007ffff0ffb6bc in mod_map_proc (mod_inst=0xb41660, proc_inst=0x0, request=0xd080b0, query=0xd59b30 "call get_active_sessions_for_switchport ('192.168.105.86', '2', 864000)", maps=0xcc61d0)
    at src/modules/rlm_sql/rlm_sql.c:332
#3  0x00007ffff7baa29e in map_proc (request=0xd080b0, inst=0xcc6b30) at src/main/map_proc.c:234
#4  0x00000000004319db in modcall_map (request=0xd080b0, stack=0x7fffffffd810, presult=0x7fffffffd7b0, priority=0x7fffffffd7ac) at src/main/interpreter.c:610
#5  0x00000000004320e0 in modcall_recurse (request=0xd080b0, stack=0x7fffffffd810, presult=0x7fffffffd80c, ppriority=0x7fffffffd808) at src/main/interpreter.c:839
#6  0x00000000004324ee in modcall (component=MOD_AUTHORIZE, c=0xca7840, request=0xd080b0) at src/main/interpreter.c:1001
#7  0x0000000000427e2a in indexed_modcall (comp=MOD_AUTHORIZE, idx=0, request=0xd080b0) at src/main/modules.c:977
#8  0x000000000042a0c3 in process_authorize (autz_type=0, request=0xd080b0) at src/main/modules.c:2108
#9  0x000000000040fd07 in rad_authenticate (request=0xd080b0) at src/main/auth.c:435
#10 0x000000000043b6d5 in request_running (request=0xd080b0, action=1) at src/main/process.c:1482
#11 0x000000000043a3db in request_queue_or_run (request=0xd080b0, process=0x43b573 <request_running>) at src/main/process.c:953
#12 0x000000000043bff1 in request_receive (ctx=0xd07db0, listener=0xaeb790, packet=0xd07e10, client=0xacf660, fun=0x40fa64 <rad_authenticate>) at src/main/process.c:1739
#13 0x0000000000419d1a in auth_socket_recv (listener=0xaeb790) at src/main/listen.c:1901
#14 0x00000000004431be in event_socket_handler (xel=0xcf9e10, fd=12, ctx=0xaeb790) at src/main/process.c:4542
#15 0x00007ffff7970044 in fr_event_loop (el=0xcf9e10) at src/lib/event.c:637
#16 0x00000000004450b2 in radius_event_process () at src/main/process.c:5585
#17 0x0000000000433103 in main (argc=2, argv=0x7fffffffe6d8) at src/main/radiusd.c:586

My SQL query doesn't return any rows, which will be normal sometimes.

mysql> call get_active_sessions_for_switchport ('192.168.105.86', '2', 864000);
Query OK, 0 rows affected (0.01 sec)

mysql>

Config is :

  update control {
    Tmp-String-0 !* ANY
    Tmp-String-1 !* ANY
    Tmp-String-2 !* ANY
    Tmp-String-0 := "call get_active_sessions_for_switchport ('%{NAS-IP-Address}', '%{NAS-Port}', ${policy.MaxClientAge})"
  }
  # map - get back one or more devices.
  map sql_SP_rsh-radius-lant &control:Tmp-String-0 {
    control:Tmp-string-1 += acctuniqueid
    control:Tmp-string-2 += username
  }

Thanks
Andy

-----Original Message-----
From: Freeradius-Users [mailto:freeradius-users-bounces+andy.franks=sath.nhs.uk at lists.freeradius.org] On Behalf Of Franks Andy (IT Technical Architecture Manager)
Sent: 11 December 2015 17:18
To: FreeRadius users mailing list
Subject: RE: Reverse string concatenation for multiple attributes

Thanks for that Arran. I'll check it a bit later. Weird that it worked on 2 field tables then failed when i moved to 4. Thanks again Andy ________________________________________
From: Freeradius-Users [freeradius-users-bounces+andy.franks=sath.nhs.uk at lists.freeradius.org] on behalf of Arran Cudbard-Bell [a.cudbardb at freeradius.org]
Sent: 11 December 2015 16:37
To: FreeRadius users mailing list
Subject: Re: Reverse string concatenation for multiple attributes

> On Dec 11, 2015, at 11:09 AM, Franks Andy (IT Technical Architecture Manager) <Andy.Franks at sath.nhs.uk> wrote:
>
> Hi. Maybe spoke too soon..
> Any chance this crash is not something I have done?

Pushed fix... Looks like this is an old bug.  Maybe MySQL have messed up the version macro :/

-Arran

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



More information about the Freeradius-Users mailing list