From 0e9bff75220290f7bbf680d0eb1e0ee7209d82aa Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Tue, 24 Apr 2012 17:15:57 +0300 Subject: [PATCH] service: a wps pin of length 0 is valid and leads to pbc method usage --- src/service.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/service.c b/src/service.c index e919b01..2219a01 100644 --- a/src/service.c +++ b/src/service.c @@ -4361,15 +4361,22 @@ int __connman_service_add_passphrase(struct connman_service *service, static int check_wpspin(const char *wpspin) { + int length; guint i; if (wpspin == NULL) return 0; + length = strlen(wpspin); + + /* If 0, it will mean user wants to use PBC method */ + if (length == 0) + return 0; + /* A WPS PIN is always 8 chars length, * its content is in digit representation. */ - if (strlen(wpspin) != 8) + if (length != 8) return -ENOKEY; for (i = 0; i < 8; i++) -- 2.7.4