Add setSmartcardModules DBus message to set pkcs11 and opensc options
This will be used by most importantly network manager to set smartcard options at run time.
This commit is contained in:
parent
a6a89fea36
commit
e403be0b12
3 changed files with 76 additions and 0 deletions
|
@ -534,6 +534,9 @@ static DBusHandlerResult wpas_iface_message_handler(DBusConnection *connection,
|
||||||
reply = wpas_dbus_iface_disconnect(message, wpa_s);
|
reply = wpas_dbus_iface_disconnect(message, wpa_s);
|
||||||
else if (!strcmp(method, "setAPScan"))
|
else if (!strcmp(method, "setAPScan"))
|
||||||
reply = wpas_dbus_iface_set_ap_scan(message, wpa_s);
|
reply = wpas_dbus_iface_set_ap_scan(message, wpa_s);
|
||||||
|
else if (!strcmp(method, "setSmartcardModules"))
|
||||||
|
reply = wpas_dbus_iface_set_smartcard_modules(message,
|
||||||
|
wpa_s);
|
||||||
else if (!strcmp(method, "state"))
|
else if (!strcmp(method, "state"))
|
||||||
reply = wpas_dbus_iface_get_state(message, wpa_s);
|
reply = wpas_dbus_iface_get_state(message, wpa_s);
|
||||||
else if (!strcmp(method, "setBlobs"))
|
else if (!strcmp(method, "setBlobs"))
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "eap_peer/eap_methods.h"
|
#include "eap_peer/eap_methods.h"
|
||||||
#include "dbus_dict_helpers.h"
|
#include "dbus_dict_helpers.h"
|
||||||
#include "ieee802_11_defs.h"
|
#include "ieee802_11_defs.h"
|
||||||
|
#include "wpas_glue.h"
|
||||||
|
#include "eapol_supp/eapol_supp_sm.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1178,6 +1180,74 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpas_dbus_iface_set_smartcard_modules - Set smartcard related module paths
|
||||||
|
* @message: Pointer to incoming dbus message
|
||||||
|
* @wpa_s: wpa_supplicant structure for a network interface
|
||||||
|
* Returns: A dbus message containing a UINT32 indicating success (1) or
|
||||||
|
* failure (0)
|
||||||
|
*
|
||||||
|
* Handler function for "setSmartcardModules" method call.
|
||||||
|
*/
|
||||||
|
DBusMessage * wpas_dbus_iface_set_smartcard_modules(
|
||||||
|
DBusMessage *message, struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
DBusMessageIter iter, iter_dict;
|
||||||
|
char *opensc_engine_path = NULL;
|
||||||
|
char *pkcs11_engine_path = NULL;
|
||||||
|
char *pkcs11_module_path = NULL;
|
||||||
|
struct wpa_dbus_dict_entry entry;
|
||||||
|
|
||||||
|
if (!dbus_message_iter_init(message, &iter))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (!wpa_dbus_dict_open_read(&iter, &iter_dict))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
|
||||||
|
if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
|
||||||
|
goto error;
|
||||||
|
if (!strcmp(entry.key, "opensc_engine_path") &&
|
||||||
|
(entry.type == DBUS_TYPE_STRING)) {
|
||||||
|
opensc_engine_path = os_strdup(entry.str_value);
|
||||||
|
if (opensc_engine_path == NULL)
|
||||||
|
goto error;
|
||||||
|
} else if (!strcmp(entry.key, "pkcs11_engine_path") &&
|
||||||
|
(entry.type == DBUS_TYPE_STRING)) {
|
||||||
|
pkcs11_engine_path = os_strdup(entry.str_value);
|
||||||
|
if (pkcs11_engine_path == NULL)
|
||||||
|
goto error;
|
||||||
|
} else if (!strcmp(entry.key, "pkcs11_module_path") &&
|
||||||
|
(entry.type == DBUS_TYPE_STRING)) {
|
||||||
|
pkcs11_module_path = os_strdup(entry.str_value);
|
||||||
|
if (pkcs11_module_path == NULL)
|
||||||
|
goto error;
|
||||||
|
} else {
|
||||||
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
os_free(wpa_s->conf->opensc_engine_path);
|
||||||
|
wpa_s->conf->opensc_engine_path = opensc_engine_path;
|
||||||
|
os_free(wpa_s->conf->pkcs11_engine_path);
|
||||||
|
wpa_s->conf->pkcs11_engine_path = pkcs11_engine_path;
|
||||||
|
os_free(wpa_s->conf->pkcs11_module_path);
|
||||||
|
wpa_s->conf->pkcs11_module_path = pkcs11_module_path;
|
||||||
|
|
||||||
|
eapol_sm_deinit(wpa_s->eapol);
|
||||||
|
wpa_supplicant_init_eapol(wpa_s);
|
||||||
|
|
||||||
|
return wpas_dbus_new_success_reply(message);
|
||||||
|
|
||||||
|
error:
|
||||||
|
os_free(opensc_engine_path);
|
||||||
|
os_free(pkcs11_engine_path);
|
||||||
|
os_free(pkcs11_module_path);
|
||||||
|
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_iface_get_state - Get interface state
|
* wpas_dbus_iface_get_state - Get interface state
|
||||||
* @message: Pointer to incoming dbus message
|
* @message: Pointer to incoming dbus message
|
||||||
|
|
|
@ -68,6 +68,9 @@ DBusMessage * wpas_dbus_iface_disconnect(DBusMessage *message,
|
||||||
DBusMessage * wpas_dbus_iface_set_ap_scan(DBusMessage *message,
|
DBusMessage * wpas_dbus_iface_set_ap_scan(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s);
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_iface_set_smartcard_modules(
|
||||||
|
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
|
DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s);
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue