mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 07:40:34 +01:00
libnm/802-1x: reuse verify_identity() in verify_ttls() implementation
This commit is contained in:
parent
d5ee67981c
commit
a3aec9dc5c
1 changed files with 28 additions and 44 deletions
|
|
@ -2614,6 +2614,33 @@ need_secrets_tls(NMSetting8021x *self, GPtrArray *secrets, gboolean phase2)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_identity(NMSetting8021x *self, gboolean phase2, GError **error)
|
||||
{
|
||||
NMSetting8021xPrivate *priv = NM_SETTING_802_1X_GET_PRIVATE(self);
|
||||
|
||||
if (nm_str_is_empty(priv->identity)) {
|
||||
if (!priv->identity) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("property is missing"));
|
||||
} else {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("property is empty"));
|
||||
}
|
||||
g_prefix_error(error,
|
||||
"%s.%s: ",
|
||||
NM_SETTING_802_1X_SETTING_NAME,
|
||||
NM_SETTING_802_1X_IDENTITY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_tls(NMSetting8021x *self, gboolean phase2, GError **error)
|
||||
{
|
||||
|
|
@ -2689,24 +2716,8 @@ verify_ttls(NMSetting8021x *self, gboolean phase2, GError **error)
|
|||
{
|
||||
NMSetting8021xPrivate *priv = NM_SETTING_802_1X_GET_PRIVATE(self);
|
||||
|
||||
if (nm_str_is_empty(priv->identity)) {
|
||||
if (!priv->identity) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("property is missing"));
|
||||
} else {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("property is empty"));
|
||||
}
|
||||
g_prefix_error(error,
|
||||
"%s.%s: ",
|
||||
NM_SETTING_802_1X_SETTING_NAME,
|
||||
NM_SETTING_802_1X_IDENTITY);
|
||||
if (!verify_identity(self, phase2, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((!priv->phase2_auth && !priv->phase2_autheap)
|
||||
|| (priv->phase2_auth && priv->phase2_autheap)) {
|
||||
|
|
@ -2726,33 +2737,6 @@ verify_ttls(NMSetting8021x *self, gboolean phase2, GError **error)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_identity(NMSetting8021x *self, gboolean phase2, GError **error)
|
||||
{
|
||||
NMSetting8021xPrivate *priv = NM_SETTING_802_1X_GET_PRIVATE(self);
|
||||
|
||||
if (nm_str_is_empty(priv->identity)) {
|
||||
if (!priv->identity) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("property is missing"));
|
||||
} else {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("property is empty"));
|
||||
}
|
||||
g_prefix_error(error,
|
||||
"%s.%s: ",
|
||||
NM_SETTING_802_1X_SETTING_NAME,
|
||||
NM_SETTING_802_1X_IDENTITY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
need_secrets_phase2(NMSetting8021x *self, GPtrArray *secrets, gboolean phase2)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue