- int rc;
-
- if (!storage || !storage->save)
- return -1;
-
- if (newconfig == config)
- return 0;
-
- pb_log("new configuration data received\n");
- dump_config(config);
-
- rc = storage->save(storage, config);
-
- 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;
-}
-
-const struct config *config_get(void)
-{
- return config;
-}
-
-void config_set_autoboot(bool autoboot_enabled)
-{
- config->autoboot_enabled = autoboot_enabled;
-
- pb_log("set autoboot: %s\n",
- config->autoboot_enabled ? "enabled" : "disabled");
-}
+ struct config *dest;
+ unsigned int i;
+
+ dest = talloc(ctx, struct config);
+ dest->autoboot_enabled = src->autoboot_enabled;
+ dest->autoboot_timeout_sec = src->autoboot_timeout_sec;
+
+ dest->network.n_interfaces = src->network.n_interfaces;
+ dest->network.interfaces = talloc_array(dest, struct interface_config *,
+ dest->network.n_interfaces);
+ dest->network.n_dns_servers = src->network.n_dns_servers;
+ dest->network.dns_servers = talloc_array(dest, const char *,
+ dest->network.n_dns_servers);
+
+ for (i = 0; i < src->network.n_interfaces; i++)
+ dest->network.interfaces[i] = config_copy_interface(dest,
+ src->network.interfaces[i]);
+
+ for (i = 0; i < src->network.n_dns_servers; i++)
+ dest->network.dns_servers[i] = talloc_strdup(dest,
+ src->network.dns_servers[i]);
+
+ dest->n_boot_priorities = src->n_boot_priorities;
+ dest->boot_priorities = talloc_array(dest, struct boot_priority,
+ src->n_boot_priorities);
+
+ for (i = 0; i < src->n_boot_priorities; i++) {
+ dest->boot_priorities[i].priority =
+ src->boot_priorities[i].priority;
+ dest->boot_priorities[i].type = src->boot_priorities[i].type;
+ }