From 9afe52eb92d7494da5fea44c8e39080683e1ff79 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 22 Nov 2012 18:04:57 +0200 Subject: [PATCH] HS 2.0: Add REMOVE_CRED sp_fqdn= command This allows credential entries to be removed based on SP FQDN without having to iterate through the configured entries from an external program to figure out which credentials should be removed for a specific SP. Signed-hostap: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 85f18e456..bf3152aa9 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2340,7 +2340,7 @@ static int wpa_supplicant_ctrl_iface_remove_cred(struct wpa_supplicant *wpa_s, int id; struct wpa_cred *cred, *prev; - /* cmd: "" or "all" */ + /* cmd: "", "all", or "sp_fqdn=" */ if (os_strcmp(cmd, "all") == 0) { wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED all"); cred = wpa_s->conf->cred; @@ -2352,6 +2352,20 @@ static int wpa_supplicant_ctrl_iface_remove_cred(struct wpa_supplicant *wpa_s, return 0; } + if (os_strncmp(cmd, "sp_fqdn=", 8) == 0) { + wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED SP FQDN '%s'", + cmd + 8); + cred = wpa_s->conf->cred; + while (cred) { + prev = cred; + cred = cred->next; + if (prev->domain && + os_strcmp(prev->domain, cmd + 8) == 0) + wpas_ctrl_remove_cred(wpa_s, prev); + } + return 0; + } + id = atoi(cmd); wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED id=%d", id);