View | Details | Raw Unified | Return to bug 136890
Collapse All | Expand All

(-)isc-dhcpd.in (+20 lines)
Lines 700-705 Link Here
700
	fi
700
	fi
701
}
701
}
702
702
703
dhcpd_checkconfig ()
704
{
705
        local rc_flags_saved rc_flags_our
706
        rc_flags_saved="$rc_flags"
707
        setup_flags
708
        # Eliminate '-q' flag if it is present
709
        rc_flags_our=`echo "${rc_flags}" | sed -Ee's/(^-q | -q | -q$)'//`
710
        rc_flags="${rc_flags_saved}"
711
        if ${command} -t -q ${rc_flags_our}; then
712
                true
713
        else
714
                echo "Configuration file sanity check failed:"
715
                echo "======================================="
716
                ${command} -t ${rc_flags_our}
717
                echo "======================================="
718
                false
719
        fi
720
}
721
703
rcvar=${name}_enable
722
rcvar=${name}_enable
704
load_rc_config ${name}
723
load_rc_config ${name}
705
724
Lines 718-723 Link Here
718
required_files=${dhcpd_conf}
737
required_files=${dhcpd_conf}
719
start_precmd=${name}_precmd
738
start_precmd=${name}_precmd
720
stop_postcmd=${name}_postcmd
739
stop_postcmd=${name}_postcmd
740
restart_precmd="dhcpd_checkconfig"
721
install_cmd=dhcpd_install
741
install_cmd=dhcpd_install
722
uninstall_cmd=dhcpd_uninstall
742
uninstall_cmd=dhcpd_uninstall
723
extra_commands="install uninstall"
743
extra_commands="install uninstall"
(-)patch-server::dhcpd.c (-21 / +30 lines)
Lines 1-5 Link Here
1
--- server/dhcpd.c.orig	Thu Jun 10 19:59:52 2004
1
--- server/dhcpd.c.orig	2009-07-18 12:17:49.000000000 +0000
2
+++ server/dhcpd.c	Fri Jun 25 15:49:09 2004
2
+++ server/dhcpd.c	2009-07-18 12:16:17.000000000 +0000
3
@@ -47,6 +47,22 @@
3
@@ -47,6 +47,22 @@
4
 #include "version.h"
4
 #include "version.h"
5
 #include <omapip/omapip_p.h>
5
 #include <omapip/omapip_p.h>
Lines 22-29 Link Here
22
+
22
+
23
 static void usage PROTO ((void));
23
 static void usage PROTO ((void));
24
 
24
 
25
 TIME cur_time;
25
 struct iaddr server_identifier;
26
@@ -195,6 +211,35 @@
26
@@ -193,6 +209,46 @@
27
 	omapi_object_dereference (&listener, MDL);
27
 	omapi_object_dereference (&listener, MDL);
28
 }
28
 }
29
 
29
 
Lines 42-55 Link Here
42
+#endif /* PARANOIA */
42
+#endif /* PARANOIA */
43
+
43
+
44
+#if defined (JAIL)
44
+#if defined (JAIL)
45
+static void setup_jail (char *chroot_dir, char *hostname, u_int32_t ip_number)
45
+#if !defined(JAIL_API_VERSION)
46
+#define	JAIL_API_VERSION	0
47
+#endif
48
+static void setup_jail (char *chroot_dir, char *hostname, struct in_addr ip_addr)
46
+{
49
+{
47
+      struct jail j;
50
+      struct jail j;
48
+
51
+
49
+      j.version = 0;
52
+      memset(&j, 0, sizeof(j));
53
+      j.version = JAIL_API_VERSION;
50
+      j.path = chroot_dir;
54
+      j.path = chroot_dir;
51
+      j.hostname = hostname;
55
+      j.hostname = hostname;
52
+      j.ip_number = ip_number;
56
+#if JAIL_API_VERSION == 0
57
+      j.ip_number = ntoh1(ip_addr.s_addr);
58
+#elif JAIL_API_VERSION ==2
59
+      j.ip4s = 1;
60
+      j.ip4 = &ip_addr;
61
+#else
62
+#error Unsupported jail API
63
+#endif
53
+
64
+
54
+      if (jail (&j) < 0)
65
+      if (jail (&j) < 0)
55
+              log_fatal ("jail(%s, %s): %m", chroot_dir, hostname);
66
+              log_fatal ("jail(%s, %s): %m", chroot_dir, hostname);
Lines 59-65 Link Here
59
 int main (argc, argv, envp)
70
 int main (argc, argv, envp)
60
 	int argc;
71
 	int argc;
61
 	char **argv, **envp;
72
 	char **argv, **envp;
62
@@ -227,6 +272,25 @@
73
@@ -225,6 +281,25 @@
63
 	char *traceinfile = (char *)0;
74
 	char *traceinfile = (char *)0;
64
 	char *traceoutfile = (char *)0;
75
 	char *traceoutfile = (char *)0;
65
 #endif
76
 #endif
Lines 78-91 Link Here
78
+#endif /* PARANOIA || JAIL */
89
+#endif /* PARANOIA || JAIL */
79
+#if defined (JAIL)
90
+#if defined (JAIL)
80
+	char *set_jail = 0;
91
+	char *set_jail = 0;
81
+	u_int32_t jail_ip_address = 0; /* Good as long as it's IPv4 ... */
92
+	struct in_addr jail_ip_address;
82
+	int no_dhcpd_jail = 0;
93
+	int no_dhcpd_jail = 0;
83
+	char *s2;
94
+	char *s2;
84
+#endif /* JAIL */
95
+#endif /* JAIL */
85
 
96
 
86
 	/* Make sure we have stdin, stdout and stderr. */
97
         /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
87
 	status = open ("/dev/null", O_RDWR);
98
            2 (stderr) are open. To do this, we assume that when we
88
@@ -289,6 +353,39 @@
99
@@ -290,6 +365,38 @@
89
 			if (++i == argc)
100
 			if (++i == argc)
90
 				usage ();
101
 				usage ();
91
 			server = argv [i];
102
 			server = argv [i];
Lines 119-131 Link Here
119
+				usage ();
130
+				usage ();
120
+			if (inet_pton (AF_INET, argv[i], &jail_ip_address) < 0)
131
+			if (inet_pton (AF_INET, argv[i], &jail_ip_address) < 0)
121
+				log_fatal ("invalid ip address: %s", argv[i]);
132
+				log_fatal ("invalid ip address: %s", argv[i]);
122
+			jail_ip_address = ntohl (jail_ip_address);
123
+			no_dhcpd_jail = 1;
133
+			no_dhcpd_jail = 1;
124
+#endif /* JAIL */
134
+#endif /* JAIL */
125
 		} else if (!strcmp (argv [i], "-cf")) {
135
 		} else if (!strcmp (argv [i], "-cf")) {
126
 			if (++i == argc)
136
 			if (++i == argc)
127
 				usage ();
137
 				usage ();
128
@@ -366,6 +463,28 @@
138
@@ -367,6 +474,27 @@
129
 	if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
139
 	if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
130
 		path_dhcpd_pid = s;
140
 		path_dhcpd_pid = s;
131
 	}
141
 	}
