[network-manager-openvpn/bg/ciphers-case-bgo774730: 3/3] properties: ignore case when comparing cipher and hmac options



commit 92cfbe0266d9e9816a494b00ba6f4422dcc1d792
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Fri Dec 2 22:35:22 2016 +0100

    properties: ignore case when comparing cipher and hmac options
    
    openvpn accepts both the lower and uppercase of many ciphers and hmac
    algorithms, for example:
    
     AES-128-CBC, aes-128-cbc
     SHA1, sha1
     ...
    
    Other values instead must be in the right case as:
    
     ecdsa-with-SHA1
     whirlpool
    
    Let's use a case-insensitive compare of the values. Note that this
    also matches values as 'AES-128-cbc' or 'Whirlpool' which are not
    accepted by openvpn, but the only alternative would be to hardcode all
    possible values in the plugin, which we don't want to do.

 properties/auth-helpers.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index e8a4562..4d9af9c 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -1068,7 +1068,7 @@ populate_cipher_combo (GtkComboBox *box, const char *user_cipher)
                        gtk_list_store_set (store, &iter,
                                            TLS_CIPHER_COL_NAME, *item,
                                            TLS_CIPHER_COL_DEFAULT, FALSE, -1);
-                       if (!user_added && user_cipher && !strcmp (*item, user_cipher)) {
+                       if (!user_added && user_cipher && !strcasecmp (*item, user_cipher)) {
                                gtk_combo_box_set_active_iter (box, &iter);
                                user_added = TRUE;
                        }
@@ -1153,7 +1153,7 @@ populate_hmacauth_combo (GtkComboBox *box, const char *hmacauth)
                                    HMACAUTH_COL_NAME, name,
                                    HMACAUTH_COL_VALUE, *item,
                                    HMACAUTH_COL_DEFAULT, FALSE, -1);
-               if (hmacauth && !strcmp (*item, hmacauth)) {
+               if (hmacauth && !strcasecmp (*item, hmacauth)) {
                        gtk_combo_box_set_active_iter (box, &iter);
                        active_initialized = TRUE;
                }


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