+int config_set(struct config *newconfig)
+{
+ int rc;
+
+ if (!storage || !storage->save)
+ return -1;
+
+ if (newconfig == config)
+ return 0;
+
+ pb_log("new configuration data received\n");
+ dump_config(newconfig);
+
+ rc = storage->save(storage, newconfig);
+
+ if (!rc)
+ config = talloc_steal(config_ctx, newconfig);
+ else
+ pb_log("error saving new configuration; changes lost\n");
+
+ return rc;
+}
+
+/* A non-exported function to allow the test infrastructure to initialise
+ * (and change) the configuration variables */
+struct parser_test;
+struct config __attribute__((unused)) *test_config_init(
+ struct parser_test *test);
+struct config *test_config_init(struct parser_test *test)
+{
+ config = talloc(test, struct config);
+ config_set_defaults(config);
+ return config;
+}
+