summaryrefslogtreecommitdiff
path: root/src/libwpactrl
diff options
context:
space:
mode:
Diffstat (limited to 'src/libwpactrl')
-rw-r--r--src/libwpactrl/wpactrl_associate.c3
-rw-r--r--src/libwpactrl/wpactrl_networks_parse.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/libwpactrl/wpactrl_associate.c b/src/libwpactrl/wpactrl_associate.c
index 59900d6..0f1bd2e 100644
--- a/src/libwpactrl/wpactrl_associate.c
+++ b/src/libwpactrl/wpactrl_associate.c
@@ -14,9 +14,10 @@ int wpactrl_associate (wpactrl_t *a, char const *ssid, char const *psk, tain_t *
if (!wpactrl_addnetwork(a, &id, stamp)) goto err ;
}
+ if (wpactrl_setnetworkoption(a, id, "ssid", ssid, stamp) != WPA_OK) goto err ;
if (psk)
{
- if (wpactrl_setnetworkoption(a, id, "key_mgmt", "WPA-PSK WPA-PSK-SHA256", stamp) != WPA_OK
+ if (wpactrl_setnetworkoption(a, id, "key_mgmt", "WPA-PSK", stamp) != WPA_OK
|| wpactrl_setnetworkoption(a, id, "mem_only_psk", "1", stamp) != WPA_OK
|| wpactrl_setnetworkoption(a, id, "psk", psk, stamp) != WPA_OK) goto err ;
}
diff --git a/src/libwpactrl/wpactrl_networks_parse.c b/src/libwpactrl/wpactrl_networks_parse.c
index 1f7f0e9..79306a2 100644
--- a/src/libwpactrl/wpactrl_networks_parse.c
+++ b/src/libwpactrl/wpactrl_networks_parse.c
@@ -3,12 +3,14 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
+
#include <skalibs/uint32.h>
#include <skalibs/bytestr.h>
#include <skalibs/error.h>
#include <skalibs/fmtscan.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
+
#include <bcnm/wpactrl.h>
static int wpactrl_networks_parse_one (char const *s, size_t len, wpactrl_networks_t *thing, stralloc *sa)
@@ -27,10 +29,10 @@ static int wpactrl_networks_parse_one (char const *s, size_t len, wpactrl_networ
len = pos ;
pos = byte_rchr(s, len - 1, '\t') ;
- if (!pos || pos >= len - 1) goto eproto ;
+ if (pos >= len - 1) goto eproto ;
if (wpactrl_bssid_scan(s + pos + 1, sr.bssid) != len - pos - 1) goto eproto ;
len = pos ;
-
+ if (!len) len = 1 ;
sr.ssid_start = sa->len ;
sr.ssid_len = len - 1 ;
if (!stralloc_catb(sa, s, len - 1) || !stralloc_0(sa)) return 0 ;