[network-manager-libreswan/lr/import-export: 4/7] common: never write "(null)" for user name



commit 7cfb2d2f2113a73f773be11371bcd88dbc542c8c
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Dec 7 13:44:25 2015 +0100

    common: never write "(null)" for user name
    
    Just skip the option if it's missing; it's probably going to fail anyway, but
    in a nicer way.

 common/utils.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/common/utils.c b/common/utils.c
index f1431e8..7493f3a 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -66,11 +66,10 @@ nm_libreswan_config_write (gint fd,
 
        default_username = nm_setting_vpn_get_user_name (s_vpn);
        props_username = nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_LEFTXAUTHUSER);
-       if (   default_username && strlen (default_username)
-               && (!props_username || !strlen (props_username)))
-               write_config_option (fd, " leftxauthusername=%s\n", default_username);
-       else
+       if (props_username && strlen (props_username))
                write_config_option (fd, " leftxauthusername=%s\n", props_username);
+       else if (default_username && strlen (default_username))
+               write_config_option (fd, " leftxauthusername=%s\n", default_username);
 
        write_config_option (fd, " right=%s\n", nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_RIGHT));
        write_config_option (fd, " remote_peer_type=cisco\n");


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