Lines 148-160 Link Here
148
+		set_jail = s;
158
+		set_jail = s;
149
+		if (inet_pton (AF_INET, s2, &jail_ip_address) < 0)
159
+		if (inet_pton (AF_INET, s2, &jail_ip_address) < 0)
150
+			log_fatal ("invalid ip address: %s", s2);
160
+			log_fatal ("invalid ip address: %s", s2);
151
+		jail_ip_address = ntohl (jail_ip_address);
152
+	}
161
+	}
153
+#endif /* JAIL */
162
+#endif /* JAIL */
154
 
163
 
155
 	if (!quiet) {
164
 	if (!quiet) {
156
 		log_info ("%s %s", message, DHCP_VERSION);
165
 		log_info ("%s %s", message, DHCP_VERSION);
157
@@ -388,6 +507,57 @@
166
@@ -393,6 +521,57 @@
158
 					     trace_seed_stop, MDL);
167
 					     trace_seed_stop, MDL);
159
 #endif
168
 #endif
160
 
169
 
Lines 212-218 Link Here
212
 	/* Default to the DHCP/BOOTP port. */
221
 	/* Default to the DHCP/BOOTP port. */
213
 	if (!local_port)
222
 	if (!local_port)
214
 	{
223
 	{
215
@@ -462,6 +632,9 @@
224
@@ -467,6 +646,9 @@
216
 #endif
225
 #endif
217
 
226
 
218
 	/* Initialize icmp support... */
227
 	/* Initialize icmp support... */
Lines 222-228 Link Here
222
 	if (!cftest && !lftest)
231
 	if (!cftest && !lftest)
223
 		icmp_startup (1, lease_pinged);
232
 		icmp_startup (1, lease_pinged);
224
 
233
 
225
@@ -491,6 +664,14 @@
234
@@ -496,6 +678,14 @@
226
 
235
 
227
 	postconf_initialization (quiet);
236
 	postconf_initialization (quiet);
228
 
237
 
Lines 237-243 Link Here
237
         /* test option should cause an early exit */
246
         /* test option should cause an early exit */
238
  	if (cftest && !lftest) 
247
  	if (cftest && !lftest) 
239
  		exit(0);
248
  		exit(0);
240
@@ -533,7 +714,22 @@
249
@@ -538,7 +728,22 @@
241
 		else if (pid)
250
 		else if (pid)
242
 			exit (0);
251
 			exit (0);
243
 	}
252
 	}
Lines 259-266 Link Here
259
+  
268
+  
260
 	/* Read previous pid file. */
269
 	/* Read previous pid file. */
261
 	if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
270
 	if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
262
 		status = read (i, pbuf, (sizeof pbuf) - 1);
271
 		status = read(i, pbuf, (sizeof pbuf) - 1);
263
@@ -877,8 +1073,24 @@
272
@@ -877,8 +1082,24 @@
264
 	log_info (copyright);
273
 	log_info (copyright);
265
 	log_info (arr);
274
 	log_info (arr);

Return to bug 136890