Hi all

radiusd crashes when Postgresql returns PGRES_FATAL_ERROR.


Olivier


-------- environment -----------

OS: Centos 5.3
Freeradius : 2.1.7 (also occurred in 2.1.6)
packages are from
http://people.redhat.com/jdennis/freeradius-rhel-centos/i386/
Postgresql : 8.1
<http://people.redhat.com/jdennis/freeradius-rhel-centos/i386/freeradius2-2.1.7-2.el5.i386.rpm>


------- debug output -----------


radius -X output:

...
}
rlm_sql (sql_secondary): Driver rlm_sql_postgresql (module
rlm_sql_postgresql) loaded and linked
rlm_sql (sql_secondary): Attempting to connect to
rad...@100.100.100.131:5432/radius
rlm_sql (sql_secondary): starting 0
rlm_sql (sql_secondary): Attempting to connect rlm_sql_postgresql #0
rlm_sql (sql_secondary): Connected new DB handle, #0
rlm_sql (sql_secondary): starting 1
rlm_sql (sql_secondary): Attempting to connect rlm_sql_postgresql #1
rlm_sql (sql_secondary): Connected new DB handle, #1
rlm_sql (sql_secondary): starting 2
rlm_sql (sql_secondary): Attempting to connect rlm_sql_postgresql #2
rlm_sql (sql_secondary): Connected new DB handle, #2
rlm_sql (sql_secondary): starting 3
rlm_sql (sql_secondary): Attempting to connect rlm_sql_postgresql #3
rlm_sql (sql_secondary): Connected new DB handle, #3
rlm_sql (sql_secondary): starting 4
rlm_sql (sql_secondary): Attempting to connect rlm_sql_postgresql #4
rlm_sql (sql_secondary): Connected new DB handle, #4
Module: Checking post-proxy {...} for more modules to load
} # modules
} # server
radiusd: #### Opening IP addresses and Ports ####
listen {
type = "auth"
ipaddr = *
port = 1812
}
Listening on authentication address * port 1812
Listening on proxy address * port 1814
Ready to process requests.
rad_recv: Access-Request packet from host 100.100.100.2 port 12048,
id=38, length=116
NAS-Identifier = "XXXXXX"
User-Name = "U0123456"
User-Password = "XXXXXXX"
NAS-IP-Address = 100.100.100.2
NAS-Port = 0
Acct-Session-Id = "XXXXXXX(ZZZ)\"Sun Oct 25 10:16:45 2009\"HcSrdUv5"
+- entering group authorize {...}
[suffix] No '@' in User-Name = "U0123456", looking up realm NULL
[suffix] Found realm "NULL"
[suffix] Adding Stripped-User-Name = "U0123456"
[suffix] Adding Realm = "NULL"
[suffix] Proxying request from user U0123456 to realm NULL
[suffix] Preparing to proxy authentication request to realm "NULL"
++[suffix] returns updated
++- entering policy redundant {...}
[sql_primary] expand: %{User-Name} ->  U0123456
[sql_primary] sql_set_user escaped user -->  'U0123456'
rlm_sql (sql_primary): Reserving sql socket id: 4
[sql_primary] expand: SELECT id, UserName, Attribute, Value, Op FROM
radcheck WHERE Username = '%{SQL-User-Name}' ORDER BY id ->  SELECT id,
UserName, Attribud
rlm_sql_postgresql: Status: PGRES_FATAL_ERROR
rlm_sql_postgresql: Error (null)


Program received signal SIGSEGV, Segmentation fault.
0x00c6040a in strcmp () from /lib/libc.so.6
(gdb) info threads
* 1 Thread 0xb7fcead0 (LWP 30560) 0x00c6040a in strcmp () from
/lib/libc.so.6
(gdb) thread apply all bt full

Thread 1 (Thread 0xb7fcead0 (LWP 30560)):
#0 0x00c6040a in strcmp () from /lib/libc.so.6
No symbol table info available.
#1 0x006c790f in sql_query (sqlsocket=0x867a968, config=0x8657cf8,
querystr=0xbfc78fdc "SELECT id, UserName, Attribute, Value, Op FROM
radcheck WHERE Username = 'U0123456' ORDER BY id") at sql_postgresql.c:118
status =<value optimized out>
pg_sock =<value optimized out>
numfields =<value optimized out>
errorcode = 0x0
errormsg =<value optimized out>
#2 0x008911e2 in rlm_sql_select_query (sqlsocket=0x867a968, inst=0x8657cc0,
query=0xbfc78fdc "SELECT id, UserName, Attribute, Value, Op FROM
radcheck WHERE Username = 'U0123456' ORDER BY id") at sql.c:559
ret =<value optimized out>
#3 0x00891782 in sql_getvpdata (inst=0x8657cc0, sqlsocket=0x867a968,
pair=0xbfc78fd8,
query=0xbfc78fdc "SELECT id, UserName, Attribute, Value, Op FROM
radcheck WHERE Username = 'U0123456' ORDER BY id") at sql.c:606
row =<value optimized out>
rows = 0
#4 0x0088efae in rlm_sql_authorize (instance=0x8657cc0,
request=0x86b2048) at rlm_sql.c:1007
check_tmp = (VALUE_PAIR *) 0x0
reply_tmp = (VALUE_PAIR *) 0x0
user_profile =<value optimized out>
found =<value optimized out>
dofallthrough = 1
rows =<value optimized out>
sqlsocket = (SQLSOCK *) 0x867a968
inst =<value optimized out>
querystr = "SELECT id, UserName, Attribute, Value, Op FROM radcheck
WHERE Username = 'U0123456' ORDER BY
id\000o/'\006?o/'X?o/'?\017?\000\b\222o/'|\220o/'h\221o/'5b?\000|\220o/'A?\.
sqlusername = "U0123456", '\0'<repeats 38 times>, "
?o/'(xe\b??\210\000\214+\000\000\000\000\000u<?o/'X?o/'_N\006O\t\000\000\000\200?\210\000H?\210\000^N\006O\000\000\000\000\r\.
profileusername =
"@?\021\000?*k\b?*k\b\000i$q0%z\...@rd\b\000\000\000\000\210?o/'&\205Y\000?*k\b?\202W\b?*\000\000\001\000\000\000\230,X\000\200\n\022\000?(k\b?\202W\b?*k\b?.
#5 0x08062dfe in modcall (component=1, c=0x8657570, request=0x86b2048)
at modcall.c:292
myresult = 1
stack = {pointer = -1, priority = {0, 4, 0, -1077435628, 13600512,
140868088, 0, 0, 2, 0, 0, 12952177, -1077435732, 140861472, 140861480,
140861476,
-1208162612, -1077435192, 140867624, 0, -1208147968, 12509120, 12508320,
140861464, -1077435560, 12509760, 12455465, 12572564, 1172048, 12936180,
12952177, 20},
result = {6, 8, 6, 12940957, -1077435604, -1077435316, -1077435061,
-1077435032, 13832180, -1077435316, -1077435604, -1077435368, 13460021,
-1077435604,
134726134, -1077435032, -1077435316, 0, -1077435444, 255, -72515583,
-1077435316, -1077435316, -1077435316, -1077435316, -1077435289,
-1077435061, -1077435316,
-1077435061, 0, 0, 0}, children = {0x8657570, 0x86575c0, 0x8683280, 0x4,
0xbedfc0, 0x0, 0x0, 0xbfc7a414, 0xbfc7a33c, 0xbe0e29, 0xd32140, 0x0,
0x8656fc8, 0x101,
0xffffffff, 0xd832ca, 0xd18918, 0x86577a8, 0x8655dc8, 0xbfc7a3c8,
0xd832ca, 0x8656fc8, 0x101, 0xd80f9b, 0xd8575c, 0xd30940, 0x0,
0xbfc7a3f8, 0xd81470, 0x0,
0xd30ff4, 0x71246900}, start = {0x8085e9c, 0x8657518, 0x8683280,
0xbfc7a418, 0x805d2ae, 0x1, 0x80786f1, 0xbfc7a428, 0x0, 0x0, 0xc5769d,
0xbfc7a448, 0x8085e9c,
0xbfc7a428, 0x8085e9c, 0xbfc7a558, 0x80519bd, 0x1, 0x80786f1,
0xbfc7a44c, 0x100, 0x807c1f6, 0xbfc7a568, 0xbfc7a8b8, 0x0, 0xc5a271,
0xff, 0xbfc7a568, 0x74736e49,
0x69746e61, 0x6e697461, 0x71732067}}
parent = (modcallable *) 0x86575c0
child = (modcallable *) 0x8683280
if_taken = 0
was_if = 0
#6 0x0805fa65 in indexed_modcall (comp=1, idx=0, request=0x86b2048) at
modules.c:691
rcode =<value optimized out>
list = (modcallable *) 0x8657570
server =<value optimized out>
#7 0x0805fe0c in module_authorize (autz_type=0, request=0x86b2048) at
modules.c:1453
No locals.
#8 0x0804e678 in rad_authenticate (request=0x86b2048) at auth.c:565
namepair =<value optimized out>
check_item =<value optimized out>
auth_item = (VALUE_PAIR *) 0x86b23e0
module_msg =<value optimized out>
tmp =<value optimized out>
result = 12
autz_retry = 0 '\0'
autz_type = 7112497
#9 0x0806e4d5 in radius_handle_request (request=0x86b2048, fun=0x804e550
<rad_authenticate>) at event.c:3693
No locals.
#10 0x08065a5c in thread_pool_addrequest (request=0x86b2048,
fun=0x804e550<rad_authenticate>) at threads.c:841
now = 1256462126
#11 0x0806aef2 in event_socket_handler (xel=0x86ae3e0, fd=18,
ctx=0x86b1e58) at event.c:3317
fun = (RAD_REQUEST_FUNP) 0x804e550<rad_authenticate>
request = (REQUEST *) 0x86b2048
#12 0x0059ad15 in fr_event_loop (el=<value optimized out>) at event.c:400
ef = (fr_event_fd_t *) 0x86ae490
i =<value optimized out>
rcode = 1
when = Could not find the frame base for "fr_event_loop".



-------------sql_postgresql.c code --------------------

freeradius-server-2.1.7/src/modules/rlm_sql/drivers/rlm_sql_postgresql/sql_postgresql.c



static int check_fatal_error (char *errorcode)
{
int x = 0;

/*
Check the error code to see if we should reconnect or not
Error Code table taken from
http://www.postgresql.org/docs/8.1/interactive/errcodes-appendix.html
*/

while(errorcodes[x].errorcode != NULL){
line 118-->  if (strcmp(errorcodes[x].errorcode, errorcode) == 0){
radlog(L_DBG, "rlm_sql_postgresql: Postgresql Fatal Error: [%s: %s]
Occurred!!", errorcode, errorcodes[x].
meaning);
if (errorcodes[x].shouldreconnect == 1)
return SQL_DOWN;
else
return -1;
}
x++;
}

radlog(L_DBG, "rlm_sql_postgresql: Postgresql Fatal Error: [%s]
Occurred!!", errorcode);
/* We don't seem to have a matching error class/code */
return -1;
}











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

Reply via email to