]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
If there's no acquire method, don't check for non-null handle
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 29 Nov 2016 10:52:55 +0000 (05:52 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 29 Nov 2016 11:15:32 +0000 (06:15 -0500)
src/modules/rlm_cache/rlm_cache.c

index bb529e26fcd3086d4cd93a710abd080e4c5db57c..4950b879726f2f44319e51f8c73f8eea21f5621c 100644 (file)
@@ -51,7 +51,10 @@ static const CONF_PARSER module_config[] = {
  */
 static int cache_acquire(rlm_cache_handle_t **out, rlm_cache_t const *inst, REQUEST *request)
 {
-       if (!inst->driver->acquire) return 0;
+       if (!inst->driver->acquire) {
+               *out = NULL;
+               return 0;
+       }
 
        return inst->driver->acquire(out, &inst->config, inst->driver_inst, request);
 }
@@ -577,7 +580,7 @@ static rlm_rcode_t mod_cache_it(void *instance, UNUSED void *thread, REQUEST *re
 
                rcode = cache_find(&c, inst, request, &handle, key, key_len);
                if (rcode == RLM_MODULE_FAIL) goto finish;
-               rad_assert(handle);
+               rad_assert(!inst->driver->acquire || handle);
 
                rcode = c ? RLM_MODULE_OK:
                            RLM_MODULE_NOTFOUND;
@@ -638,7 +641,7 @@ static rlm_rcode_t mod_cache_it(void *instance, UNUSED void *thread, REQUEST *re
                default:
                        rad_assert(0);
                }
-               rad_assert(handle);
+               rad_assert(!inst->driver->acquire || handle);
        }
 
        /*
@@ -697,7 +700,7 @@ static rlm_rcode_t mod_cache_it(void *instance, UNUSED void *thread, REQUEST *re
                default:
                        rad_assert(0);
                }
-               rad_assert(handle);
+               rad_assert(!inst->driver->acquire || handle);
        }
 
        /*
@@ -746,7 +749,7 @@ static rlm_rcode_t mod_cache_it(void *instance, UNUSED void *thread, REQUEST *re
                default:
                        rad_assert(0);
                }
-               rad_assert(handle);
+               rad_assert(!inst->driver->acquire || handle);
                goto finish;
        }