]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix rlm_sql noop for accounting start 19/head
authorDmitry Borodaenko <angdraug@debian.org>
Sat, 6 Aug 2011 17:15:59 +0000 (20:15 +0300)
committerDmitry Borodaenko <angdraug@debian.org>
Sun, 18 Sep 2011 09:07:15 +0000 (12:07 +0300)
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.

src/modules/rlm_sql/rlm_sql.c

index 8a1b3304bbe15df598fdb4e54ac2c94213976948..c26bded430a8d8d0f2da5fc40697c2a1671dbfa6 100644 (file)
@@ -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);
                        }