Index is not an integer (segfault)

Franks Andy (IT Technical Architecture Manager) Andy.Franks at sath.nhs.uk
Thu Dec 17 10:50:55 CET 2015


Hi all,
  A segfault report sorry.
Arran and Alan Dekok kindly helped me here with expanding variables from dynamic indexes, which works fine, as long as the variable is plugged into a string value. I'm trying to retrieve an integer value in the same way.
Ideally, I'd like to expand in an if statement and compare, i.e. if ( "%{xlat:control:Tmp-Integer-1[%{control:Tmp-Integer-0}]}" > 1 ), rather than plug into a variable and then compare there, but maybe that's a step too far?

It works fine plugging the variable into a string, xlat seems to cast fine, even if we do an if ("%{xlat:control:Tmp-String-1[%{control:Tmp-Integer-0}]}" > 1 ), so the workaround is obvious, just thought I'd best let you know about the seg anyway.

Thanks
Andy

  map sql_SP_rsh-radius-lant &control:Tmp-String-0 {
    control:Tmp-string-1 += tmp_acctuniqueid
    control:Tmp-string-2 += tmp_acctsessionid
    control:Tmp-string-3 += tmp_username
    control:Tmp-string-4 += tmp_devicetype
    control:Tmp-Integer-1+= tmp_macaddresslimit
    control:Tmp-string-5 += tmp_accounttable
  }

update control {
  Tmp-Integer-0 := 0
  Tmp-String-6 := "%{xlat:control:Tmp-Integer-1[%{control:Tmp-Integer-0}]}"
}

