Hi,

found a small bug, which cause segmentation fault, when sql socket not
found for mysql.

the patch is for src/modules/rlm_sql/sql_mysql.c


patch:

--- sql_mysql.c.org     Fri Aug  2 14:02:29 2002
+++ sql_mysql.c Fri Aug  2 14:03:41 2002
@@ -288,6 +288,12 @@

*************************************************************************/
 char *sql_error(SQLSOCK * sqlsocket, SQL_CONFIG *config) {
        rlm_sql_mysql_sock *mysql_sock = sqlsocket->conn;
+
+       if (mysql_sock == NULL || mysql_sock->sock == NULL) {
+               radlog(L_INFO, "rlm_sql: sql sock null");
+               return NULL;
+       }
+
        return mysql_error(mysql_sock->sock);
 }


On Thu, 25 Jul 2002, CheongMeng wrote:

> Date: Thu, 25 Jul 2002 18:00:21 +0800 (SGT)
> From: CheongMeng <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: segmentation fault when calling inst->module->sql_error
>
> Hi,
>
> I am using freeradius CVS (25 July) & mysql for accounting.
>
> noticed that radiusd always get segmentation fault when it call the
> function
> (sql_error()) at the rlm_sql.c, eg:
>
> if (rlm_sql_query(sqlsocket, inst, querystr)) {
>                                         radlog(L_ERR, "rlm_sql: Couldn't
> update SQL accounting STOP record - %s", (char
> *)(inst->module->sql_error)(sqlsocket, inst->config));
>                                 }
>
> it doesn't happen in the 0.6 release.
>
> just would like to check if this happen also on anyone else on the list.
>
> I will be grateful, if anyone can shed some light :)
> thx in advance.
>
>

-- 
Cheers,
CM.



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

Reply via email to