2 * Network Configuration Module
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 #include <vconf-keys.h>
30 #include "wifi-agent.h"
31 #include "wifi-state.h"
32 #include "wifi-eap-config.h"
33 #include "network-state.h"
34 #include "network-accessibility.h"
35 #include "wifi-key-encryption.h"
37 #define NETCONFIG_AGENT_FIELD_NAME "Name"
38 #define NETCONFIG_AGENT_FIELD_SSID "SSID"
39 #define NETCONFIG_AGENT_FIELD_IDENTITY "Identity"
40 #define NETCONFIG_AGENT_FIELD_PASSPHRASE "Passphrase"
41 #define NETCONFIG_AGENT_FIELD_WPS "WPS"
42 #define NETCONFIG_AGENT_FIELD_WPS_PBC "WPS_PBC"
43 #define NETCONFIG_AGENT_FIELD_WPS_PIN "WPS_PIN"
44 #if defined TIZEN_CAPTIVE_PORTAL
45 #define NETCONFIG_AGENT_FIELD_USERNAME "Username"
46 #define NETCONFIG_AGENT_FIELD_PASSWORD "Password"
49 #define NETCONFIG_AGENT_ERR_CONNECT_FAILED "connect-failed"
58 #if defined TIZEN_CAPTIVE_PORTAL
63 } netconfig_wifi_agent_s;
65 static GSList *g_agent_list = NULL;
67 static void __agent_clear_fields(netconfig_wifi_agent_s *agent)
72 g_free(agent->interface_name);
74 g_byte_array_free(agent->ssid, TRUE);
76 g_free(agent->identity);
77 g_free(agent->passphrase);
78 g_free(agent->wps_pin);
79 #if defined TIZEN_CAPTIVE_PORTAL
80 g_free(agent->username);
81 g_free(agent->password);
84 agent->interface_name = NULL;
87 agent->identity = NULL;
88 agent->passphrase = NULL;
89 agent->wps_pin = NULL;
90 #if defined TIZEN_CAPTIVE_PORTAL
91 agent->username = NULL;
92 agent->password = NULL;
94 agent->wps_pbc = FALSE;
97 static void __agent_free_data(gpointer data)
99 netconfig_wifi_agent_s *agent = data;
101 __agent_clear_fields(agent);
105 static netconfig_wifi_agent_s *__agent_get_data(const char *interface_name)
109 for (list = g_agent_list; list; list = list->next) {
110 netconfig_wifi_agent_s *wifi_agent = list->data;
111 if (g_strcmp0(wifi_agent->interface_name, interface_name) == 0)
118 int connman_register_agent(void)
120 GVariant *reply = NULL;
121 GVariant *params = NULL;
123 params = g_variant_new("(o)", NETCONFIG_WIFI_PATH);
124 reply = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
125 CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
126 "RegisterAgent", params);
129 ERR("Fail to register agent");
132 g_variant_unref(reply);
134 INFO("Registered to connman agent successfully");
139 int connman_unregister_agent(void)
141 gboolean reply = FALSE;
142 GVariant *param = NULL;
143 const char *path = NETCONFIG_WIFI_PATH;
145 param = g_variant_new("(o)", path);
147 DBG("ConnMan agent unregister");
149 reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
150 CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
151 "UnregisterAgent", param, NULL, NULL);
154 ERR("Fail to unregister agent");
156 /* Clearing the agent fields */
157 g_slist_free_full(g_agent_list, __agent_free_data);
162 gboolean netconfig_wifi_set_agent_field_for_eap_network(const char *interface_name,
163 const char *name, const char *identity, const char *passphrase)
166 netconfig_wifi_agent_s *wifi_agent = NULL;
171 wifi_agent = __agent_get_data(interface_name);
172 if (wifi_agent == NULL)
175 __agent_clear_fields(wifi_agent);
177 name_len = strlen(name);
178 wifi_agent->ssid = g_byte_array_sized_new(name_len);
179 wifi_agent->ssid->len = name_len;
180 memcpy(wifi_agent->ssid->data, name, name_len + 1);
183 wifi_agent->identity = g_strdup(identity);
186 wifi_agent->passphrase = g_strdup(passphrase);
188 gchar *enc_data = NULL;
189 enc_data = _netconfig_encrypt_passphrase(wifi_agent->passphrase);
192 ERR("Failed to encrypt the passphrase");
194 g_free(wifi_agent->passphrase);
195 wifi_agent->passphrase = enc_data;
198 DBG("Successfully configured for EAP network");
203 gboolean handle_set_field(NetConnmanAgent *connman_agent,
204 GDBusMethodInvocation *context, const gchar *service, GVariant *fields)
206 GError *error = NULL;
210 gboolean updated = FALSE;
211 gboolean reply = FALSE;
212 const char *interface_name = NULL;
213 netconfig_wifi_agent_s *wifi_agent = NULL;
215 g_return_val_if_fail(connman_agent != NULL, TRUE);
217 DBG("Set agent fields for %s", service);
219 if (netconfig_is_wifi_profile(service) != TRUE) {
220 error = g_error_new(G_DBUS_ERROR,
221 G_DBUS_ERROR_AUTH_FAILED,
222 CONNMAN_ERROR_INTERFACE ".InvalidService");
224 g_dbus_method_invocation_return_gerror(context, error);
225 g_clear_error(&error);
230 interface_name = netconfig_get_ifname(service);
231 if (interface_name == NULL) {
232 error = g_error_new(G_DBUS_ERROR,
233 G_DBUS_ERROR_AUTH_FAILED,
234 CONNMAN_ERROR_INTERFACE ".InvalidService");
236 g_dbus_method_invocation_return_gerror(context, error);
237 g_clear_error(&error);
242 wifi_agent = __agent_get_data(interface_name);
243 if (wifi_agent == NULL) {
244 wifi_agent = g_try_malloc0(sizeof(netconfig_wifi_agent_s));
245 if (wifi_agent == NULL) {
246 error = g_error_new(G_DBUS_ERROR,
247 G_DBUS_ERROR_AUTH_FAILED,
248 CONNMAN_ERROR_INTERFACE ".OutOfMemory");
250 g_dbus_method_invocation_return_gerror(context, error);
251 g_clear_error(&error);
256 g_agent_list = g_slist_append(g_agent_list, wifi_agent);
259 __agent_clear_fields(wifi_agent);
260 wifi_agent->interface_name = g_strdup(interface_name);
262 g_variant_get(fields, "a{sv}", &iter);
263 while (g_variant_iter_loop(iter, "{sv}", &field, &value)) {
264 if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSPHRASE) == 0) {
265 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
266 wifi_agent->passphrase = g_strdup(g_variant_get_string(value, NULL));
269 DBG("Field [%s] - []", (gchar *)field);
271 if (wifi_agent->passphrase == NULL)
274 if (netconfig_check_passphrase(service, wifi_agent->passphrase) == FALSE) {
275 ERR("Invalid passphrase");
277 g_free(wifi_agent->passphrase);
278 wifi_agent->passphrase = NULL;
284 gchar *enc_data = NULL;
285 enc_data = _netconfig_encrypt_passphrase(wifi_agent->passphrase);
288 ERR("Failed to encrypt the passphrase");
292 g_free(wifi_agent->passphrase);
293 wifi_agent->passphrase = enc_data;
295 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PBC) == 0) {
296 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING) &&
297 g_strcmp0(g_variant_get_string(value, NULL), "enable") == 0) {
298 wifi_agent->wps_pbc = TRUE;
301 DBG("Field [%s] - [%d]", (gchar *)field, wifi_agent->wps_pbc);
303 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PIN) == 0) {
304 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
305 wifi_agent->wps_pin = g_strdup(g_variant_get_string(value, NULL));
308 DBG("Field [%s] - [%s]", (gchar *)field, wifi_agent->wps_pin);
310 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_NAME) == 0) {
311 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
312 wifi_agent->name = g_strdup(g_variant_get_string(value, NULL));
315 DBG("Field [%s] - [%s]", (gchar *)field, wifi_agent->name);
317 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_SSID) == 0) {
318 if (wifi_agent->ssid != NULL) {
319 g_byte_array_free(wifi_agent->ssid, TRUE);
320 wifi_agent->ssid = NULL;
323 if (g_variant_is_of_type(value, G_VARIANT_TYPE_BYTESTRING)) {
326 GByteArray *array = g_byte_array_new();
328 g_variant_get(value, "ay", &iter1);
329 while (g_variant_iter_loop(iter1, "y", &char_value))
330 g_byte_array_append(array, &char_value, 1);
331 g_variant_iter_free(iter1);
332 if (array != NULL && (array->len > 0)) {
333 wifi_agent->ssid = g_byte_array_sized_new(array->len);
334 wifi_agent->ssid->len = array->len;
335 memcpy(wifi_agent->ssid->data, array->data, array->len);
338 DBG("Field [%s] - []", (gchar *)field);
341 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_IDENTITY) == 0) {
342 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
343 wifi_agent->identity = g_strdup(g_variant_get_string(value, NULL));
346 DBG("Field [%s] - [%s]", (gchar *)field, wifi_agent->identity);
348 #if defined TIZEN_CAPTIVE_PORTAL
349 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_USERNAME) == 0) {
350 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
351 wifi_agent->username = g_strdup(g_variant_get_string(value, NULL));
354 DBG("Field [%s] - [%s]", (gchar *)field, wifi_agent->username);
356 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSWORD) == 0) {
357 if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
358 wifi_agent->password = g_strdup(g_variant_get_string(value, NULL));
361 DBG("Field [%s] - [%s]", (gchar *)field, wifi_agent->password);
367 g_variant_iter_free(iter);
369 if (updated == TRUE) {
370 reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
371 service, CONNMAN_SERVICE_INTERFACE, "Connect",
372 NULL, __netconfig_wifi_connect_reply,
373 g_strdup(interface_name));
375 ERR("Fail to connect Wi-Fi");
376 __agent_clear_fields(wifi_agent);
377 error = g_error_new(G_DBUS_ERROR,
378 G_DBUS_ERROR_AUTH_FAILED,
379 CONNMAN_ERROR_INTERFACE ".InvalidArguments");
381 g_dbus_method_invocation_return_gerror(context, error);
382 g_clear_error(&error);
386 ERR("Fail to connect Wi-Fi");
387 __agent_clear_fields(wifi_agent);
389 error = g_error_new(G_DBUS_ERROR,
390 G_DBUS_ERROR_AUTH_FAILED,
391 CONNMAN_ERROR_INTERFACE ".InvalidArguments");
393 g_dbus_method_invocation_return_gerror(context, error);
394 g_clear_error(&error);
398 net_connman_agent_complete_set_field(connman_agent, context);
402 gboolean handle_request_input(NetConnmanAgent *connman_agent,
403 GDBusMethodInvocation *context, const gchar *service, GVariant *fields)
407 GVariant *r_value = NULL;
408 GVariant *out_table = NULL;
409 gboolean updated = FALSE;
410 GVariantBuilder *builder = NULL;
411 GError *error = NULL;
412 const char *interface_name = NULL;
413 netconfig_wifi_agent_s *wifi_agent = NULL;
415 g_return_val_if_fail(connman_agent != NULL, TRUE);
420 DBG("Agent fields requested for service: %s", service);
422 interface_name = netconfig_get_ifname(service);
423 if (interface_name == NULL) {
424 error = g_error_new(G_DBUS_ERROR,
425 G_DBUS_ERROR_AUTH_FAILED,
426 CONNMAN_ERROR_INTERFACE ".InvalidService");
428 g_dbus_method_invocation_return_gerror(context, error);
429 g_clear_error(&error);
434 wifi_agent = __agent_get_data(interface_name);
435 if (wifi_agent == NULL) {
436 error = g_error_new(G_DBUS_ERROR,
437 G_DBUS_ERROR_AUTH_FAILED,
438 CONNMAN_ERROR_INTERFACE ".InvalidService");
440 g_dbus_method_invocation_return_gerror(context, error);
441 g_clear_error(&error);
446 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
448 g_variant_get(fields, "a{sv}", &iter);
449 while (g_variant_iter_loop(iter, "{sv}", &field, &r_value)) {
451 if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSPHRASE) == 0 &&
452 wifi_agent->passphrase != NULL) {
453 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_PASSPHRASE,
454 g_variant_new_string(wifi_agent->passphrase));
457 DBG("Setting [%s] - [%s]", field, wifi_agent->passphrase);
458 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS) == 0 &&
459 (wifi_agent->wps_pbc == TRUE || wifi_agent->wps_pin != NULL)) {
460 if (wifi_agent->wps_pbc == TRUE) {
461 /* Sending empty string for WPS push button method */
462 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_WPS,
463 g_variant_new_string(""));
466 DBG("Setting empty string for [%s]", field);
467 } else if (wifi_agent->wps_pin != NULL) {
468 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_WPS,
469 g_variant_new_string(wifi_agent->wps_pin));
472 DBG("Setting string [%s] - [%s]", field, wifi_agent->wps_pin);
474 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_NAME) == 0 &&
475 wifi_agent->name != NULL) {
476 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_NAME,
477 g_variant_new_string(wifi_agent->name));
480 DBG("Settings [%s] - [%s]", field, wifi_agent->name);
481 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_SSID) == 0 &&
482 wifi_agent->ssid != NULL) {
484 GVariantBuilder *builder1 = NULL;
485 builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
487 for (i = 0; i < (wifi_agent->ssid->len); i++)
488 g_variant_builder_add(builder1, "y", wifi_agent->ssid->data[i]);
490 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_SSID,
491 g_variant_builder_end(builder1));
492 if (builder1 != NULL)
493 g_variant_builder_unref(builder1);
496 DBG("Settings [%s] - []", field);
497 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_IDENTITY) == 0 &&
498 wifi_agent->identity != NULL) {
499 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_IDENTITY,
500 g_variant_new_string(wifi_agent->identity));
503 DBG("Settings [%s] - [%s]", field, wifi_agent->identity);
504 #if defined TIZEN_CAPTIVE_PORTAL
505 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_USERNAME) == 0 &&
506 wifi_agent->username != NULL) {
507 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_USERNAME,
508 g_variant_new_string(wifi_agent->username));
511 DBG("Settings [%s] - [%s]", field, wifi_agent->username);
512 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSWORD) == 0 &&
513 wifi_agent->password != NULL) {
514 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_PASSWORD,
515 g_variant_new_string(wifi_agent->password));
518 DBG("Settings [%s] - [%s]", field, wifi_agent->password);
523 out_table = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
526 g_variant_builder_unref(builder);
528 g_variant_iter_free(iter);
531 if (NULL == out_table) {
532 net_connman_agent_complete_request_input(connman_agent, context, out_table);
538 g_dbus_method_invocation_return_value(context, out_table);
540 GError *error = NULL;
541 error = g_error_new(G_DBUS_ERROR,
542 G_DBUS_ERROR_AUTH_FAILED,
543 "net.connman.Agent.Error.Canceled");
545 g_dbus_method_invocation_return_gerror(context, error);
546 g_clear_error(&error);
549 __agent_clear_fields(wifi_agent);
555 gboolean handle_report_error(NetConnmanAgent *connman_agent,
556 GDBusMethodInvocation *context, const gchar *service, const gchar *error)
558 g_return_val_if_fail(connman_agent != NULL, TRUE);
560 net_connman_agent_complete_report_error(connman_agent, context);
561 DBG("Agent error for service[%s] - [%s]", service, error);
563 /* Do something when it failed to make a connection */
568 #if defined TIZEN_CAPTIVE_PORTAL
569 #if defined TIZEN_WEARABLE
570 #define QUERY_FOR_INTERNET_INTERVAL 2
571 #define TIMER_THRESHOLD 4
573 #define QUERY_FOR_INTERNET_INTERVAL 20
574 #define TIMER_THRESHOLD 120
577 static gboolean is_monitor_notifier_registered = FALSE;
579 #if defined TIZEN_WEARABLE
580 static gboolean is_portal_msg_shown = FALSE;
583 struct poll_timer_data {
589 static struct poll_timer_data timer_data = {
590 QUERY_FOR_INTERNET_INTERVAL, 0, NULL};
592 static gboolean __check_ignore_portal_list(const char * ssid)
596 int ignore_ap_count = 0;
601 DBG("checking ssid [%s]", ssid);
603 DBG("csc string [%s]", def_str);
604 gchar ** ignore_ap_list = g_strsplit(def_str, ",", 0);
605 ignore_ap_count = g_strv_length(ignore_ap_list);
606 for (i = 0; i < ignore_ap_count; i++) {
607 DBG("[%d] - [%s]", i, ignore_ap_list[i]);
608 if (strncmp(ignore_ap_list[i], ssid, strlen(ssid)) == 0) {
609 g_strfreev(ignore_ap_list);
614 g_strfreev(ignore_ap_list);
618 static void __wifi_state_monitor(wifi_state_notifier_s *notifier,
619 char *service, wifi_service_state_e state, void *user_data);
621 static wifi_state_notifier_s wifi_state_monitor_notifier = {
624 .wifi_state_changed = __wifi_state_monitor,
628 static void __wifi_state_monitor(wifi_state_notifier_s *notifier,
629 char *service, wifi_service_state_e state, void *user_data)
631 DBG("Wi-Fi state: %x", state);
633 if (state == NETCONFIG_WIFI_CONNECTED)
636 if (is_monitor_notifier_registered == TRUE) {
637 wifi_state_notifier_unregister(&wifi_state_monitor_notifier);
638 is_monitor_notifier_registered = FALSE;
641 #if defined TIZEN_WEARABLE
642 is_portal_msg_shown = FALSE;
645 /* suspend if Internet check activity in progress */
646 if (timer_data.timer_id == 0)
649 netconfig_stop_timer(&timer_data.timer_id);
650 netconfig_stop_internet_check();
652 DBG("Stopped Internet accessibility check");
655 static gboolean __netconfig_wifi_portal_login_timeout(gpointer data)
657 char *service_profile = NULL;
658 GVariant *reply = NULL;
662 struct poll_timer_data *timer = (struct poll_timer_data *)data;
666 if (TRUE == netconfig_get_internet_status()) {
667 if (is_monitor_notifier_registered == TRUE) {
668 wifi_state_notifier_unregister(&wifi_state_monitor_notifier);
669 is_monitor_notifier_registered = FALSE;
672 DBG("Portal logged in successfully and update ConnMan state");
673 return FALSE; /* to stop the timer */
675 if (timer->time_elapsed >= TIMER_THRESHOLD) {
676 DBG("Login failed, update ConnMan");
678 if (is_monitor_notifier_registered == TRUE) {
679 wifi_state_notifier_unregister(&wifi_state_monitor_notifier);
680 is_monitor_notifier_registered = FALSE;
683 /* Disconnect and forget the AP */
684 service_profile = (char *)netconfig_get_default_profile();
685 if (service_profile && netconfig_is_wifi_profile(service_profile)) {
686 /* Now forget the AP*/
687 reply = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
688 service_profile, CONNMAN_SERVICE_INTERFACE, "Remove",
692 g_variant_unref(reply);
694 ERR("Failed to forget the AP ");
697 if (wifi_state_get_service_state(netconfig_get_default_ifname())
698 == NETCONFIG_WIFI_CONNECTED) {
699 /* check Internet availability by sending and receiving data*/
700 netconfig_check_internet_accessibility();
701 /* Returning TRUE itself is enough to restart the timer */
702 timer->time_elapsed = timer->time_elapsed +
703 QUERY_FOR_INTERNET_INTERVAL;
712 static void __netconfig_wifi_portal_login_timer_start(struct poll_timer_data
715 DBG("__netconfig_wifi_browser_start_timer...starting timer");
720 netconfig_stop_timer(&(data->timer_id));
722 /* Timer logic: After successful launch of browser, we would check for
723 * Internet status for every 20s until a threshold of 120s
726 data->time_elapsed = QUERY_FOR_INTERNET_INTERVAL;
727 netconfig_start_timer_seconds(QUERY_FOR_INTERNET_INTERVAL,
728 __netconfig_wifi_portal_login_timeout, data, &(data->timer_id));
732 gboolean handle_request_browser(NetConnmanAgent *connman_agent,
733 GDBusMethodInvocation *context, const gchar *service, const gchar *url)
735 #if defined TIZEN_CAPTIVE_PORTAL
736 gboolean ignore_portal = FALSE;
737 const char * ssid = NULL;
739 g_return_val_if_fail(connman_agent != NULL, TRUE);
741 DBG("service[%s] - url[%s]", service, url);
743 ssid = netconfig_wifi_get_connected_essid(netconfig_get_default_profile());
745 ERR("Connected AP name is NULL!!");
746 net_connman_agent_complete_request_browser(connman_agent, context);
750 ignore_portal = __check_ignore_portal_list(ssid);
752 if (ignore_portal == TRUE) {
753 net_connman_agent_complete_request_browser(connman_agent, context);
756 /* Register for Wifi state change notifier*/
757 if (is_monitor_notifier_registered == FALSE) {
758 wifi_state_notifier_register(&wifi_state_monitor_notifier);
759 is_monitor_notifier_registered = TRUE;
762 netconfig_send_notification_to_net_popup(NETCONFIG_ADD_PORTAL_NOTI, ssid);
764 timer_data.time_elapsed = 0;
765 __netconfig_wifi_portal_login_timer_start(&timer_data);
767 net_connman_agent_complete_request_browser(connman_agent, context);
770 GError *error = NULL;
771 error = g_error_new(G_DBUS_ERROR,
772 G_DBUS_ERROR_AUTH_FAILED,
773 CONNMAN_ERROR_INTERFACE ".NotSupported");
775 g_dbus_method_invocation_return_gerror(context, error);
776 g_clear_error(&error);