From 1dec3e917be6b7fdb036731a38bc464c7c68d3e2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 5 Aug 2010 15:25:42 -0500 Subject: [PATCH] dhcp: make sure disabled DHCP clients aren't used (gentoo #330319) If the client was disabled with --with-dhclient=no or --with-dhcpcd=no, then it's corresponding _PATH will be an empty string. In that case we want to ignore that client completely since it was disabled at build time. --- src/dhcp-manager/nm-dhcp-manager.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index bde874fb7b..a1e3e5e24d 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -265,8 +265,13 @@ get_client_type (const char *client, GError **error) const char *dhclient_path = NULL; const char *dhcpcd_path = NULL; - dhclient_path = nm_dhcp_dhclient_get_path (DHCLIENT_PATH); - dhcpcd_path = nm_dhcp_dhcpcd_get_path (DHCPCD_PATH); + /* If a client was disabled at build-time, its *_PATH define will be + * an empty string. + */ + if (DHCLIENT_PATH && strlen (DHCLIENT_PATH)) + dhclient_path = nm_dhcp_dhclient_get_path (DHCLIENT_PATH); + if (DHCPCD_PATH && strlen (DHCPCD_PATH)) + dhcpcd_path = nm_dhcp_dhcpcd_get_path (DHCPCD_PATH); if (!client) { if (dhclient_path)