5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 static DBusConnection *connection = NULL;
36 static GHashTable *provider_hash = NULL;
38 static GSList *driver_list = NULL;
40 struct connman_route {
47 struct connman_provider {
49 struct connman_service *vpn_service;
58 struct connman_provider_driver *driver;
60 GHashTable *setting_strings;
63 void __connman_provider_append_properties(struct connman_provider *provider,
64 DBusMessageIter *iter)
66 if (provider->host != NULL)
67 connman_dbus_dict_append_basic(iter, "Host",
68 DBUS_TYPE_STRING, &provider->host);
70 if (provider->domain != NULL)
71 connman_dbus_dict_append_basic(iter, "Domain",
72 DBUS_TYPE_STRING, &provider->domain);
74 if (provider->type != NULL)
75 connman_dbus_dict_append_basic(iter, "Type", DBUS_TYPE_STRING,
79 static int connman_provider_load(struct connman_provider *provider)
87 DBG("provider %p", provider);
89 keyfile = __connman_storage_load_provider(provider->identifier);
93 settings = g_key_file_get_keys(keyfile, provider->identifier, &length,
95 if (settings == NULL) {
96 g_key_file_free(keyfile);
100 while (idx < length) {
102 DBG("found key %s", key);
104 value = g_key_file_get_string(keyfile,
105 provider->identifier,
107 connman_provider_set_string(provider, key, value);
112 g_strfreev(settings);
114 g_key_file_free(keyfile);
118 static int connman_provider_save(struct connman_provider *provider)
122 DBG("provider %p", provider);
124 keyfile = g_key_file_new();
128 g_key_file_set_string(keyfile, provider->identifier,
129 "Name", provider->name);
130 g_key_file_set_string(keyfile, provider->identifier,
131 "Type", provider->type);
132 g_key_file_set_string(keyfile, provider->identifier,
133 "Host", provider->host);
134 g_key_file_set_string(keyfile, provider->identifier,
135 "VPN.Domain", provider->domain);
137 if (provider->driver != NULL && provider->driver->save != NULL)
138 provider->driver->save(provider, keyfile);
140 __connman_storage_save_provider(keyfile, provider->identifier);
141 g_key_file_free(keyfile);
146 static struct connman_provider *connman_provider_lookup(const char *identifier)
148 struct connman_provider *provider = NULL;
150 provider = g_hash_table_lookup(provider_hash, identifier);
155 static gboolean match_driver(struct connman_provider *provider,
156 struct connman_provider_driver *driver)
158 if (g_strcmp0(driver->name, provider->type) == 0)
164 static int provider_probe(struct connman_provider *provider)
168 DBG("provider %p name %s", provider, provider->name);
170 if (provider->driver != NULL)
173 for (list = driver_list; list; list = list->next) {
174 struct connman_provider_driver *driver = list->data;
176 if (match_driver(provider, driver) == FALSE)
179 DBG("driver %p name %s", driver, driver->name);
181 if (driver->probe != NULL && driver->probe(provider) == 0) {
182 provider->driver = driver;
187 if (provider->driver == NULL)
193 static void provider_remove(struct connman_provider *provider)
195 if (provider->driver != NULL) {
196 provider->driver->remove(provider);
197 provider->driver = NULL;
201 static int provider_register(struct connman_provider *provider)
203 connman_provider_load(provider);
204 return provider_probe(provider);
207 static void provider_unregister(struct connman_provider *provider)
209 provider_remove(provider);
212 struct connman_provider *connman_provider_ref(struct connman_provider *provider)
214 DBG("provider %p refcount %d", provider, provider->refcount + 1);
216 g_atomic_int_inc(&provider->refcount);
221 static void provider_destruct(struct connman_provider *provider)
223 DBG("provider %p", provider);
225 g_free(provider->name);
226 g_free(provider->type);
227 g_free(provider->host);
228 g_free(provider->domain);
229 g_free(provider->identifier);
230 g_hash_table_destroy(provider->routes);
231 g_hash_table_destroy(provider->setting_strings);
234 void connman_provider_unref(struct connman_provider *provider)
236 DBG("provider %p refcount %d", provider, provider->refcount - 1);
238 if (g_atomic_int_dec_and_test(&provider->refcount) == FALSE)
241 provider_remove(provider);
243 provider_destruct(provider);
246 static int provider_indicate_state(struct connman_provider *provider,
247 enum connman_service_state state)
249 DBG("state %d", state);
251 __connman_service_ipconfig_indicate_state(provider->vpn_service, state,
252 CONNMAN_IPCONFIG_TYPE_IPV4);
254 return __connman_service_ipconfig_indicate_state(provider->vpn_service,
255 state, CONNMAN_IPCONFIG_TYPE_IPV6);
258 int __connman_provider_disconnect(struct connman_provider *provider)
262 DBG("provider %p", provider);
264 if (provider->driver != NULL && provider->driver->disconnect != NULL)
265 err = provider->driver->disconnect(provider);
269 if (provider->vpn_service != NULL)
270 provider_indicate_state(provider,
271 CONNMAN_SERVICE_STATE_DISCONNECT);
274 if (err != -EINPROGRESS)
283 int __connman_provider_connect(struct connman_provider *provider)
287 DBG("provider %p", provider);
289 if (provider->driver != NULL && provider->driver->connect != NULL)
290 err = provider->driver->connect(provider);
295 if (err != -EINPROGRESS)
298 provider_indicate_state(provider,
299 CONNMAN_SERVICE_STATE_ASSOCIATION);
307 int __connman_provider_remove(const char *path)
309 struct connman_provider *provider;
313 DBG("path %s", path);
315 g_hash_table_iter_init(&iter, provider_hash);
316 while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
317 const char *srv_path;
320 if (provider->vpn_service == NULL)
323 srv_path = __connman_service_get_path(provider->vpn_service);
325 if (g_strcmp0(srv_path, path) == 0) {
326 DBG("Removing VPN %s", provider->identifier);
328 provider_unregister(provider);
329 g_hash_table_remove(provider_hash,
330 provider->identifier);
338 static void provider_append_routes(gpointer key, gpointer value,
341 struct connman_route *route = value;
342 struct connman_provider *provider = user_data;
343 int index = provider->index;
345 if (route->family == AF_INET6) {
346 unsigned char prefix_len = atoi(route->netmask);
348 connman_inet_add_ipv6_network_route(index, route->host,
352 connman_inet_add_network_route(index, route->host,
358 static int set_connected(struct connman_provider *provider,
359 connman_bool_t connected)
361 struct connman_service *service = provider->vpn_service;
362 struct connman_ipconfig *ipconfig;
367 ipconfig = __connman_service_get_ipconfig(service, provider->family);
369 if (connected == TRUE) {
370 if (ipconfig == NULL) {
371 provider_indicate_state(provider,
372 CONNMAN_SERVICE_STATE_FAILURE);
376 __connman_ipconfig_address_add(ipconfig);
377 __connman_ipconfig_gateway_add(ipconfig);
379 provider_indicate_state(provider,
380 CONNMAN_SERVICE_STATE_READY);
382 g_hash_table_foreach(provider->routes, provider_append_routes,
386 if (ipconfig != NULL) {
387 provider_indicate_state(provider,
388 CONNMAN_SERVICE_STATE_DISCONNECT);
389 __connman_ipconfig_gateway_remove(ipconfig);
392 provider_indicate_state(provider,
393 CONNMAN_SERVICE_STATE_IDLE);
399 int connman_provider_set_state(struct connman_provider *provider,
400 enum connman_provider_state state)
402 if (provider == NULL || provider->vpn_service == NULL)
406 case CONNMAN_PROVIDER_STATE_UNKNOWN:
408 case CONNMAN_PROVIDER_STATE_IDLE:
409 return set_connected(provider, FALSE);
410 case CONNMAN_PROVIDER_STATE_CONNECT:
411 return provider_indicate_state(provider,
412 CONNMAN_SERVICE_STATE_ASSOCIATION);
413 case CONNMAN_PROVIDER_STATE_READY:
414 return set_connected(provider, TRUE);
415 case CONNMAN_PROVIDER_STATE_DISCONNECT:
416 return provider_indicate_state(provider,
417 CONNMAN_SERVICE_STATE_DISCONNECT);
418 case CONNMAN_PROVIDER_STATE_FAILURE:
419 return provider_indicate_state(provider,
420 CONNMAN_SERVICE_STATE_FAILURE);
426 int connman_provider_indicate_error(struct connman_provider *provider,
427 enum connman_provider_error error)
429 enum connman_service_error service_error;
434 case CONNMAN_PROVIDER_ERROR_LOGIN_FAILED:
435 service_error = CONNMAN_SERVICE_ERROR_LOGIN_FAILED;
437 case CONNMAN_PROVIDER_ERROR_AUTH_FAILED:
438 service_error = CONNMAN_SERVICE_ERROR_AUTH_FAILED;
440 case CONNMAN_PROVIDER_ERROR_CONNECT_FAILED:
441 service_error = CONNMAN_SERVICE_ERROR_CONNECT_FAILED;
444 service_error = CONNMAN_SERVICE_ERROR_UNKNOWN;
448 ret = __connman_service_indicate_error(provider->vpn_service,
450 path = __connman_service_get_path(provider->vpn_service);
451 __connman_provider_remove(path);
456 static void unregister_provider(gpointer data)
458 struct connman_provider *provider = data;
459 struct connman_service *service = provider->vpn_service;
461 DBG("provider %p", provider);
463 provider->vpn_service = NULL;
464 __connman_service_put(service);
466 connman_provider_unref(provider);
469 static void destroy_route(gpointer user_data)
471 struct connman_route *route = user_data;
474 g_free(route->netmask);
475 g_free(route->gateway);
479 static void provider_initialize(struct connman_provider *provider)
481 DBG("provider %p", provider);
484 provider->name = NULL;
485 provider->type = NULL;
486 provider->domain = NULL;
487 provider->identifier = NULL;
488 provider->routes = g_hash_table_new_full(g_direct_hash, g_direct_equal,
489 NULL, destroy_route);
490 provider->setting_strings = g_hash_table_new_full(g_str_hash, g_str_equal,
494 static struct connman_provider *connman_provider_new(void)
496 struct connman_provider *provider;
498 provider = g_try_new0(struct connman_provider, 1);
499 if (provider == NULL)
502 provider->refcount = 1;
504 DBG("provider %p", provider);
505 provider_initialize(provider);
510 static struct connman_provider *connman_provider_get(const char *identifier)
512 struct connman_provider *provider;
514 provider = g_hash_table_lookup(provider_hash, identifier);
515 if (provider != NULL)
518 provider = connman_provider_new();
519 if (provider == NULL)
522 DBG("provider %p", provider);
524 provider->identifier = g_strdup(identifier);
526 g_hash_table_insert(provider_hash, provider->identifier, provider);
528 provider->name = g_strdup(identifier);
533 static void provider_dbus_ident(char *ident)
535 int i, len = strlen(ident);
537 for (i = 0; i < len; i++) {
538 if (ident[i] >= '0' && ident[i] <= '9')
540 if (ident[i] >= 'a' && ident[i] <= 'z')
542 if (ident[i] >= 'A' && ident[i] <= 'Z')
548 int __connman_provider_create_and_connect(DBusMessage *msg)
550 struct connman_provider *provider;
551 DBusMessageIter iter, array;
552 const char *type = NULL, *name = NULL, *service_path;
553 const char *host = NULL, *domain = NULL;
557 dbus_message_iter_init(msg, &iter);
558 dbus_message_iter_recurse(&iter, &array);
560 while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
561 DBusMessageIter entry, value;
564 dbus_message_iter_recurse(&array, &entry);
565 dbus_message_iter_get_basic(&entry, &key);
567 dbus_message_iter_next(&entry);
568 dbus_message_iter_recurse(&entry, &value);
570 switch (dbus_message_iter_get_arg_type(&value)) {
571 case DBUS_TYPE_STRING:
572 if (g_str_equal(key, "Type") == TRUE)
573 dbus_message_iter_get_basic(&value, &type);
574 else if (g_str_equal(key, "Name") == TRUE)
575 dbus_message_iter_get_basic(&value, &name);
576 else if (g_str_equal(key, "Host") == TRUE)
577 dbus_message_iter_get_basic(&value, &host);
578 else if (g_str_equal(key, "VPN.Domain") == TRUE)
579 dbus_message_iter_get_basic(&value, &domain);
583 dbus_message_iter_next(&array);
586 if (host == NULL || domain == NULL)
589 DBG("Type %s name %s", type, name);
591 if (type == NULL || name == NULL)
594 ident = g_strdup_printf("%s_%s", host, domain);
595 provider_dbus_ident(ident);
597 DBG("ident %s", ident);
599 provider = connman_provider_lookup(ident);
600 if (provider == NULL) {
601 provider = connman_provider_get(ident);
602 if (provider == NULL) {
603 DBG("can not create provider");
608 provider->host = g_strdup(host);
609 provider->domain = g_strdup(domain);
610 g_free(provider->name);
611 provider->name = g_strdup(name);
612 provider->type = g_strdup(type);
614 provider_register(provider);
617 dbus_message_iter_init(msg, &iter);
618 dbus_message_iter_recurse(&iter, &array);
620 while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
621 DBusMessageIter entry, value;
622 const char *key, *str;
624 dbus_message_iter_recurse(&array, &entry);
625 dbus_message_iter_get_basic(&entry, &key);
627 dbus_message_iter_next(&entry);
628 dbus_message_iter_recurse(&entry, &value);
630 switch (dbus_message_iter_get_arg_type(&value)) {
631 case DBUS_TYPE_STRING:
632 dbus_message_iter_get_basic(&value, &str);
633 connman_provider_set_string(provider, key, str);
637 dbus_message_iter_next(&array);
642 if (provider->vpn_service == NULL) {
643 provider->vpn_service =
644 __connman_service_create_from_provider(provider);
645 if (provider->vpn_service == NULL) {
650 err = __connman_service_connect(provider->vpn_service);
651 if (err < 0 && err != -EINPROGRESS)
654 DBG("provider already connected");
656 connman_provider_save(provider);
657 service_path = __connman_service_get_path(provider->vpn_service);
658 g_dbus_send_reply(connection, msg,
659 DBUS_TYPE_OBJECT_PATH, &service_path,
664 __connman_service_put(provider->vpn_service);
665 provider->vpn_service = NULL;
668 DBG("can not connect, delete provider");
670 connman_provider_unref(provider);
675 const char * __connman_provider_get_ident(struct connman_provider *provider)
677 if (provider == NULL)
680 return provider->identifier;
683 int connman_provider_set_string(struct connman_provider *provider,
684 const char *key, const char *value)
686 DBG("provider %p key %s value %s", provider, key, value);
688 if (g_str_equal(key, "Type") == TRUE) {
689 g_free(provider->type);
690 provider->type = g_strdup(value);
691 } else if (g_str_equal(key, "Name") == TRUE) {
692 g_free(provider->name);
693 provider->name = g_strdup(value);
694 } else if (g_str_equal(key, "Host") == TRUE) {
695 g_free(provider->host);
696 provider->host = g_strdup(value);
697 } else if (g_str_equal(key, "VPN.Domain") == TRUE) {
698 g_free(provider->domain);
699 provider->domain = g_strdup(value);
701 g_hash_table_replace(provider->setting_strings,
702 g_strdup(key), g_strdup(value));
706 const char *connman_provider_get_string(struct connman_provider *provider,
709 DBG("provider %p key %s", provider, key);
711 if (g_str_equal(key, "Type") == TRUE)
712 return provider->type;
713 else if (g_str_equal(key, "Name") == TRUE)
714 return provider->name;
715 else if (g_str_equal(key, "Host") == TRUE)
716 return provider->host;
717 else if (g_str_equal(key, "VPN.Domain") == TRUE)
718 return provider->domain;
720 return g_hash_table_lookup(provider->setting_strings, key);
723 void *connman_provider_get_data(struct connman_provider *provider)
725 return provider->driver_data;
728 void connman_provider_set_data(struct connman_provider *provider, void *data)
730 provider->driver_data = data;
733 void connman_provider_set_index(struct connman_provider *provider, int index)
735 struct connman_service *service = provider->vpn_service;
736 struct connman_ipconfig *ipconfig;
743 ipconfig = __connman_service_get_ip4config(service);
745 if (ipconfig == NULL) {
746 __connman_service_create_ip4config(service, index);
748 ipconfig = __connman_service_get_ip4config(service);
749 if (ipconfig == NULL) {
750 DBG("Couldnt create ipconfig");
755 connman_ipconfig_set_method(ipconfig, CONNMAN_IPCONFIG_METHOD_FIXED);
756 __connman_ipconfig_set_index(ipconfig, index);
759 ipconfig = __connman_service_get_ip6config(service);
761 if (ipconfig == NULL) {
762 __connman_service_create_ip6config(service, index);
764 ipconfig = __connman_service_get_ip6config(service);
765 if (ipconfig == NULL) {
766 DBG("Couldnt create ipconfig for IPv6");
771 connman_ipconfig_set_method(ipconfig, CONNMAN_IPCONFIG_METHOD_OFF);
772 __connman_ipconfig_set_index(ipconfig, index);
775 provider->index = index;
778 int connman_provider_get_index(struct connman_provider *provider)
780 return provider->index;
783 int connman_provider_set_ipaddress(struct connman_provider *provider,
784 struct connman_ipaddress *ipaddress)
786 struct connman_ipconfig *ipconfig = NULL;
788 ipconfig = __connman_service_get_ipconfig(provider->vpn_service,
790 if (ipconfig == NULL)
793 provider->family = ipaddress->family;
795 __connman_ipconfig_set_local(ipconfig, ipaddress->local);
796 __connman_ipconfig_set_peer(ipconfig, ipaddress->peer);
797 __connman_ipconfig_set_broadcast(ipconfig, ipaddress->broadcast);
798 __connman_ipconfig_set_gateway(ipconfig, ipaddress->gateway);
799 __connman_ipconfig_set_prefixlen(ipconfig, ipaddress->prefixlen);
804 int connman_provider_set_pac(struct connman_provider *provider, const char *pac)
806 DBG("provider %p pac %s", provider, pac);
808 __connman_service_set_pac(provider->vpn_service, pac);
814 int connman_provider_set_domain(struct connman_provider *provider,
817 DBG("provider %p domain %s", provider, domain);
819 g_free(provider->domain);
820 provider->domain = g_strdup(domain);
822 __connman_service_set_domainname(provider->vpn_service, domain);
827 int connman_provider_set_nameservers(struct connman_provider *provider,
828 const char *nameservers)
831 char **nameservers_array = NULL;
833 DBG("provider %p nameservers %s", provider, nameservers);
835 __connman_service_nameserver_clear(provider->vpn_service);
837 if (nameservers == NULL)
840 nameservers_array = g_strsplit(nameservers, " ", 0);
842 for (i = 0; nameservers_array[i] != NULL; i++) {
843 __connman_service_nameserver_append(provider->vpn_service,
844 nameservers_array[i]);
847 g_strfreev(nameservers_array);
852 enum provider_route_type {
853 PROVIDER_ROUTE_TYPE_NONE = 0,
854 PROVIDER_ROUTE_TYPE_MASK = 1,
855 PROVIDER_ROUTE_TYPE_ADDR = 2,
856 PROVIDER_ROUTE_TYPE_GW = 3,
859 static int route_env_parse(struct connman_provider *provider, const char *key,
860 int *family, unsigned long *idx,
861 enum provider_route_type *type)
866 DBG("name %s", provider->name);
868 if (!strcmp(provider->type, "openvpn")) {
869 if (g_str_has_prefix(key, "route_network_") == TRUE) {
870 start = key + strlen("route_network_");
871 *type = PROVIDER_ROUTE_TYPE_ADDR;
872 } else if (g_str_has_prefix(key, "route_netmask_") == TRUE) {
873 start = key + strlen("route_netmask_");
874 *type = PROVIDER_ROUTE_TYPE_MASK;
875 } else if (g_str_has_prefix(key, "route_gateway_") == TRUE) {
876 start = key + strlen("route_gateway_");
877 *type = PROVIDER_ROUTE_TYPE_GW;
882 *idx = g_ascii_strtoull(start, &end, 10);
884 } else if (!strcmp(provider->type, "openconnect")) {
885 if (g_str_has_prefix(key, "CISCO_SPLIT_INC_") == TRUE) {
887 start = key + strlen("CISCO_SPLIT_INC_");
888 } else if (g_str_has_prefix(key, "CISCO_IPV6_SPLIT_INC_") == TRUE) {
890 start = key + strlen("CISCO_IPV6_SPLIT_INC_");
894 *idx = g_ascii_strtoull(start, &end, 10);
896 if (strncmp(end, "_ADDR", 5) == 0)
897 *type = PROVIDER_ROUTE_TYPE_ADDR;
898 else if (strncmp(end, "_MASK", 5) == 0)
899 *type = PROVIDER_ROUTE_TYPE_MASK;
900 else if (strncmp(end, "_MASKLEN", 8) == 0 &&
901 *family == AF_INET6) {
902 *type = PROVIDER_ROUTE_TYPE_MASK;
910 int connman_provider_append_route(struct connman_provider *provider,
911 const char *key, const char *value)
913 struct connman_route *route;
915 unsigned long idx = 0;
916 enum provider_route_type type = PROVIDER_ROUTE_TYPE_NONE;
918 DBG("key %s value %s", key, value);
920 ret = route_env_parse(provider, key, &family, &idx, &type);
924 DBG("idx %lu family %d type %d", idx, family, type);
926 route = g_hash_table_lookup(provider->routes, GINT_TO_POINTER(idx));
928 route = g_try_new0(struct connman_route, 1);
930 connman_error("out of memory");
934 route->family = family;
936 g_hash_table_replace(provider->routes, GINT_TO_POINTER(idx),
941 case PROVIDER_ROUTE_TYPE_NONE:
943 case PROVIDER_ROUTE_TYPE_MASK:
944 route->netmask = g_strdup(value);
946 case PROVIDER_ROUTE_TYPE_ADDR:
947 route->host = g_strdup(value);
949 case PROVIDER_ROUTE_TYPE_GW:
950 route->gateway = g_strdup(value);
957 const char *connman_provider_get_driver_name(struct connman_provider *provider)
959 if (provider->driver == NULL)
962 return provider->driver->name;
965 static gint compare_priority(gconstpointer a, gconstpointer b)
970 static void clean_provider(gpointer key, gpointer value, gpointer user_data)
972 struct connman_provider *provider = value;
974 if (provider->driver != NULL && provider->driver->remove)
975 provider->driver->remove(provider);
978 int connman_provider_driver_register(struct connman_provider_driver *driver)
980 DBG("driver %p name %s", driver, driver->name);
982 driver_list = g_slist_insert_sorted(driver_list, driver,
987 void connman_provider_driver_unregister(struct connman_provider_driver *driver)
989 DBG("driver %p name %s", driver, driver->name);
991 driver_list = g_slist_remove(driver_list, driver);
994 static void provider_remove_all(gpointer key, gpointer value,
997 struct connman_provider *provider = value;
999 __connman_provider_remove(provider->identifier);
1002 static void provider_offline_mode(connman_bool_t enabled)
1004 DBG("enabled %d", enabled);
1006 if (enabled == TRUE)
1007 g_hash_table_foreach(provider_hash, provider_remove_all, NULL);
1011 static struct connman_notifier provider_notifier = {
1013 .offline_mode = provider_offline_mode,
1016 int __connman_provider_init(void)
1022 connection = connman_dbus_get_connection();
1024 provider_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
1025 NULL, unregister_provider);
1027 err = connman_notifier_register(&provider_notifier);
1029 g_hash_table_destroy(provider_hash);
1030 dbus_connection_unref(connection);
1036 void __connman_provider_cleanup(void)
1040 connman_notifier_unregister(&provider_notifier);
1042 g_hash_table_foreach(provider_hash, clean_provider, NULL);
1044 g_hash_table_destroy(provider_hash);
1045 provider_hash = NULL;
1047 dbus_connection_unref(connection);