From: Tomasz Bursztyka Date: Wed, 25 Apr 2012 11:22:14 +0000 (+0300) Subject: service: Fixing which wpspin we set according to PBC method or not X-Git-Tag: 0.83~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9effb3d1ec0b151553a17bdb9a0403bbdac8763;p=platform%2Fupstream%2Fconnman.git service: Fixing which wpspin we set according to PBC method or not For PBC method, the WiFi.PinWPS has to be NULL. Fixes BMC#25076 --- diff --git a/src/service.c b/src/service.c index 8814754..ac695c4 100644 --- a/src/service.c +++ b/src/service.c @@ -4359,7 +4359,7 @@ int __connman_service_add_passphrase(struct connman_service *service, return err; } -static int check_wpspin(const char *wpspin) +static int check_wpspin(struct connman_service *service, const char *wpspin) { int length; guint i; @@ -4370,8 +4370,11 @@ static int check_wpspin(const char *wpspin) length = strlen(wpspin); /* If 0, it will mean user wants to use PBC method */ - if (length == 0) + if (length == 0) { + connman_network_set_string(service->network, + "WiFi.PinWPS", NULL); return 0; + } /* A WPS PIN is always 8 chars length, * its content is in digit representation. @@ -4383,6 +4386,8 @@ static int check_wpspin(const char *wpspin) if (!isdigit((unsigned char) wpspin[i])) return -ENOKEY; + connman_network_set_string(service->network, "WiFi.PinWPS", wpspin); + return 0; } @@ -4412,13 +4417,12 @@ static void request_input_cb (struct connman_service *service, return; } - err = check_wpspin(wpspin); - if (err < 0) - goto done; - if (service->network != NULL) { + if (wps == TRUE && service->network != NULL) { + err = check_wpspin(service, wpspin); + if (err < 0) + goto done; + connman_network_set_bool(service->network, "WiFi.UseWPS", wps); - connman_network_set_string(service->network, "WiFi.PinWPS", - wpspin); } if (identity != NULL)