From: Dmitry Borodaenko Date: Sat, 6 Aug 2011 17:15:59 +0000 (+0300) Subject: Fix rlm_sql noop for accounting start X-Git-Tag: release_2_1_12~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f3f0b90ec75a7998e292f341609c078162db579;p=thirdparty%2Ffreeradius-server.git Fix rlm_sql noop for accounting start When 6ed9727 was merged, else{} in the START case got placed against the wrong if(). Unlike STOP and ALIVE cases, in START insert comes first, and we only care if that affects 0 rows. If insert fails and we have to go for an update, we don't have to check for NOOP because we can assume the insert failed due to a conflicting row already in the database. --- diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index 8a1b3304bbe..c26bded430a 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -1321,13 +1321,13 @@ static int rlm_sql_accounting(void *instance, REQUEST * request) { radlog_request(L_ERR, 0, request, "Couldn't update SQL accounting START record - %s", (inst->module->sql_error)(sqlsocket, inst->config)); ret = RLM_MODULE_FAIL; - } else { - numaffected = (inst->module->sql_affected_rows)(sqlsocket, inst->config); - if (numaffected < 1) { - ret = RLM_MODULE_NOOP; - } } } + } else { + numaffected = (inst->module->sql_affected_rows)(sqlsocket, inst->config); + if (numaffected < 1) { + ret = RLM_MODULE_NOOP; + } } (inst->module->sql_finish_query)(sqlsocket, inst->config); }