libnm: always return VPN connections's banner

It's not libnm's responsibility to hide the banner
depending on the VPN state. libnm should cache and expose
NetworkManager's state, and if the VPN connection has
a banner there, it should be returned.

The previous behavior was since ever in libnm, and in libnm-glib since
the banner was introduced in commit e5b834c1f9.
I think it's wrong if libnm tries too hard putting additional logic
on top of what is on D-Bus.
This commit is contained in:
Thomas Haller 2018-06-07 21:23:38 +02:00
parent 4e7ae3da6e
commit 576cbb771a
3 changed files with 5 additions and 12 deletions

View file

@ -2,7 +2,7 @@ location: clients/tests/test-client.py:945:test_004()/21
cmd: $NMCLI con s con-vpn-1
lang: C
returncode: 0
stdout: 4326 bytes
stdout: 4356 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
@ -90,7 +90,7 @@ GENERAL.MASTER-PATH: --
VPN.TYPE: openvpn
VPN.USERNAME: --
VPN.GATEWAY: --
VPN.BANNER: --
VPN.BANNER: *** VPN connection con-vpn-1 ***
VPN.VPN-STATE: 0 - unknown
VPN.CFG[1]: key1 = val1
VPN.CFG[2]: key2 = val2

View file

@ -2,7 +2,7 @@ location: clients/tests/test-client.py:945:test_004()/22
cmd: $NMCLI con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 4340 bytes
stdout: 4370 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
@ -90,7 +90,7 @@ GENERAL.MASTER-PATH: --
VPN.TYPE: openvpn
VPN.USERNAME: --
VPN.GATEWAY: --
VPN.BANNER: --
VPN.BANNER: *** VPN connection con-vpn-1 ***
VPN.VPN-STATE: 0 - nieznane
VPN.CFG[1]: key1 = val1
VPN.CFG[2]: key2 = val2

View file

@ -71,16 +71,9 @@ static guint signals[LAST_SIGNAL] = { 0 };
const char *
nm_vpn_connection_get_banner (NMVpnConnection *vpn)
{
NMVpnConnectionPrivate *priv;
g_return_val_if_fail (NM_IS_VPN_CONNECTION (vpn), NULL);
priv = NM_VPN_CONNECTION_GET_PRIVATE (vpn);
if (priv->vpn_state != NM_VPN_CONNECTION_STATE_ACTIVATED)
return NULL;
return nm_str_not_empty (priv->banner);
return nm_str_not_empty (NM_VPN_CONNECTION_GET_PRIVATE (vpn)->banner);
}
/**