Do you know If I'm  doing this right?
I'd like to run another query just after I receive accounting_stop_query_alt
What I did is
Added line into -> conf.h
    
        char   *accounting_stop_query_alt2;
 
and add lines to rlm_sql.c
       

        {"accounting_stop_query_alt2", PW_TYPE_STRING_PTR,
        offsetof(SQL_CONFIG,accounting_stop_query_alt2), NULL, ""},

 

and

  radius_xlat(querystr, sizeof(querystr), inst->config->accounting_stop_query_alt, request, sql_escape_func);
                                                query_log(request, inst, querystr);

                                                if (*querystr) { /* non-empty query */
                                                        if (rlm_sql_query(sqlsocket, inst, querystr)) {
                                                                radlog(L_ERR, "rlm_sql: Couldn't insert SQL accounting STOP record - %s", (char *)(inst->module->sql_error)(sqlsocket, inst->config));
                                                                ret = RLM_MODULE_FAIL;
                                                        }
                                                        (inst->module->sql_finish_query)(sqlsocket, inst->config);
                                                }
                                                radius_xlat(querystr, sizeof(querystr), inst->config->accounting_stop_query_alt2, request, sql_escape_func);
                                                query_log(request, inst, querystr);

                                                if (*querystr) { /* non-empty query */
                                                        if (rlm_sql_query(sqlsocket, inst, querystr)) {
                                                                radlog(L_ERR, "rlm_sql: Couldn't insert SQL accounting STOP record - %s", (char *)(inst->module->sql_error)(sqlsocket, inst->config));
                                                                ret = RLM_MODULE_FAIL;
                                                        }
                                                        (inst->module->sql_finish_query)(sqlsocket, inst->config);
                                                }
                                }
                                (inst->module->sql_finish_query)(sqlsocket, inst->config);

Thank You

Reply via email to