return 0;
}
+
+/*************************************************************************
+ *
+ * Function: sql_destroy_socket
+ *
+ * Purpose: Free socket and private connection data
+ *
+ *************************************************************************/
+static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
+{
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
+ return 0;
+}
+
/*************************************************************************
*
* Function: sql_query
rlm_sql_module_t rlm_sql_db2 = {
"rlm_sql_db2",
sql_init_socket,
- not_implemented, /* sql_destroy_socket*/
+ sql_destroy_socket, /* sql_destroy_socket*/
sql_query,
sql_select_query,
not_implemented, /* sql_store_result */
if(SQLAllocEnv(&iodbc_sock->env_handle) != SQL_SUCCESS) {
radlog(L_CONS|L_ERR, "sql_create_socket: SQLAllocEnv failed: %s",
sql_error(sqlsocket, config));
- exit(1);
+ return -1;
}
if(SQLAllocConnect(iodbc_sock->env_handle, &iodbc_sock->dbc_handle) != SQL_SUCCESS) {
radlog(L_CONS|L_ERR, "sql_create_socket: SQLAllocConnect failed: %s",
sql_error(sqlsocket, config));
- exit(1);
+ return -1;
}
if (SQLConnect(iodbc_sock->dbc_handle, config->sql_db, SQL_NTS,
SQL_NTS) != SQL_SUCCESS) {
radlog(L_CONS|L_ERR, "sql_create_socket: SQLConnectfailed: %s",
sql_error(sqlsocket, config));
- exit(1);
+ return -1;
}
return 0;
*************************************************************************/
static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
- /*
- * FIXME: Someone write the odbc specific disconnect and
- * free code!!
- */
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
return 0;
}
if(SQLAllocStmt(iodbc_sock->dbc_handle, &iodbc_sock->stmt_handle) != SQL_SUCCESS) {
radlog(L_CONS|L_ERR, "sql_create_socket: SQLAllocStmt failed: %s",
sql_error(sqlsocket, config));
- exit(1);
+ return -1;
}
if (config->sqltrace)
*************************************************************************/
static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
- rlm_sql_mysql_sock *mysql_sock = sqlsocket->conn;
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
- free(mysql_sock);
return 0;
}
*************************************************************************/
static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
-
- /*
- * FIXME: Someone write the oracle specific disconnect
- * and free code!!
- */
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
return 0;
}
*************************************************************************/
static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
- rlm_sql_postgres_sock *pg_sock = sqlsocket->conn;
-
- free(pg_sock);
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
return 0;
}
* Purpose: Free socket and private connection data
*
*************************************************************************/
-static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
-
- /* Why bother, rlm_sql never calls sql_destroy_socket anyway */
-
+static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
+{
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
return 0;
}
*************************************************************************/
static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
- rlm_sql_unixodbc_sock *unixodbc_sock = sqlsocket->conn;
- free(unixodbc_sock);
- return 0;
+ free(sqlsocket->conn);
+ sqlsocket->conn = NULL;
+ return 0;
}