(0)         Executing select query: call get_active_sessions_for_switchport ('192.168.105.86', '1', 864000)
(0)         control:Tmp-string-1 += 2863e8aa72426a2af96f7af0ef7ebdb9
(0)         control:Tmp-string-2 += 000E000000E1
(0)         control:Tmp-string-3 += 20b399f37010
(0)         control:Tmp-string-4 += AP
(0)         control:Tmp-Integer-1 += 32
(0)         control:Tmp-string-5 += radacct_lan0
(0)         control:Tmp-string-1 += 4685a44565edf4d8aae476f8ed3b0ab9
(0)         control:Tmp-string-2 += 000E0000009C
(0)         control:Tmp-string-3 += 20b399f37010
(0)         control:Tmp-string-4 += AP
(0)         control:Tmp-Integer-1 += 32
(0)         control:Tmp-string-5 += radacct_lan0
rlm_sql (sql_SP_rsh-radius-lant): Released connection (0)
rlm_sql (sql_SP_rsh-radius-lant): Need 4 more connections to reach 3 spares
rlm_sql (sql_SP_rsh-radius-lant): Opening additional connection (1), 1 of 9 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on rsh-radius-sql via TCP/IP, server version 5.5.31-0ubuntu0.13.04.1, protocol version 10
(0)       } # map sql_SP_rsh-radius-lant &control:Tmp-String-0 (updated)
(0)       update control {
(0)         Tmp-Integer-0 := 0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6839301 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff6839301 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff70f78d9 in talloc_strdup () from /usr/lib/x86_64-linux-gnu/libtalloc.so.2
#2  0x00007ffff7951c3d in talloc_typed_strdup (t=0xd4d210, p=0x20 <Address 0x20 out of bounds>) at src/lib/missing.c:592
#3  0x00007ffff7bc087e in xlat_tokenize_request (request=0xd4d210, fmt=0x20 <Address 0x20 out of bounds>, head=0x7fffffffd100) at src/main/xlat.c:1812
#4  0x00007ffff7bc2522 in xlat_expand (out=0x7fffffffd148, outlen=2048, request=0xd4d210, fmt=0x20 <Address 0x20 out of bounds>, escape=0x0, escape_ctx=0x0) at src/main/xlat.c:2567
#5  0x00007ffff7bc2860 in radius_xlat (out=0xdc2c90 "", outlen=2048, request=0xd4d210, fmt=0x20 <Address 0x20 out of bounds>, escape=0x0, ctx=0x0) at src/main/xlat.c:2645
#6  0x00007ffff7bbd634 in xlat_xlat (out=0x7fffffffd200, outlen=2048, mod_inst=0x0, xlat_inst=0x0, request=0xd4d210, fmt=0xdc2c10 "control:Tmp-Integer-1[0]") at src/main/xlat.c:634
#7  0x00007ffff7bc1e3f in xlat_aprint (ctx=0xd4d210, request=0xd4d210, node=0xd20950, escape=0x0, escape_ctx=0x0, lvl=0) at src/main/xlat.c:2358
#8  0x00007ffff7bc2131 in xlat_process (out=0x7fffffffd380, request=0xd4d210, head=0xd20950, escape=0x0, escape_ctx=0x0) at src/main/xlat.c:2445
#9  0x00007ffff7bc243a in xlat_expand_struct (out=0x7fffffffd448, outlen=0, request=0xd4d210, node=0xd20950, escape=0x0, escape_ctx=0x0) at src/main/xlat.c:2517
#10 0x00007ffff7bc2932 in radius_axlat_struct (out=0x7fffffffd448, request=0xd4d210, xlat=0xd20950, escape=0x0, ctx=0x0) at src/main/xlat.c:2660
#11 0x00007ffff7babe3f in map_to_vp (ctx=0xd4d210, out=0x7fffffffd520, request=0xd4d210, map=0xce17d0, uctx=0x0) at src/main/map.c:813
#12 0x00007ffff7bace48 in map_to_request (request=0xd4d210, map=0xce17d0, func=0x7ffff7baba77 <map_to_vp>, ctx=0x0) at src/main/map.c:1137
#13 0x00000000004318c6 in modcall_update (request=0xd4d210, stack=0x7fffffffd810, presult=0x7fffffffd7b0, priority=0x7fffffffd7ac) at src/main/interpreter.c:587
#14 0x00000000004320e0 in modcall_recurse (request=0xd4d210, stack=0x7fffffffd810, presult=0x7fffffffd80c, ppriority=0x7fffffffd808) at src/main/interpreter.c:839
#15 0x00000000004324ee in modcall (component=MOD_AUTHORIZE, c=0xcbdde0, request=0xd4d210) at src/main/interpreter.c:1001
#16 0x0000000000427e2a in indexed_modcall (comp=MOD_AUTHORIZE, idx=0, request=0xd4d210) at src/main/modules.c:977
#17 0x000000000042a0c3 in process_authorize (autz_type=0, request=0xd4d210) at src/main/modules.c:2108
#18 0x000000000040fd07 in rad_authenticate (request=0xd4d210) at src/main/auth.c:435
#19 0x000000000043b6d5 in request_running (request=0xd4d210, action=1) at src/main/process.c:1482
#20 0x000000000043a3db in request_queue_or_run (request=0xd4d210, process=0x43b573 <request_running>) at src/main/process.c:953
#21 0x000000000043bff1 in request_receive (ctx=0xd4cf10, listener=0xb01310, packet=0xd4cf70, client=0xae51e0, fun=0x40fa64 <rad_authenticate>) at src/main/process.c:1739
#22 0x0000000000419d1a in auth_socket_recv (listener=0xb01310) at src/main/listen.c:1901
#23 0x00000000004431be in event_socket_handler (xel=0xd3ef70, fd=12, ctx=0xb01310) at src/main/process.c:4542
#24 0x00007ffff7970044 in fr_event_loop (el=0xd3ef70) at src/lib/event.c:637
#25 0x00000000004450b2 in radius_event_process () at src/main/process.c:5585
#26 0x0000000000433103 in main (argc=2, argv=0x7fffffffe6d8) at src/main/radiusd.c:586


More information about the Freeradius-Users mailing list