]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fixup unit_test_module to use protocol dictionaries
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 19 Oct 2018 14:48:32 +0000 (10:48 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Dec 2018 16:20:31 +0000 (11:20 -0500)
src/bin/unit_test_module.c

index 09fc64f66efa328c421c0f0a84d04ccf58b4fb3c..7bed700940bf6496f576673ebbeeebc7b3eb1918 100644 (file)
@@ -579,6 +579,7 @@ int main(int argc, char *argv[])
        RADCLIENT               *client = NULL;
        CONF_SECTION            *unlang;
        char                    *auth_type;
+       fr_dict_t               *dict;
 
        TALLOC_CTX              *autofree = talloc_autofree_context();
        TALLOC_CTX              *thread_ctx = talloc_new(autofree);
@@ -706,6 +707,21 @@ int main(int argc, char *argv[])
                goto finish;
        }
 
+       if (fr_dict_internal_afrom_file(&dict, FR_DICTIONARY_INTERNAL_DIR) < 0) {
+               fr_perror("unit_test_attribute");
+               rcode = EXIT_FAILURE;
+               goto finish;
+       }
+
+       /*
+        *      Load the custom dictionary
+        */
+       if (fr_dict_read(dict, config->raddb_dir, FR_DICTIONARY_FILE) == -1) {
+               fr_log_perror(&default_log, L_ERR, "Failed to initialize the dictionaries");
+               rcode = EXIT_FAILURE;
+               goto finish;
+       }
+
        if (fr_dict_autoload(unit_test_module_dict) < 0) {
                fr_perror("%s", config->name);
                rcode = EXIT_FAILURE;
@@ -1090,6 +1106,11 @@ finish:
         */
        fr_dict_autofree(unit_test_module_dict);
 
+       /*
+        *      Free our explicitly loaded internal dictionary
+        */
+       fr_dict_free(&dict);
+
        /*
         *      Free the strerror buffer.
         */