diff options
| author | Michael Biebl <biebl@debian.org> | 2017-07-12 17:57:30 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-07-12 17:57:30 +0200 |
| commit | b9f0451fa35393ceedf6d9d20b78c43578ebea5d (patch) | |
| tree | 417afcdd717020ad44e25fadee4b89de23316e83 /clients | |
| parent | c333f062ddcba9b35330647bf6cbd0a07f2d786e (diff) | |
New upstream version 1.8.2 upstream/1.8.2
Diffstat (limited to 'clients')
| -rw-r--r-- | clients/cli/common.c | 6 | ||||
| -rw-r--r-- | clients/cli/devices.c | 6 | ||||
| -rw-r--r-- | clients/cli/general.c | 8 | ||||
| -rw-r--r-- | clients/cli/settings.c | 28 | ||||
| -rw-r--r-- | clients/tui/nmt-connect-connection-list.c | 8 |
5 files changed, 33 insertions, 23 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 4d89c3f8..27477166 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -1383,8 +1383,10 @@ read_again: /* If Ctrl-C was detected, complete the line */ if (nmc_seen_sigint ()) { rl_echo_signal_char (SIGINT); - rl_stuff_char ('\n'); - rl_callback_read_char (); + if (!rl_got_line) { + rl_stuff_char ('\n'); + rl_callback_read_char (); + } } /* Add string to the history */ diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 387edef8..50983de6 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -2653,7 +2653,8 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv) return NMC_RESULT_ERROR_USER_INPUT; } ifname = *argv; - complete_device (devices, ifname, TRUE); + if (argc == 1 && nmc->complete) + complete_device (devices, ifname, TRUE); } else if (strcmp (*argv, "bssid") == 0 || strcmp (*argv, "hwaddr") == 0) { /* hwaddr is deprecated and will be removed later */ argc--; @@ -2900,7 +2901,8 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv) goto finish; } ifname = *argv; - complete_device (devices, ifname, TRUE); + if (argc == 1 && nmc->complete) + complete_device (devices, ifname, TRUE); } else if (strcmp (*argv, "bssid") == 0) { argc--; argv++; diff --git a/clients/cli/general.c b/clients/cli/general.c index 12e76efd..68fab6e0 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -1136,10 +1136,10 @@ device_overview (NmCli *nmc, NMDevice *device) else g_string_append_printf (outbuf, "%s, ", _("hw")); - if ( nm_device_get_ip_iface (device) - && g_strcmp0 (nm_device_get_ip_iface (device), nm_device_get_iface (device)) - && g_strcmp0 (nm_device_get_ip_iface (device), "")) - g_string_append_printf (outbuf, "%s %s,", _("iface"), nm_device_get_ip_iface (device)); + if (!NM_IN_STRSET (nm_device_get_ip_iface (device), + NULL, + nm_device_get_iface (device))) + g_string_append_printf (outbuf, "%s %s, ", _("iface"), nm_device_get_ip_iface (device)); if (nm_device_get_physical_port_id (device)) g_string_append_printf (outbuf, "%s %s, ", _("port"), nm_device_get_physical_port_id (device)); diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 87b1f50f..e0f045ac 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -1643,11 +1643,12 @@ nmc_util_is_domain (const char *domain) } static gboolean -nmc_property_set_byte_array (NMSetting *setting, const char *prop, const char *val, GError **error) +nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *val, GError **error) { - char **strv = NULL, **iter; - char *val_strip; + gs_free char *val_strip = NULL; + gs_strfreev char **strv = NULL; const char *delimiters = " \t,"; + char **iter; long int val_int; GBytes *bytes; GByteArray *array = NULL; @@ -1659,30 +1660,33 @@ nmc_property_set_byte_array (NMSetting *setting, const char *prop, const char *v /* First try hex string in the format of AAbbCCDd */ bytes = nm_utils_hexstr2bin (val_strip); - if (bytes) { - array = g_bytes_unref_to_array (bytes); + if (bytes) goto done; - } /* Otherwise, consider the following format: AA b 0xCc D */ strv = nmc_strsplit_set (val_strip, delimiters, 0); array = g_byte_array_sized_new (g_strv_length (strv)); for (iter = strv; iter && *iter; iter++) { + guint8 v8; + if (!nmc_string_to_int_base (g_strstrip (*iter), 16, TRUE, 0, 255, &val_int)) { g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter); + g_byte_array_free (array, TRUE); success = FALSE; goto done; } - g_byte_array_append (array, (const guint8 *) &val_int, 1); + v8 = val_int; + g_byte_array_append (array, &v8, 1); } + bytes = g_byte_array_free_to_bytes (array); done: if (success) - g_object_set (setting, prop, array, NULL); + g_object_set (setting, prop, bytes, NULL); + + if (bytes) + g_bytes_unref (bytes); - g_strfreev (strv); - if (array) - g_byte_array_free (array, TRUE); return success; } @@ -2186,7 +2190,7 @@ DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase2_autheap, _802_1X_val static gboolean nmc_property_802_1X_set_password_raw (NMSetting *setting, const char *prop, const char *val, GError **error) { - return nmc_property_set_byte_array (setting, prop, val, error); + return nmc_property_set_bytes (setting, prop, val, error); } static const char * diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c index edfaa09b..86286129 100644 --- a/clients/tui/nmt-connect-connection-list.c +++ b/clients/tui/nmt-connect-connection-list.c @@ -639,11 +639,13 @@ nmt_connect_connection_list_get_connection (NmtConnectConnectionList *list, if (conn) { if (conn == nmtconn->conn) goto found; - } else if (nmtconn->ssid && !strcmp (identifier, nmtconn->ssid)) + } else if (nm_streq0 (identifier, nmtconn->ssid)) goto found; } - if (!conn && nmtdev->device && !strcmp (identifier, nm_device_get_ip_iface (nmtdev->device))) { + if ( !conn + && nmtdev->device + && nm_streq0 (identifier, nm_device_get_ip_iface (nmtdev->device))) { nmtconn = nmtdev->conns->data; goto found; } @@ -651,7 +653,7 @@ nmt_connect_connection_list_get_connection (NmtConnectConnectionList *list, return FALSE; - found: +found: if (connection) *connection = nmtconn->conn; if (device) |