Sync with Tizen 2.4(v1.1.38)
[platform/core/connectivity/net-config.git] / src / wifi-agent.c
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 #include <app.h>
21 #include <stdio.h>
22 #include <vconf.h>
23 #include <stdlib.h>
24 #include <unistd.h>
25 #include <vconf-keys.h>
26
27 #include "log.h"
28 #include "util.h"
29 #include "wifi.h"
30 #include "netdbus.h"
31 #include "wifi-agent.h"
32 #include "wifi-state.h"
33 #include "wifi-eap-config.h"
34 #include "network-state.h"
35 #include "network-accessibility.h"
36
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
45 #define NETCONFIG_AGENT_ERR_CONNECT_FAILED              "connect-failed"
46
47 struct netconfig_wifi_agent {
48         GByteArray *ssid;
49         char *name;
50         char *identity;
51         char *passphrase;
52         char *wps_pin;
53         gboolean wps_pbc;
54 };
55
56 static struct netconfig_wifi_agent agent;
57
58 static void __netconfig_agent_clear_fields(void)
59 {
60         g_byte_array_free(agent.ssid, TRUE);
61         g_free(agent.name);
62         g_free(agent.identity);
63         g_free(agent.passphrase);
64         g_free(agent.wps_pin);
65
66         agent.ssid = NULL;
67         agent.name = NULL;
68         agent.identity = NULL;
69         agent.passphrase = NULL;
70         agent.wps_pin = NULL;
71         agent.wps_pbc = FALSE;
72 }
73
74 int connman_register_agent(void)
75 {
76         GVariant *reply = NULL;
77         GVariant *params = NULL;
78         GError *error;
79         GDBusConnection *connection = NULL;
80
81         connection = netdbus_get_connection();
82         if (connection == NULL) {
83                 ERR("GDBusconnection is NULL");
84                 return -1;
85         }
86
87         do {
88                 error = NULL;
89                 params = g_variant_new("(o)", NETCONFIG_WIFI_PATH);
90
91                 reply = g_dbus_connection_call_sync(
92                                 connection,
93                                 CONNMAN_SERVICE,
94                                 CONNMAN_MANAGER_PATH,
95                                 CONNMAN_MANAGER_INTERFACE,
96                                 "RegisterAgent",
97                                 params,
98                                 NULL,
99                                 G_DBUS_CALL_FLAGS_NONE,
100                                 DBUS_REPLY_TIMEOUT,
101                                 netdbus_get_cancellable(),
102                                 &error);
103
104                 if (reply == NULL) {
105                  if (error != NULL) {
106                          if (g_strcmp0(error->message,
107                                          "GDBus.Error:net.connman.Error.AlreadyExists: Already exists") == 0) {
108                                         break;
109                          } else {
110                                  ERR("Fail to register agent [%d: %s]",
111                                                  error->code, error->message);
112                          }
113
114                          g_error_free(error);
115                  } else
116                          ERR("Fail to register agent");
117                 } else
118                         g_variant_unref(reply);
119
120                 sleep(1);
121         } while (TRUE);
122
123         INFO("Registered to connman agent successfully");
124
125         return 0;
126 }
127
128 int connman_unregister_agent(void)
129 {
130         gboolean reply = FALSE;
131         GVariant *param = NULL;
132         const char *path = NETCONFIG_WIFI_PATH;
133
134         param = g_variant_new("(o)", path);
135
136         DBG("ConnMan agent unregister");
137
138         reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
139                         CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
140                         "UnregisterAgent", param, NULL);
141
142         if (reply != TRUE)
143                 ERR("Fail to unregister agent");
144
145         /* Clearing the agent fields */
146         __netconfig_agent_clear_fields();
147
148         return reply;
149 }
150
151 gboolean netconfig_wifi_set_agent_field_for_eap_network(
152                 const char *name, const char *identity, const char *passphrase)
153 {
154         int name_len;
155
156         if (name == NULL)
157                 return FALSE;
158
159         __netconfig_agent_clear_fields();
160
161         name_len = strlen(name);
162         agent.ssid = g_byte_array_sized_new(name_len);
163         agent.ssid->len = name_len;
164         memcpy(agent.ssid->data, name, name_len);
165
166         if (identity)
167                 agent.identity = g_strdup(identity);
168
169         if (passphrase)
170                 agent.passphrase = g_strdup(passphrase);
171
172         DBG("Successfully configured for EAP network");
173
174         return TRUE;
175 }
176
177 gboolean handle_set_field(NetConnmanAgent *connman_agent,
178                 GDBusMethodInvocation *context, const gchar *service, GVariant *fields)
179 {
180         GError *error = NULL;
181         GVariantIter *iter;
182         gpointer field;
183         GVariant *value;
184         gboolean updated = FALSE;
185         gboolean reply = FALSE;
186
187         g_return_val_if_fail(connman_agent != NULL, FALSE);
188
189         DBG("Set agent fields for %s", service);
190
191         if (netconfig_is_wifi_profile(service) != TRUE) {
192                 error = g_error_new(G_DBUS_ERROR,
193                                 G_DBUS_ERROR_AUTH_FAILED,
194                                 CONNMAN_ERROR_INTERFACE ".InvalidService");
195
196                 g_dbus_method_invocation_return_gerror(context, error);
197                 g_clear_error(&error);
198
199                 return reply;
200         }
201
202         __netconfig_agent_clear_fields();
203         g_variant_get(fields, "a{sv}", &iter);
204         while (g_variant_iter_loop(iter, "{sv}", &field, &value)) {
205                 if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSPHRASE) == 0) {
206                         g_free(agent.passphrase);
207                         if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
208                                 agent.passphrase = g_strdup(g_variant_get_string(value, NULL));
209                                 updated = TRUE;
210
211                                 DBG("Field [%s] - []", field);
212                         } else {
213                                 agent.passphrase = NULL;
214                         }
215                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PBC) == 0) {
216                         agent.wps_pbc = FALSE;
217                         if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING) &&
218                                         g_strcmp0(g_variant_get_string(value, NULL), "enable") == 0) {
219                                 agent.wps_pbc = TRUE;
220                                 updated = TRUE;
221
222                                 DBG("Field [%s] - [%d]", field, agent.wps_pbc);
223                         }
224                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PIN) == 0) {
225                         g_free(agent.wps_pin);
226                         agent.wps_pbc = FALSE;
227                         if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
228                                 agent.wps_pin = g_strdup(g_variant_get_string(value, NULL));
229                                 updated = TRUE;
230
231                                 DBG("Field [%s] - []", field);
232                         } else {
233                                 agent.wps_pin = NULL;
234                         }
235                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_NAME) == 0) {
236                         g_free(agent.name);
237                         if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
238                                 agent.name = g_strdup(g_variant_get_string(value, NULL));
239                                 updated = TRUE;
240
241                                 DBG("Field [%s] - []", field);
242                         } else {
243                                 agent.name = NULL;
244                         }
245                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_SSID) == 0) {
246                         if (agent.ssid != NULL) {
247                                 g_byte_array_free(agent.ssid, TRUE);
248                                 agent.ssid = NULL;
249                         }
250
251                         if (g_variant_is_of_type(value, G_VARIANT_TYPE_BYTESTRING)) {
252                                 guint8 char_value;
253                                 GVariantIter *iter1;
254                                 GByteArray *array = g_byte_array_new();
255
256                                 g_variant_get(value, "ay", &iter1);
257                                 while(g_variant_iter_loop(iter1, "y",  &char_value)) {
258                                         g_byte_array_append(array, &char_value, 1);
259                                 }
260                                 g_variant_iter_free(iter1);
261                                 if (array != NULL && (array->len > 0)) {
262                                         agent.ssid = g_byte_array_sized_new(array->len);
263                                         agent.ssid->len = array->len;
264                                         memcpy(agent.ssid->data, array->data, array->len);
265                                         updated = TRUE;
266
267                                         DBG("Field [%s] - []", field);
268                                 }
269                         }
270                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_IDENTITY) == 0) {
271                         g_free(agent.identity);
272                         if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
273                                 agent.identity = g_strdup(g_variant_get_string(value, NULL));
274                                 updated = TRUE;
275
276                                 DBG("Field [%s] - []", field);
277                         } else {
278                                 agent.identity = NULL;
279                         }
280                 }
281         }
282
283         if (updated == TRUE) {
284                 reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
285                                 service, CONNMAN_SERVICE_INTERFACE, "Connect", NULL, NULL);
286                 if (reply == TRUE) {
287                         g_dbus_method_invocation_return_value (context, NULL);
288                 } else {
289                         error = g_error_new(G_DBUS_ERROR,
290                                         G_DBUS_ERROR_AUTH_FAILED,
291                                         CONNMAN_ERROR_INTERFACE ".InvalidArguments");
292
293                         g_dbus_method_invocation_return_gerror(context, error);
294                         g_clear_error(&error);
295                 }
296         } else {
297                 error = g_error_new(G_DBUS_ERROR,
298                                 G_DBUS_ERROR_AUTH_FAILED,
299                                 CONNMAN_ERROR_INTERFACE ".InvalidArguments");
300
301                 g_dbus_method_invocation_return_gerror(context, error);
302                 g_clear_error(&error);
303         }
304
305         if (reply != TRUE) {
306                 ERR("Fail to connect Wi-Fi");
307
308                 __netconfig_agent_clear_fields();
309         }
310         g_variant_iter_free(iter);
311
312         net_connman_agent_complete_set_field(connman_agent, context);
313         return reply;
314 }
315
316 gboolean handle_request_input(NetConnmanAgent *connman_agent,
317                 GDBusMethodInvocation *context, const gchar *service, GVariant *fields)
318 {
319         GVariantIter *iter;
320         gchar *field = NULL;
321         GVariant *r_value = NULL;
322         GVariant *out_table = NULL;
323         gboolean updated = FALSE;
324         GVariantBuilder *builder = NULL;
325
326         g_return_val_if_fail(connman_agent != NULL, FALSE);
327
328         if (NULL == service)
329                 return FALSE;
330
331         DBG("Agent fields requested for service: %s", service);
332
333         builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
334
335         g_variant_get(fields, "a{sv}", &iter);
336         while (g_variant_iter_loop(iter, "{sv}", &field, &r_value)) {
337
338                 if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSPHRASE) == 0 &&
339                                 agent.passphrase != NULL) {
340                         g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_PASSPHRASE,
341                                                         g_variant_new_string(agent.passphrase));
342
343                         updated = TRUE;
344                         DBG("Setting [%s] - []", field);
345                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS) == 0 &&
346                                 (agent.wps_pbc == TRUE || agent.wps_pin != NULL)) {
347                         if (agent.wps_pbc == TRUE) {
348                                 // Sending empty string for WPS push button method
349                                 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_WPS, g_variant_new_string(""));
350
351                                 updated = TRUE;
352                                 DBG("Setting empty string for [%s]", field);
353                         } else if (agent.wps_pin != NULL) {
354                                 g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_WPS, g_variant_new_string(agent.wps_pin));
355
356                                 updated = TRUE;
357                                 DBG("Setting string [%s] - []", field);
358                         }
359                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_NAME) == 0 &&
360                                 agent.name != NULL) {
361                         g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_NAME, g_variant_new_string(agent.name));
362
363                         updated = TRUE;
364                         DBG("Settings [%s] - []", field);
365                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_SSID) == 0 &&
366                                 agent.ssid != NULL) {
367                         int i = 0;
368                         GVariantBuilder *builder1 = NULL;
369                         builder1 = g_variant_builder_new (G_VARIANT_TYPE ("ay"));
370
371                         for (i = 0; i < (agent.ssid->len); i++) {
372                                 g_variant_builder_add (builder1, "y", agent.ssid->data[i]);
373                         }
374
375                         g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_SSID, g_variant_builder_end(builder1));
376                         if (builder1 != NULL)
377                                 g_variant_builder_unref(builder1);
378
379                         updated = TRUE;
380                         DBG("Settings [%s] - []", field);
381                 } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_IDENTITY) == 0 &&
382                                 agent.identity != NULL) {
383                         g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_IDENTITY, g_variant_new_string(agent.identity));
384
385                         updated = TRUE;
386                         DBG("Settings [%s] - []", field);
387                 }
388         }
389
390         out_table = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
391
392         if (builder)
393                 g_variant_builder_unref(builder);
394
395         g_variant_iter_free(iter);
396
397
398         if (NULL == out_table){
399                 net_connman_agent_complete_request_input(connman_agent, context, out_table);
400
401                 return FALSE;
402         }
403
404         if (updated == TRUE)
405                 g_dbus_method_invocation_return_value (context, out_table);
406         else {
407                 GError *error = NULL;
408                 error = g_error_new(G_DBUS_ERROR,
409                                 G_DBUS_ERROR_AUTH_FAILED,
410                                 "net.connman.Agent.Error.Canceled");
411
412                 g_dbus_method_invocation_return_gerror(context, error);
413                 g_clear_error(&error);
414         }
415
416         __netconfig_agent_clear_fields();
417         g_variant_unref(out_table);
418
419         return updated;
420 }
421
422
423 gboolean handle_report_error(NetConnmanAgent *connman_agent,
424                 GDBusMethodInvocation *context, const gchar *service, const gchar *error)
425 {
426         gboolean ret = TRUE;
427
428         g_return_val_if_fail(connman_agent != NULL, FALSE);
429
430         net_connman_agent_complete_report_error(connman_agent, context);
431         DBG("Agent error for service[%s] - [%s]", service, error);
432
433         // Do something when it failed to make a connection
434
435         return ret;
436 }
437
438 #if defined TIZEN_CAPTIVE_PORTAL
439 #if defined TIZEN_WEARABLE
440 #define QUERY_FOR_INTERNET_INTERVAL                     2
441 #define TIMER_THRESHOLD                                         4
442 #else
443 #define QUERY_FOR_INTERNET_INTERVAL                     20
444 #define TIMER_THRESHOLD                                         120
445 #endif
446
447 static gboolean is_monitor_notifier_registered = FALSE;
448
449 #if defined TIZEN_WEARABLE
450 static gboolean is_portal_msg_shown = FALSE;
451 static guint portal_msg_timer = 0;
452 #endif
453
454 struct poll_timer_data {
455         guint time_elapsed;
456         guint timer_id;
457         void* data;
458 };
459
460 static struct poll_timer_data timer_data =
461                         {QUERY_FOR_INTERNET_INTERVAL, 0, NULL};
462
463 static gboolean __check_ignore_portal_list(const char * ssid)
464 {
465         char def_str[1024];
466         int i = 0;
467         int ignore_ap_count = 0;
468
469         if (ssid == NULL)
470                 return FALSE;
471
472         DBG("checking ssid [%s]", ssid);
473
474         DBG("csc string [%s]", def_str);
475         gchar ** ignore_ap_list = g_strsplit(def_str, ",", 0);
476         ignore_ap_count = g_strv_length(ignore_ap_list);
477         for(i = 0; i < ignore_ap_count; i++) {
478                 DBG("[%d] - [%s]", i, ignore_ap_list[i]);
479                 if (strncmp(ignore_ap_list[i], ssid, strlen(ssid)) == 0) {
480                         g_strfreev(ignore_ap_list);
481                         return TRUE;
482                 }
483         }
484
485         g_strfreev(ignore_ap_list);
486         return FALSE;
487 }
488
489 static void __wifi_state_monitor(wifi_service_state_e state,
490                 void *user_data);
491
492 static wifi_state_notifier wifi_state_monitor_notifier = {
493                 .wifi_state_changed = __wifi_state_monitor,
494                 .user_data = NULL,
495 };
496
497 static void __wifi_state_monitor(wifi_service_state_e state,
498                 void *user_data)
499 {
500         DBG("Wi-Fi state: %x", state);
501
502         if (state == NETCONFIG_WIFI_CONNECTED)
503                 return;
504
505         if (is_monitor_notifier_registered == TRUE) {
506                 wifi_state_notifier_unregister(&wifi_state_monitor_notifier);
507                 is_monitor_notifier_registered = FALSE;
508         }
509
510 #if defined TIZEN_WEARABLE
511         is_portal_msg_shown = FALSE;
512 #endif
513
514         /* suspend if Internet check activity in progress */
515         if (timer_data.timer_id == 0)
516                 return;
517
518         netconfig_stop_timer(&timer_data.timer_id);
519         netconfig_stop_internet_check();
520
521         DBG("Stopped Internet accessibility check");
522 }
523
524 static gboolean __netconfig_wifi_portal_login_timeout(gpointer data)
525 {
526         char *service_profile = NULL;
527         GVariant *reply = NULL;
528
529         DBG("");
530
531         struct poll_timer_data *timer = (struct poll_timer_data *)data;
532         if (timer == NULL)
533                 return FALSE;
534
535         if (TRUE == netconfig_get_internet_status()) {
536                 if (is_monitor_notifier_registered == TRUE) {
537                         wifi_state_notifier_unregister(&wifi_state_monitor_notifier);
538                         is_monitor_notifier_registered = FALSE;
539                 }
540
541                 DBG("Portal logged in successfully and update ConnMan state");
542                 return FALSE; /* to stop the timer */
543         } else {
544                 if (timer->time_elapsed >= TIMER_THRESHOLD) {
545                         DBG("Login failed, update ConnMan");
546
547                         if (is_monitor_notifier_registered == TRUE) {
548                                 wifi_state_notifier_unregister(&wifi_state_monitor_notifier);
549                                 is_monitor_notifier_registered = FALSE;
550                         }
551
552                         /* Disconnect and forget the AP */
553                         service_profile = (char*) netconfig_get_default_profile();
554                         if (service_profile && netconfig_is_wifi_profile(service_profile)) {
555                                 /* Now forget the AP*/
556                                 reply = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
557                                                 service_profile, CONNMAN_SERVICE_INTERFACE, "Remove",
558                                                 NULL);
559
560                                 if (reply != NULL)
561                                         g_variant_unref(reply);
562                                 else
563                                         ERR("Failed to forget the AP ");
564                         }
565                 } else {
566                         if (NETCONFIG_WIFI_CONNECTED ==
567                                         wifi_state_get_service_state()) {
568                                 /* check Internet availability by sending and receiving data*/
569                                 netconfig_check_internet_accessibility();
570                                 /* Returning TRUE itself is enough to restart the timer */
571                                 timer->time_elapsed = timer->time_elapsed +
572                                                                         QUERY_FOR_INTERNET_INTERVAL;
573                                 return TRUE;
574                         }
575                 }
576         }
577
578         return FALSE;
579 }
580
581 #if defined TIZEN_WEARABLE
582 static gboolean __netconfig_display_portal_msg(gpointer data)
583 {
584         DBG("");
585         wc_launch_popup(WC_POPUP_TYPE_CAPTIVE_PORTAL);
586
587         netconfig_stop_timer(&portal_msg_timer);
588
589         return FALSE;
590 }
591 #endif
592
593 static void __netconfig_wifi_portal_login_timer_start(struct poll_timer_data
594                 *data)
595 {
596         DBG("__netconfig_wifi_browser_start_timer...starting timer");
597
598         if (data == NULL)
599                 return;
600
601         netconfig_stop_timer(&(data->timer_id));
602
603         /* Timer logic: After successful launch of browser, we would check for
604          * Internet status for every 20s until a threshold of 120s
605          */
606
607         data->time_elapsed = QUERY_FOR_INTERNET_INTERVAL;
608         netconfig_start_timer_seconds(QUERY_FOR_INTERNET_INTERVAL,
609                 __netconfig_wifi_portal_login_timeout, data, &(data->timer_id));
610 }
611 #endif
612
613 gboolean handle_request_browser(NetConnmanAgent *connman_agent,
614                 GDBusMethodInvocation *context, const gchar *service, const gchar *url)
615 {
616 #if defined TIZEN_CAPTIVE_PORTAL
617         gboolean ret = FALSE;
618         gboolean ignore_portal = FALSE;
619         const char * ssid = NULL;
620
621         g_return_val_if_fail(connman_agent != NULL, FALSE);
622
623         DBG("service[%s] - url[%s]", service, url);
624
625         ssid = netconfig_wifi_get_connected_essid(netconfig_get_default_profile());
626         if (ssid == NULL) {
627                 ERR("Connected AP name is NULL!!");
628                 net_connman_agent_complete_request_browser(connman_agent, context);
629                 return FALSE;
630         }
631
632         ignore_portal = __check_ignore_portal_list(ssid);
633
634         if (ignore_portal == TRUE){
635                 net_connman_agent_complete_request_browser(connman_agent, context);
636                 return TRUE;
637         }
638         /* Register for Wifi state change notifier*/
639         if (is_monitor_notifier_registered == FALSE) {
640                 wifi_state_notifier_register(&wifi_state_monitor_notifier);
641                 is_monitor_notifier_registered = TRUE;
642         }
643
644 #if defined TIZEN_WEARABLE
645         if (is_portal_msg_shown){
646                 net_connman_agent_complete_request_browser(connman_agent, context);
647                 return TRUE;
648         }
649
650         is_portal_msg_shown = TRUE;
651         netconfig_start_timer_seconds(4, __netconfig_display_portal_msg, NULL, &portal_msg_timer);
652 #else
653         ret = netconfig_send_notification_to_net_popup(NETCONFIG_ADD_PORTAL_NOTI, ssid);
654 #endif
655
656         timer_data.time_elapsed = 0;
657         __netconfig_wifi_portal_login_timer_start(&timer_data);
658
659         net_connman_agent_complete_request_browser(connman_agent, context);
660         return ret;
661 #else
662         GError *error = NULL;
663         error = g_error_new(G_DBUS_ERROR,
664                         G_DBUS_ERROR_AUTH_FAILED,
665                         CONNMAN_ERROR_INTERFACE ".NotSupported");
666
667         g_dbus_method_invocation_return_gerror(context, error);
668         g_clear_error(&error);
669
670         return FALSE;
671 #endif
672 }