Interworking: Add ctrl_iface events on cred block modifications
[mech_eap.git] / wpa_supplicant / ctrl_iface.c
index 925ece1..4a63f4a 100644 (file)
@@ -2660,6 +2660,8 @@ static int wpa_supplicant_ctrl_iface_add_cred(struct wpa_supplicant *wpa_s,
        if (cred == NULL)
                return -1;
 
+       wpa_msg(wpa_s, MSG_INFO, CRED_ADDED "%d", cred->id);
+
        ret = os_snprintf(buf, buflen, "%d\n", cred->id);
        if (ret < 0 || (size_t) ret >= buflen)
                return -1;
@@ -2672,12 +2674,21 @@ static int wpas_ctrl_remove_cred(struct wpa_supplicant *wpa_s,
 {
        struct wpa_ssid *ssid;
        char str[20];
+       int id;
 
-       if (cred == NULL || wpa_config_remove_cred(wpa_s->conf, cred->id) < 0) {
+       if (cred == NULL) {
                wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find cred");
                return -1;
        }
 
+       id = cred->id;
+       if (wpa_config_remove_cred(wpa_s->conf, id) < 0) {
+               wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find cred");
+               return -1;
+       }
+
+       wpa_msg(wpa_s, MSG_INFO, CRED_REMOVED "%d", id);
+
        /* Remove any network entry created based on the removed credential */
        ssid = wpa_s->conf->ssid;
        while (ssid) {
@@ -2794,6 +2805,8 @@ static int wpa_supplicant_ctrl_iface_set_cred(struct wpa_supplicant *wpa_s,
                return -1;
        }
 
+       wpa_msg(wpa_s, MSG_INFO, CRED_MODIFIED "%d %s", cred->id, name);
+
        return 0;
 }