summaryrefslogtreecommitdiff
blob: be5e58a32b25395fb4986dfecaab4aaa9fee3a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From c050e036c3d748970945195ed0fe6c914c439481 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 05 Aug 2010 20:25:42 +0000
Subject: 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.
---
diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c
index bde874f..a1e3e5e 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)
--
From 91e90d9d5412223e0252ccff0e3732afae201af6 Mon Sep 17 00:00:00 2001
From: Mike Auty <ikelos@gentoo.org>
Date: Thu, 05 Aug 2010 20:25:12 +0000
Subject: build: fix dhcpcd client detection

---
diff --git a/configure.ac b/configure.ac
index 9c260fb..b1d16f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -344,10 +344,10 @@ case "${with_dhcpcd}" in
 		AC_MSG_CHECKING(for dhcpcd)
 		# We fully work with upstream dhcpcd-4
 		for path in /sbin /usr/sbin /usr/pkg/sbin /usr/local/sbin; do
-			test -x "${path}/dhclient" || continue
+			test -x "${path}/dhcpcd" || continue
 			case `"$path/dhcpcd" --version 2>/dev/null` in
 				"dhcpcd "[123]*);;
-				"dhcpcd "*) DHCP_CLIENT_PATH="$path/dhcpcd"; break;;
+				"dhcpcd "*) DHCPCD_PATH="$path/dhcpcd"; break;;
 			esac
 		done
 		if test -n "${DHCPCD_PATH}"; then
@@ -364,7 +364,7 @@ if test -z "$DHCPCD_PATH" -a -z "$DHCLIENT_PATH"; then
 	# in most distros, so use it.
 	AC_MSG_WARN([Could not find a suitable DHCP client])
 	DHCLIENT_PATH=/sbin/dhclient
-	AC_MSG_WARN([Falling back to ISC dhclient, ${DHCP_CLIENT_PATH}])
+	AC_MSG_WARN([Falling back to ISC dhclient, ${DHCLIENT_PATH}])
 fi
 AC_SUBST(DHCLIENT_PATH)
 AC_SUBST(DHCPCD_PATH)
--