mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 09:04:55 +00:00
cli: do not restrict VPN type of created connections (rh #1100750)
There may be third-party VPN plugins nmcli is not aware of. We still print a warning if nmcli doesn't know the type. It helps to catch up typos. https://bugzilla.redhat.com/show_bug.cgi?id=1100750
This commit is contained in:
parent
649e4be103
commit
d7216505bb
|
@ -419,7 +419,7 @@ _nmcli_compl_ARGS()
|
|||
;;
|
||||
vpn-type)
|
||||
if [[ "${#words[@]}" -eq 2 ]]; then
|
||||
_nmcli_list "vpnc openvpn pptp openconnect openswan"
|
||||
_nmcli_list "vpnc openvpn pptp openconnect openswan libreswan ssh l2tp iodine"
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
|
|
|
@ -400,7 +400,7 @@ usage_connection_add (void)
|
|||
" [priority <0-63>]\n"
|
||||
" [path-cost <1-65535>]\n"
|
||||
" [hairpin yes|no]\n\n"
|
||||
" vpn: vpn-type vpnc|openvpn|pptp|openconnect|openswan\n"
|
||||
" vpn: vpn-type vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...\n"
|
||||
" [user <username>]\n\n"
|
||||
" olpc-mesh: ssid <SSID>\n"
|
||||
" [channel <1-13>]\n"
|
||||
|
@ -4758,14 +4758,14 @@ cleanup_bridge_slave:
|
|||
} else if (!strcmp (con_type, NM_SETTING_VPN_SETTING_NAME)) {
|
||||
/* Build up the settings required for 'vpn' */
|
||||
gboolean success = FALSE;
|
||||
const char *valid_vpns[] = { "openvpn", "vpnc", "pptp", "openconnect", "openswan", NULL };
|
||||
const char *known_vpns[] = { "openvpn", "vpnc", "pptp", "openconnect", "openswan", "libreswan",
|
||||
"ssh", "l2tp", "iodine", NULL };
|
||||
const char *vpn_type = NULL;
|
||||
char *vpn_type_ask = NULL;
|
||||
const char *user_c = NULL;
|
||||
char *user = NULL;
|
||||
const char *st;
|
||||
char *service_type = NULL;
|
||||
GError *tmp_err = NULL;
|
||||
nmc_arg_t exp_args[] = { {"vpn-type", TRUE, &vpn_type, !ask},
|
||||
{"user", TRUE, &user_c, FALSE},
|
||||
{NULL} };
|
||||
|
@ -4781,19 +4781,17 @@ cleanup_bridge_slave:
|
|||
goto cleanup_vpn;
|
||||
}
|
||||
|
||||
if (!(st = nmc_string_is_valid (vpn_type, known_vpns, NULL))) {
|
||||
printf (_("Warning: 'vpn-type': %s not known.\n"), vpn_type);
|
||||
st = vpn_type;
|
||||
}
|
||||
service_type = g_strdup_printf ("%s.%s", NM_DBUS_INTERFACE, st);
|
||||
|
||||
/* Also ask for all optional arguments if '--ask' is specified. */
|
||||
user = user_c ? g_strdup (user_c) : NULL;
|
||||
if (ask)
|
||||
do_questionnaire_vpn (&user);
|
||||
|
||||
if (!(st = nmc_string_is_valid (vpn_type, valid_vpns, &tmp_err))) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'vpn-type': %s."), tmp_err->message);
|
||||
g_clear_error (&tmp_err);
|
||||
goto cleanup_vpn;
|
||||
}
|
||||
service_type = g_strdup_printf ("%s.%s", NM_DBUS_INTERFACE, st);
|
||||
|
||||
/* Add 'vpn' setting */
|
||||
s_vpn = (NMSettingVPN *) nm_setting_vpn_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_vpn));
|
||||
|
|
|
@ -573,7 +573,7 @@ to be sent back out through the slave the frame was received on (default: yes)
|
|||
.RS
|
||||
.TP
|
||||
.B vpn:
|
||||
.IP "\fIvpn-type vpnc|openvpn|pptp|openconnect|openswan\fP" 42
|
||||
.IP "\fIvpn-type vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...\fP" 42
|
||||
\(en VPN type
|
||||
.IP "\fI[user <username>]\fP" 42
|
||||
\(en VPN username
|
||||
|
|
Loading…
Reference in a new issue