Commit Graph

558 Commits

Author SHA1 Message Date
Beniamino Galvani
108f04e71e cli: completion: escape shell special characters "()&!"
https://bugzilla.gnome.org/show_bug.cgi?id=772629
2016-10-26 13:41:00 +02:00
Thomas Haller
c8a25001f4 build: merge "clients/cli/Makefile.am" into toplevel Makefile 2016-10-21 17:37:56 +02:00
Beniamino Galvani
2a93d44a7a cli: support the autoconnect-retries property 2016-10-16 12:56:09 +02:00
Thomas Haller
a8284c57f9 tui,cli/build: add linker version script for nmcli and nmtui 2016-10-13 21:36:06 +02:00
Thomas Haller
45c0518a5e cli: fix synopsis for hotspot arguments for nmcli device wifi --help 2016-10-12 15:15:19 +02:00
Thomas Haller
29b576bd70 proxy: cleanup handling of proxy-method
The numeric value of NM_SETTING_PROXY_METHOD_NONE should be zero,
as that is the more natural default.

Also, cast all uses of the enum values in g_object_set() to
(int).
2016-10-05 14:46:18 +02:00
Beniamino Galvani
984d4f0684 cli: properly set multiple addresses in questionnaire mode
Pass the '+' modifier to set_property() for IPv4 and IPv6 addresses to
append the new address to existing ones instead of overwriting them.

Fixes: 2f45665559

https://bugzilla.redhat.com/show_bug.cgi?id=1380165
2016-10-04 14:18:27 +02:00
Thomas Haller
132234bb79 cli: support qualifying proxy.pac-script with "file://" or "js://" 2016-10-04 11:44:44 +02:00
Atul Anand
20098591d9 proxy: change semantics of pac-script
libnm-core: pac-script property in NMSettingProxy now represents the
script itself not the location. It ensures that the connection is
self contained.

nmcli: Supports loading of PAC Script via file path or written explicitly.
2016-10-04 11:44:44 +02:00
Atul Anand
812b8774f6 proxy: remove unnecessary APIs
Unnecessary APIs have been removed from nm-setting-proxy, client like
nm-connection-editor are expected to create a PAC script snippet the load
the location of file in NM.
2016-10-04 11:44:44 +02:00
Atul Anand
2cb75e08d6 nmcli: Add Proxy support to nmcli
nmcli fixed to allow users edit proxy properties.
2016-10-04 11:44:44 +02:00
Thomas Haller
1b8c201cce cli: reject team.config from files with '\0'
The team-config must be valid utf-8. First of all, JSON
is also defined for other unicode encodings, but libjansson
can only handle utf-8. So, just require that.

A file with a '\0' truncates part of the file and is thus
invalid.
2016-09-27 11:24:47 +02:00
Thomas Haller
c1a4c084b0 cli: support explicitly selecting team-config as file or json data
nmcli has a heuristic when setting the team-config to accepting both
a filename or the plain json text.

Add support for two schemes "file://" and "json://" to explicitly
determine whether to read from file or from json.

Also, no longer silently ignore an all-whitespace word. That is an
error (unless you have a file named " ").

Also, no longer replace newlines with space. Don't mangle the input
text at all.
2016-09-27 10:59:47 +02:00
Beniamino Galvani
995229181c cli: remove editor thread
Currently the editor runs in a dedicated thread so that the blocking
call to readline() doesn't stop the processing of D-Bus events in the
main loop. The editor thread can access objects concurrently with the
main thread and this can cause races and crashes.

Remove the editor thread and use the non-blocking readline API.

