cli: fix a crash adding a slave connection with 'nmcli -a con add'

Valid types: [generic, 802-3-ethernet (ethernet), pppoe, 802-11-wireless (wifi), wimax, gsm, cdma, infiniband, adsl, bluetooth, vpn, 802-11-olpc-mesh (olpc-mesh), vlan, bond, team, bridge, bond-slave, team-slave, bridge-slave]
Connection type: team-slave
Interface name [*]: eth5
Master: nm-team

Program received signal SIGSEGV, Segmentation fault.
0x000000000041ae6d in normalized_master_for_slave (connections=connections@entry=0x7fffec0019a0, master=<optimized out>, master@entry=0x73b470 "nm-team",
    type=type@entry=0x72f7c0 "team", out_type=out_type@entry=0x0) at connections.c:3218
3218					*out_type = con_type;

Fixes: aa12bb353b
This commit is contained in:
Jiří Klimeš 2015-07-15 17:16:11 +02:00
parent 9856ca6058
commit 7b6299d8dd

View file

@ -3201,7 +3201,8 @@ normalized_master_for_slave (const GPtrArray *connections,
if (func) {
/* There was a prefix; only compare to that type. */
if (g_strcmp0 (master, func (connection)) == 0) {
*out_type = con_type;
if (out_type)
*out_type = con_type;
if (func == nm_connection_get_id)
out_master = nm_connection_get_uuid (connection);
else
@ -3215,7 +3216,8 @@ normalized_master_for_slave (const GPtrArray *connections,
if ( g_strcmp0 (master, uuid) == 0
|| g_strcmp0 (master, ifname) == 0) {
out_master = master;
*out_type = con_type;
if (out_type)
*out_type = con_type;
break;
}
if (!found_by_id && g_strcmp0 (master, id) == 0) {