Add dbus signal for information about server certification
In general, this patch attemps to extend commit
00468b4650
with dbus support.
This can be used by dbus client to implement subject match text
entry with preset value probed from server. This preset value, if
user accepts it, is remembered and passed to subject_match config
for any future authentication.
Signed-off-by: Michael Chang <mchang@novell.com>
This commit is contained in:
parent
a3e685a04b
commit
ade74830b4
11 changed files with 199 additions and 1 deletions
|
@ -653,6 +653,54 @@ nomem:
|
|||
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
|
||||
int depth, const char *subject,
|
||||
const char *cert_hash,
|
||||
const struct wpabuf *cert)
|
||||
{
|
||||
struct wpas_dbus_priv *iface;
|
||||
DBusMessage *msg;
|
||||
DBusMessageIter iter, dict_iter;
|
||||
|
||||
iface = wpa_s->global->dbus;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||
"Certification");
|
||||
if (msg == NULL)
|
||||
return;
|
||||
|
||||
dbus_message_iter_init_append(msg, &iter);
|
||||
if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
|
||||
goto nomem;
|
||||
|
||||
if (!wpa_dbus_dict_append_uint32(&dict_iter, "depth", depth) ||
|
||||
!wpa_dbus_dict_append_string(&dict_iter, "subject", subject))
|
||||
goto nomem;
|
||||
|
||||
if (cert_hash &&
|
||||
!wpa_dbus_dict_append_string(&dict_iter, "cert_hash", cert_hash))
|
||||
goto nomem;
|
||||
|
||||
if (cert &&
|
||||
!wpa_dbus_dict_append_byte_array(&dict_iter, "cert",
|
||||
wpabuf_head(cert),
|
||||
wpabuf_len(cert)))
|
||||
goto nomem;
|
||||
|
||||
if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
||||
goto nomem;
|
||||
|
||||
dbus_connection_send(iface->con, msg, NULL);
|
||||
|
||||
nomem:
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
|
||||
/**
|
||||
|
@ -2647,6 +2695,12 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
|
|||
}
|
||||
},
|
||||
#endif /* CONFIG_P2P */
|
||||
{ "Certification", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||
{
|
||||
{ "certification", "a{sv}", ARG_OUT },
|
||||
END_ARGS
|
||||
}
|
||||
},
|
||||
{ NULL, NULL, { END_ARGS } }
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue