[libnma/lr/nma-ws: 4/8] all: drop more libnm-glib vestiges



commit 6ff3ef5adbf24256e36a35ac48aee5b86ee16f7e
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Oct 29 15:07:45 2019 +0100

    all: drop more libnm-glib vestiges

 shared/nm-default.h                     |  7 -------
 src/nma-cert-chooser-private.h          |  2 +-
 src/nma-cert-chooser.c                  | 10 +---------
 src/nma-file-cert-chooser.c             |  4 ----
 src/utils/utils.c                       | 11 +----------
 src/utils/utils.h                       |  8 --------
 src/wireless-security/eap-method-peap.c | 13 -------------
 src/wireless-security/eap-method-tls.c  | 20 --------------------
 src/wireless-security/eap-method-ttls.c | 15 ---------------
 src/wireless-security/eap-method.c      |  6 ------
 src/wireless-security/eap-method.h      | 14 --------------
 11 files changed, 3 insertions(+), 107 deletions(-)
---
diff --git a/shared/nm-default.h b/shared/nm-default.h
index bb510210..a9d1a737 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -54,13 +54,6 @@
 
 /*****************************************************************************/
 
-#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
-#define LIBNM_BUILD 1
-#else
-#define LIBNM_BUILD 0
-#endif
-
-
 #if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB) || ((NETWORKMANAGER_COMPILATION) & 
NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
 #include <glib/gi18n-lib.h>
 #else
diff --git a/src/nma-cert-chooser-private.h b/src/nma-cert-chooser-private.h
index dcfc8ccc..c5804a60 100644
--- a/src/nma-cert-chooser-private.h
+++ b/src/nma-cert-chooser-private.h
@@ -136,7 +136,7 @@ struct _NMACertChooserVtable {
 };
 
 extern const NMACertChooserVtable nma_cert_chooser_vtable_file;
-#if LIBNM_BUILD && WITH_GCR
+#if WITH_GCR
 extern const NMACertChooserVtable nma_cert_chooser_vtable_pkcs11;
 #endif
 
diff --git a/src/nma-cert-chooser.c b/src/nma-cert-chooser.c
index 82d0e00b..24ced74e 100644
--- a/src/nma-cert-chooser.c
+++ b/src/nma-cert-chooser.c
@@ -11,10 +11,6 @@
 
 #include "nma-cert-chooser-private.h"
 
-#if !LIBNM_BUILD
-#define NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH "file://"
-#endif
-
 /**
  * SECTION:nma-cert-chooser
  * @title: NMACertChooser
@@ -73,10 +69,8 @@ value_with_scheme_to_uri (const gchar *value, NMSetting8021xCKScheme scheme)
        switch (scheme) {
        case NM_SETTING_802_1X_CK_SCHEME_PATH:
                return g_strdup_printf (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH "%s", value);
-#if LIBNM_BUILD
        case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
                return g_strdup (value);
-#endif
        default:
                g_return_val_if_reached (NULL);
        }
@@ -95,12 +89,10 @@ uri_to_value_with_scheme (const gchar *uri, NMSetting8021xCKScheme *scheme)
                return g_uri_unescape_string (uri + NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH), 
NULL);
        }
 
-#if LIBNM_BUILD
        if (g_str_has_prefix (uri, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11)) {
                NM_SET_OUT (scheme, NM_SETTING_802_1X_CK_SCHEME_PKCS11);
                return g_strdup (uri);
        }
-#endif
 
        g_return_val_if_reached (NULL);
 }
@@ -597,7 +589,7 @@ constructor (GType type, guint n_construct_properties, GObjectConstructParam *co
                        flags |= g_value_get_uint (construct_properties[i].value);
        }
        priv->vtable = &nma_cert_chooser_vtable_file;
-#if LIBNM_BUILD && (GTK_CHECK_VERSION(3,90,0) ? WITH_GCR_GTK4 : WITH_GCR)
+#if GTK_CHECK_VERSION(3,90,0) ? WITH_GCR_GTK4 : WITH_GCR
        if ((flags & NMA_CERT_CHOOSER_FLAG_PEM) == 0)
                priv->vtable = &nma_cert_chooser_vtable_pkcs11;
 #endif
diff --git a/src/nma-file-cert-chooser.c b/src/nma-file-cert-chooser.c
index 8f24c826..4179af6b 100644
--- a/src/nma-file-cert-chooser.c
+++ b/src/nma-file-cert-chooser.c
@@ -11,11 +11,7 @@
 #include "nma-private.h"
 #include "nma-cert-chooser-private.h"
 #include "utils.h"
-#ifdef LIBNM_BUILD
 #include "nma-ui-utils.h"
-#else
-#include "nm-ui-utils.h"
-#endif
 
 #define NMA_FILE_CERT_CHOOSER_GET_PRIVATE(self) (&(_NM_GET_PRIVATE (self, NMACertChooser, 
NMA_IS_CERT_CHOOSER)->_sub.file))
 
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 3a6f07e0..58b380e3 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -54,12 +54,7 @@ utils_ether_addr_valid (const struct ether_addr *test_addr)
 }
 
 char *
-utils_hash_ap (
-#if LIBNM_BUILD
-               GBytes *ssid,
-#else
-               const GByteArray *ssid,
-#endif
+utils_hash_ap (GBytes *ssid,
                NM80211Mode mode,
                guint32 flags,
                guint32 wpa_flags,
@@ -70,11 +65,7 @@ utils_hash_ap (
        memset (&input[0], 0, sizeof (input));
 
        if (ssid) {
-#if LIBNM_BUILD
                memcpy (input, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
-#else
-               memcpy (input, ssid->data, ssid->len);
-#endif
        }
 
        if (mode == NM_802_11_MODE_INFRA)
diff --git a/src/utils/utils.h b/src/utils/utils.h
index d57f3a15..3192ea45 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -13,19 +13,11 @@
 
 gboolean utils_ether_addr_valid (const struct ether_addr *test_addr);
 
-#if LIBNM_BUILD
 char *utils_hash_ap (GBytes *ssid,
                      NM80211Mode mode,
                      guint32 flags,
                      guint32 wpa_flags,
                      guint32 rsn_flags);
-#else
-char *utils_hash_ap (const GByteArray *ssid,
-                     NM80211Mode mode,
-                     guint32 flags,
-                     guint32 wpa_flags,
-                     guint32 rsn_flags);
-#endif
 
 char *utils_escape_notify_message (const char *src);
 
diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c
index 91bdd112..6b263649 100644
--- a/src/wireless-security/eap-method-peap.c
+++ b/src/wireless-security/eap-method-peap.c
@@ -132,9 +132,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        GError *error = NULL;
        gboolean ca_cert_error = FALSE;
        NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_UNKNOWN;
-#if LIBNM_BUILD
        NMSettingSecretFlags secret_flags;
-#endif
 
        s_8021x = nm_connection_get_setting_802_1x (connection);
        g_assert (s_8021x);
@@ -147,16 +145,12 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL);
 
-#if LIBNM_BUILD
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_domain_entry"));
        g_assert (widget);
        text = gtk_editable_get_text (GTK_EDITABLE (widget));
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL);
-#endif
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support this. */
        /* Save CA certificate PIN and its flags to the connection */
        secret_flags = nma_cert_chooser_get_cert_password_flags (NMA_CERT_CHOOSER (method->ca_cert_chooser));
        nm_setting_set_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_CA_CERT_PASSWORD,
@@ -170,7 +164,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
                              nma_cert_chooser_get_cert_password (NMA_CERT_CHOOSER (method->ca_cert_chooser)),
                              NULL);
        }
-#endif
 
        /* TLS CA certificate */
        if (gtk_widget_get_sensitive (method->ca_cert_chooser))
@@ -462,17 +455,11 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_domain_entry"));
-#if LIBNM_BUILD
        if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
                gtk_editable_set_text (GTK_EDITABLE (widget), nm_setting_802_1x_get_domain_suffix_match 
(s_8021x));
        g_signal_connect (G_OBJECT (widget), "changed",
                          (GCallback) wireless_security_changed_cb,
                          ws_parent);
-#else
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_domain_label"));
-       gtk_widget_hide (widget);
-#endif
 
        if (secrets_only) {
                widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, 
"eap_peap_anon_identity_label"));
diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c
index ca754f61..936753a0 100644
--- a/src/wireless-security/eap-method-tls.c
+++ b/src/wireless-security/eap-method-tls.c
@@ -23,11 +23,8 @@
 struct _EAPMethodTLS {
        EAPMethod parent;
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        const char *ca_cert_password_flags_name;
        const char *client_cert_password_flags_name;
-#endif
        const char *client_key_password_flags_name;
 
        gboolean editing_connection;
@@ -117,13 +114,11 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        g_assert (widget);
        g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_editable_get_text (GTK_EDITABLE (widget)), 
NULL);
 
-#if LIBNM_BUILD
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_domain_entry"));
        g_assert (widget);
        g_object_set (s_8021x,
                      parent->phase2 ? NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH : 
NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH,
                      gtk_editable_get_text (GTK_EDITABLE (widget)), NULL);
-#endif
 
        /* TLS private key */
        password = nma_cert_chooser_get_key_password (NMA_CERT_CHOOSER (method->client_cert_chooser));
@@ -142,8 +137,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        }
        g_free (value);
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        /* Save CA certificate PIN and its flags to the connection */
        secret_flags = nma_cert_chooser_get_cert_password_flags (NMA_CERT_CHOOSER (method->ca_cert_chooser));
        nm_setting_set_secret_flags (NM_SETTING (s_8021x), method->ca_cert_password_flags_name,
@@ -170,7 +163,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
                              nma_cert_chooser_get_cert_password (NMA_CERT_CHOOSER 
(method->client_cert_chooser)),
                              NULL);
        }
-#endif
 
        /* Save user private key password flags to the connection */
        secret_flags = nma_cert_chooser_get_key_password_flags (NMA_CERT_CHOOSER 
(method->client_cert_chooser));
@@ -367,15 +359,12 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
                return NULL;
 
        method = (EAPMethodTLS *) parent;
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        method->ca_cert_password_flags_name = phase2
                                              ? NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD
                                              : NM_SETTING_802_1X_CA_CERT_PASSWORD;
        method->client_cert_password_flags_name = phase2
                                                  ? NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD
                                                  : NM_SETTING_802_1X_CLIENT_CERT_PASSWORD;
-#endif
        method->client_key_password_flags_name = phase2
                                                 ? NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD
                                                 : NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD;
@@ -403,7 +392,6 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_domain_entry"));
        g_assert (widget);
-#if LIBNM_BUILD
        g_signal_connect (G_OBJECT (widget), "changed",
                          (GCallback) wireless_security_changed_cb,
                          ws_parent);
@@ -414,11 +402,6 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
                if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
                        gtk_editable_set_text (GTK_EDITABLE (widget), 
nm_setting_802_1x_get_domain_suffix_match (s_8021x));
        }
-#else
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_domain_label"));
-       gtk_widget_hide (widget);
-#endif
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_grid"));
        g_assert (widget);
@@ -501,15 +484,12 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), ca_not_required);
 
        /* Create password-storage popup menus for password entries under their secondary icon */
-#if LIBNM_BUILD
-/* libnm-glib doesn't support these. */
        nma_cert_chooser_setup_cert_password_storage (NMA_CERT_CHOOSER (method->ca_cert_chooser),
                                                      0, (NMSetting *) s_8021x, 
method->ca_cert_password_flags_name,
                                                      FALSE, secrets_only);
        nma_cert_chooser_setup_cert_password_storage (NMA_CERT_CHOOSER (method->client_cert_chooser),
                                                      0, (NMSetting *) s_8021x, 
method->client_cert_password_flags_name,
                                                      FALSE, secrets_only);
-#endif
        nma_cert_chooser_setup_key_password_storage (NMA_CERT_CHOOSER (method->client_cert_chooser),
                                                     0, (NMSetting *) s_8021x, 
method->client_key_password_flags_name,
                                                     FALSE, secrets_only);
diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c
index 5f3fe996..32e8b319 100644
--- a/src/wireless-security/eap-method-ttls.c
+++ b/src/wireless-security/eap-method-ttls.c
@@ -119,9 +119,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
        NMSetting8021x *s_8021x;
        NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
-#if LIBNM_BUILD
        NMSettingSecretFlags secret_flags;
-#endif
        GtkWidget *widget;
        const char *text;
        char *value = NULL;
@@ -143,16 +141,12 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL);
 
-#if LIBNM_BUILD
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_entry"));
        g_assert (widget);
        text = gtk_editable_get_text (GTK_EDITABLE (widget));
        if (text && strlen (text))
                g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL);
-#endif
 
-#if LIBNM_BUILD
-/* libnm-glib doesn't support this. */
        /* Save CA certificate PIN and its flags to the connection */
        secret_flags = nma_cert_chooser_get_cert_password_flags (NMA_CERT_CHOOSER (method->ca_cert_chooser));
        nm_setting_set_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_CA_CERT_PASSWORD,
@@ -166,7 +160,6 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
                              nma_cert_chooser_get_cert_password (NMA_CERT_CHOOSER (method->ca_cert_chooser)),
                              NULL);
        }
-#endif
 
        /* TLS CA certificate */
        if (gtk_widget_get_sensitive (method->ca_cert_chooser))
@@ -494,17 +487,11 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
                          ws_parent);
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_entry"));
-#if LIBNM_BUILD
        if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
                gtk_editable_set_text (GTK_EDITABLE (widget), nm_setting_802_1x_get_domain_suffix_match 
(s_8021x));
        g_signal_connect (G_OBJECT (widget), "changed",
                          (GCallback) wireless_security_changed_cb,
                          ws_parent);
-#else
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_label"));
-       gtk_widget_hide (widget);
-#endif
 
        widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
        inner_auth_combo_changed_cb (widget, (gpointer) method);
@@ -526,11 +513,9 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
                gtk_widget_hide (widget);
        }
 
-#if LIBNM_BUILD
        nma_cert_chooser_setup_cert_password_storage (NMA_CERT_CHOOSER (method->ca_cert_chooser),
                                                      0, (NMSetting *) s_8021x, 
NM_SETTING_802_1X_CA_CERT_PASSWORD,
                                                      FALSE, secrets_only);
-#endif
 
        return method;
 }
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index 8e774e10..b7c1a82e 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -386,15 +386,12 @@ eap_method_setup_cert_chooser (NMACertChooser *cert_chooser,
                case NM_SETTING_802_1X_CK_SCHEME_PATH:
                        value = cert_path_func (s_8021x);
                        break;
-#if LIBNM_BUILD
-/* Not available in libnm-glib */
                case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
                        value = cert_uri_func (s_8021x);
                        password = cert_password_func ? cert_password_func (s_8021x) : NULL;
                        if (password)
                                nma_cert_chooser_set_cert_password (cert_chooser, password);
                        break;
-#endif
                case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN:
                        /* No CA set. */
                        break;
@@ -411,12 +408,9 @@ eap_method_setup_cert_chooser (NMACertChooser *cert_chooser,
                case NM_SETTING_802_1X_CK_SCHEME_PATH:
                        value = key_path_func (s_8021x);
                        break;
-#if LIBNM_BUILD
-/* Not available in libnm-glib */
                case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
                        value = key_uri_func (s_8021x);
                        break;
-#endif
                case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN:
                        /* No certificate set. */
                        break;
diff --git a/src/wireless-security/eap-method.h b/src/wireless-security/eap-method.h
index 24f8ef38..ed9e1ac8 100644
--- a/src/wireless-security/eap-method.h
+++ b/src/wireless-security/eap-method.h
@@ -93,20 +93,6 @@ void eap_method_ca_cert_ignore_load (NMConnection *connection);
 
 GError *eap_method_ca_cert_validate_cb (NMACertChooser *cert_chooser, gpointer user_data);
 
-#if !LIBNM_BUILD
-/* For mere convenience. These are not available in libnm-glib. */
-#define nm_setting_802_1x_get_ca_cert_password             NULL
-#define nm_setting_802_1x_get_ca_cert_uri                  NULL
-#define nm_setting_802_1x_get_client_cert_password         NULL
-#define nm_setting_802_1x_get_client_cert_uri              NULL
-#define nm_setting_802_1x_get_private_key_uri              NULL
-#define nm_setting_802_1x_get_phase2_ca_cert_password      NULL
-#define nm_setting_802_1x_get_phase2_ca_cert_uri           NULL
-#define nm_setting_802_1x_get_phase2_client_cert_password  NULL
-#define nm_setting_802_1x_get_phase2_client_cert_uri       NULL
-#define nm_setting_802_1x_get_phase2_private_key_uri       NULL
-#endif
-
 void eap_method_setup_cert_chooser (NMACertChooser *cert_chooser,
                                     NMSetting8021x *s_8021x,
                                     NMSetting8021xCKScheme (*cert_scheme_func) (NMSetting8021x *setting),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]