Alexander V. Klepikov wrote:
>
> Well, I think I found why FreeRadius crashes. Unconnected SQL socket is 
> passed to sql_close function in module rlm_sql in function rlm_sql_query 
> (src/modules/rlm_sql/sql.c line 499). Here is the patch:

  Hmm... it looks like similar patches were added in revision 1.72 of
that file.  I've double-checked the code, and found one more location.

  Please try the attached patch.

> My tests shows that problem is gone. I hope I patched right piece of code :)

  If it works...

  Alan DeKok.
--
  http://deployingradius.com       - The web site of the book
  http://deployingradius.com/blog/ - The blog
Index: src/modules/rlm_sql/sql.c
===================================================================
RCS file: /source/radiusd/src/modules/rlm_sql/sql.c,v
retrieving revision 1.79.2.3
diff -u -r1.79.2.3 sql.c
--- src/modules/rlm_sql/sql.c   26 Aug 2005 00:37:47 -0000      1.79.2.3
+++ src/modules/rlm_sql/sql.c   19 Mar 2007 16:52:33 -0000
@@ -496,7 +496,9 @@
 
        if (ret == SQL_DOWN) {
                /* close the socket that failed */
-               (inst->module->sql_close)(sqlsocket, inst->config);
+               if (sqlsocket->conn) {
+                       (inst->module->sql_close)(sqlsocket, inst->config);
+               }
 
                /* reconnect the socket */
                if (connect_single_socket(sqlsocket, inst) < 0) {
@@ -539,7 +541,9 @@
 
        if (ret == SQL_DOWN) {
                /* close the socket that failed */
-               (inst->module->sql_close)(sqlsocket, inst->config);
+               if (sqlsocket->conn) {
+                       (inst->module->sql_close)(sqlsocket, inst->config);
+               }
 
                /* reconnect the socket */
                if (connect_single_socket(sqlsocket, inst) < 0) {
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to