https://bugzilla.gnome.org/show_bug.cgi?id=732097
https://bugzilla.redhat.com/show_bug.cgi?id=1368353
2016-09-23 09:46:28 +02:00
Beniamino Galvani
a2dac38174 cli: clear source when progress callback terminates 2016-09-23 09:46:28 +02:00
Beniamino Galvani
3ea5efd008 cli: fix wrong memory allocation size
Fixes: 8d9718bd0f
2016-09-23 09:46:28 +02:00
Jiří Klimeš
52723bd743 cli: fix yes/no completion in questionnaire mode 2016-09-19 16:58:18 +02:00
Jiří Klimeš
08a74c272b cli: tab-complete "Interface name [*]" in questionnaire mode 2016-09-19 16:58:18 +02:00
Jiří Klimeš
c2ef397867 cli: enable bash completion for some more properties of add/modify
connection.interface-name
mavclan.tap
mavclan.parent
ip-tunnel.parent
vxlan.parent
2016-09-19 16:58:18 +02:00
Jiří Klimeš
61a56aa3db cli: fix completion/add missing functions for '--complete-args' (rh #1375933)
This makes bash completion work again for 'nmcli connection add'.

Fixes: 8b39090597

https://bugzilla.redhat.com/show_bug.cgi?id=1375933
2016-09-19 16:55:40 +02:00
Jiří Klimeš
1f0ba2e487 cli: (trivial) move gen_func_ifnames() from devices.c to common.c
and rename it to nmc_rl_gen_func()
2016-09-19 16:55:39 +02:00
Jiří Klimeš
4b90b7b774 cli: (trivial): remove stray %s 2016-09-19 16:55:37 +02:00
Beniamino Galvani
a80af27fc9 clients: don't show "(null)" prompt for secrets
If the caller doesn't provide a message, simply don't show it.
2016-09-14 23:32:52 +02:00
Beniamino Galvani
b28b2ba8a9 clients: add define for NMSecretAgentSimple signal name 2016-09-14 23:32:52 +02:00
Beniamino Galvani
79a357b07a cli: connections: fail the activation if the ac deactivates
Since commit ac888de151 ("cli/connections: fail the activation when
the active connection disappears") we rely only on the disappearing of
the active-connection to determine the failure of an activation.

libnm can collapse a 'added' and a 'removed' signal if they are
received closer enough and thus we may miss the removal of the active
connection. Restore the detection of failure based on
active-connection state.
2016-09-09 16:40:53 +02:00
Lubomir Rintel
afab2b8112 cli: only connect handlers for property changes in interactive edit
Fixes: c5324ed285
(cherry picked from commit 79c81bbb8c)
2016-08-24 17:27:55 +02:00
Lubomir Rintel
2f45665559 cli: default to method=manual when adding an address
This restores accidentally changed behavior for
"nmcli c add ... ip[46] <address>"

Fixes: c5324ed285
(cherry picked from commit 195ad4ec97)
2016-08-24 17:27:55 +02:00
Beniamino Galvani
e9f96024ae cli: return sane error message for D-Bus policy permission errors
The error returned to users when a load_connection(s)/set_logging call
fails due to D-Bus policy denial is a bit obscure:

  $ nmcli general logging level debug
  Error: failed to set logging: Rejected send message, 4 matched rules;
  type="method_call", sender=":1.233" (uid=1001 pid=27225 comm="nmcli
  general logging level debug ")
  interface="org.freedesktop.NetworkManager" member="SetLogging" error
  name="(unset)" requested_reply="0" destination=":1.207" (uid=0
  pid=25793 comm="/usr/sbin/NetworkManager --no-daemon ")

Convert it to a more comprehensible:

  $ nmcli general logging level debug
  Error: failed to set logging: access denied

https://bugzilla.redhat.com/show_bug.cgi?id=1362542
(cherry picked from commit 805925f9ef)
2016-08-20 10:45:55 +02:00
Thomas Haller
0bdcab100c all: cleanup includes in header files
- don't include "nm-default.h" in header files. Every source file must
  include as first header "nm-default.h", thus our headers get the
  default include already implicitly.

- we don't support compiling NetworkManager itself with a C++ compiler. Remove
  G_BEGIN_DECLS/G_END_DECLS from internal headers. We do however support
  users of libnm to use C++, thus they stay in public headers.

(cherry picked from commit f19aff8909)
2016-08-17 19:51:17 +02:00
Alfonso Sanchez-Beato
6fb0de0a8b auth: check when setting statistics refresh rate 2016-08-17 16:08:20 +02:00
Thomas Haller
2cb18efaea permissions: properly add checkpoint-rollback permission
Fixes: a52d4654ec
2016-08-17 15:50:20 +02:00
Jiří Klimeš
c9f6309910 cli: show pre-filled readline input if it is not a real password (rh #1351272)
Example:
$ nmcli -a con up test-conn
Passwords or encryption keys are required to access the wireless network 'kkk'.
Username (802-1x.identity): cimrman
Password (802-1x.password):

https://bugzilla.redhat.com/show_bug.cgi?id=1351272
2016-08-17 15:32:58 +02:00
Beniamino Galvani
482e506674 cli: fix error reporting for connection delete
get_connection() shifts to the next argument, so we need to cache the
old one.

Fixes: 717db4fe01
2016-08-02 17:21:12 +02:00
Beniamino Galvani
ec6a118f29 cli: fix connection delete/monitor
The two commands should apply to all available connections matching
the given name.

Fixes: 717db4fe01
2016-08-02 16:49:37 +02:00
Francesco Giudici
2adb5fc00f nmcli: fix connection clone/modify
remove extra "next_arg"s (get_connection already shifts argv).

Fixes: 717db4fe01
2016-08-02 15:44:47 +02:00
Lubomir Rintel
8cc6ce7e44 cli: add -f argument completion 2016-08-01 15:51:29 +02:00
Lubomir Rintel
2e5f8d7de6 cli: complete global flags 2016-08-01 15:51:29 +02:00
Lubomir Rintel
e996dfbb26 cli: make global flags parsing saner
Keep argv pointed at the current argument not the previous one.
2016-08-01 15:51:29 +02:00
Lubomir Rintel
81e8575a46 cli: don't call the nmc_do_cmds() default handler if we're at the end of command completion 2016-08-01 13:52:36 +02:00
Lubomir Rintel
8e7c94ed07 cli/connections: there's nothing to complete for reload 2016-08-01 13:52:36 +02:00
Lubomir Rintel
9e8a227813 cli/connections: add completion to show subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
a410e40655 cli/connections: add completion to down subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
af5c235f14 cli/connections: add completion to import subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
345291d6f1 cli/connections: add completion to load subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
680b53c96a cli/connections: add completion to up subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
c561fa34d2 cli/connections: add completion to export subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
075e705bc7 cli/connections: add completion to monitor subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
9d076a7a1a cli/connections: add completion to delete subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
18352340b6 cli/connections: add completion to clone subcommand 2016-08-01 13:52:36 +02:00
Lubomir Rintel
2895261c91 cli/connections: do connection completion in get_connection()
Start completing by the id if the filter type is not specified
2016-08-01 13:52:36 +02:00