dbus: Add SaveConfig to update configuration file

This is similar to SAVE_CONFIG on control interface, which allow users
to update the configuration file.

Signed-off-by: Purushottam Kushwaha <p.kushwaha@samsung.com>
Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
master
Purushottam Kushwaha 9 years ago committed by Jouni Malinen
parent a3dff7dc0c
commit 2d0fe6bc4e

@ -455,6 +455,10 @@ fi.w1.wpa_supplicant1.CreateInterface.
<dd>Initiating the TDLS operation failed for an unknown reason.</dd>
</dl>
</li>
<li>
<h3>SaveConfig ( ) --> nothing</h3>
<p>Save configuration to the configuration file.</p>
</li>
<li>
<h3>EAPLogoff ( ) --> nothing</h3>
<p>IEEE 802.1X EAPOL state machine logoff.</p>

@ -3069,6 +3069,14 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
}
},
#endif /* CONFIG_TDLS */
#ifndef CONFIG_NO_CONFIG_WRITE
{ "SaveConfig", WPAS_DBUS_NEW_IFACE_INTERFACE,
(WPADBusMethodHandler) wpas_dbus_handler_save_config,
{
END_ARGS
}
},
#endif /* CONFIG_NO_CONFIG_WRITE */
{ NULL, NULL, NULL, { END_ARGS } }
};

@ -2294,6 +2294,35 @@ DBusMessage * wpas_dbus_handler_tdls_teardown(DBusMessage *message,
#endif /* CONFIG_TDLS */
#ifndef CONFIG_NO_CONFIG_WRITE
/**
* wpas_dbus_handler_save_config - Save configuration to configuration file
* @message: Pointer to incoming dbus message
* @wpa_s: wpa_supplicant structure for a network interface
* Returns: NULL on Success, Otherwise errror message
*
* Handler function for "SaveConfig" method call of network interface.
*/
DBusMessage * wpas_dbus_handler_save_config(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
int ret;
if (!wpa_s->conf->update_config) {
return wpas_dbus_error_unknown_error(
message,
"Not allowed to update configuration (update_config=0)");
}
ret = wpa_config_write(wpa_s->confname, wpa_s->conf);
if (ret)
return wpas_dbus_error_unknown_error(
message, "Failed to update configuration");
return NULL;
}
#endif /* CONFIG_NO_CONFIG_WRITE */
/**
* wpas_dbus_handler_set_pkcs11_engine_and_module_path - Set PKCS #11 engine and module path
* @message: Pointer to incoming dbus message

@ -194,6 +194,9 @@ DBusMessage * wpas_dbus_handler_tdls_status(DBusMessage *message,
DBusMessage * wpas_dbus_handler_tdls_teardown(DBusMessage *message,
struct wpa_supplicant *wpa_s);
DBusMessage * wpas_dbus_handler_save_config(DBusMessage *message,
struct wpa_supplicant *wpa_s);
DBusMessage * wpas_dbus_error_invalid_args(DBusMessage *message,
const char *arg);
DBusMessage * wpas_dbus_error_unknown_error(DBusMessage *message,

Loading…
Cancel
Save