[network-manager-pptp/jk/libnm-port: 1/4] service: fix a nonsense condition



commit ff4914ba7808b9fc9beb6f679d524d22f98dd495
Author: Jiří Klimeš <jklimes redhat com>
Date:   Tue May 19 10:56:53 2015 +0200

    service: fix a nonsense condition

 src/nm-pptp-service.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index aadec4a..9a1da0e 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -244,22 +244,13 @@ _service_cache_credentials (NMPptpPppService *self,
 
        /* Username; try PPTP specific username first, then generic username */
        username = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_USER);
-       if (username && strlen (username)) {
-               /* FIXME: This check makes about 0 sense. */
-               if (!username || !strlen (username)) {
-                       g_set_error_literal (error,
-                                            NM_VPN_PLUGIN_ERROR,
-                                            NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
-                                           _("Invalid VPN username."));
-                       return FALSE;
-               }
-       } else {
+       if (!username || !*username) {
                username = nm_setting_vpn_get_user_name (s_vpn);
-               if (!username || !strlen (username)) {
+               if (!username || !*username) {
                        g_set_error_literal (error,
                                             NM_VPN_PLUGIN_ERROR,
                                             NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
-                                            _("Missing VPN username."));
+                                            _("Missing or invalid VPN username."));
                        return FALSE;
                }
        }


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