]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Add REMOVE_CRED sp_fqdn=<FQDN> command
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 22 Nov 2012 16:04:57 +0000 (18:04 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 24 Nov 2012 10:24:37 +0000 (12:24 +0200)
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 <jouni@qca.qualcomm.com>

wpa_supplicant/ctrl_iface.c

index 85f18e456f5ab76ac1002eae23333a8f25097fbb..bf3152aa998a6ac0627d1488114070b20b520529 100644 (file)
@@ -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: "<cred id>" or "all" */
+       /* cmd: "<cred id>", "all", or "sp_fqdn=<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);