]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Track blocked / non-blocked state
authorAlan T. DeKok <aland@freeradius.org>
Fri, 24 Aug 2012 15:30:18 +0000 (17:30 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 24 Aug 2012 15:30:18 +0000 (17:30 +0200)
If a REQUEST transitions from OK to STOP_PROCESSING during
a module call, say WHICH module did this.

src/main/modcall.c

index dfc3ba72edc38bba54d3ee556afa35e95660b696..e79973eeb1d79ebdaebd4bd16750fb5a0f49800b 100644 (file)
@@ -275,9 +275,16 @@ static void safe_unlock(module_instance_t *instance)
 static int call_modsingle(int component, modsingle *sp, REQUEST *request)
 {
        int myresult;
+       int blocked;
 
        rad_assert(request != NULL);
 
+       /*
+        *      If the request should stop, refuse to do anything.
+        */
+       blocked = (request->master_state == REQUEST_STOP_PROCESSING);
+       if (blocked) return RLM_MODULE_NOOP;
+
        RDEBUG3("  modsingle[%s]: calling %s (%s) for request %d",
               comp2str[component], sp->modinst->name,
               sp->modinst->entry->name, request->number);
@@ -300,6 +307,15 @@ static int call_modsingle(int component, modsingle *sp, REQUEST *request)
        request->module = "";
        safe_unlock(sp->modinst);
 
+       /*
+        *      Wasn't blocked, and now is.  Complain!
+        */
+       blocked = (request->master_state == REQUEST_STOP_PROCESSING);
+       if (blocked) {
+               radlog(L_INFO, "WARNING: Module %s became blocked for request %u",
+                      sp->modinst->entry->name, request->number);
+       }
+
  fail:
        RDEBUG3("  modsingle[%s]: returned from %s (%s) for request %d",
               comp2str[component], sp->modinst->name,