diff options
author | Patrik Flykt <patrik.flykt@nokia.com> | 2010-09-21 10:07:48 +0300 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-09-21 16:49:47 +0200 |
commit | 9cc65412c3d815a64fe64b0982ef535e4f0e7052 (patch) | |
tree | bc2434698122ebeb5273cf0af7b76323c8cbc5ce /src | |
parent | 611eb643e555f9d8d077a24d592e4ab6c45232e2 (diff) | |
download | connman-9cc65412c3d815a64fe64b0982ef535e4f0e7052.tar.gz connman-9cc65412c3d815a64fe64b0982ef535e4f0e7052.tar.bz2 connman-9cc65412c3d815a64fe64b0982ef535e4f0e7052.zip |
Add connman_service_set_passphrase helper function
Create helper function for setting a service passphrase by factoring out
the code from set_property.
Diffstat (limited to 'src')
-rw-r--r-- | src/service.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/service.c b/src/service.c index 196d0f28..5032fd30 100644 --- a/src/service.c +++ b/src/service.c @@ -1504,6 +1504,22 @@ const char *connman_service_get_proxy_autoconfig(struct connman_service *service return __connman_ipconfig_get_proxy_autoconfig(service->ipconfig); } +static void connman_service_set_passphrase(struct connman_service *service, + const char* passphrase) +{ + g_free(service->passphrase); + service->passphrase = g_strdup(passphrase); + + passphrase_changed(service); + + if (service->network != NULL) + connman_network_set_string(service->network, + "WiFi.Passphrase", + service->passphrase); + + __connman_storage_save_service(service); +} + static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -1575,16 +1591,7 @@ static DBusMessage *set_property(DBusConnection *conn, dbus_message_iter_get_basic(&value, &passphrase); - g_free(service->passphrase); - service->passphrase = g_strdup(passphrase); - - passphrase_changed(service); - - if (service->network != NULL) - connman_network_set_string(service->network, - "WiFi.Passphrase", service->passphrase); - - __connman_storage_save_service(service); + connman_service_set_passphrase(service, passphrase); } else if (g_str_equal(name, "APN") == TRUE) { const char *apn; |