update to ISC-DHCPD 4.2.3-P2, from Brad. jakob@ (maintainer) ok.

This commit is contained in:
sthen 2012-01-14 12:43:25 +00:00
parent 0e7a96e0ae
commit bb1fb8e826
10 changed files with 70 additions and 244 deletions

View File

@ -1,51 +1,46 @@
# $OpenBSD: Makefile,v 1.23 2011/11/16 00:10:31 sthen Exp $
# $OpenBSD: Makefile,v 1.24 2012/01/14 12:43:25 sthen Exp $
COMMENT-main= ISC DHCP Server
COMMENT-client= ISC DHCP Client
COMMENT-omapi= ISC DHCP OMAPI
VERSION= 3.1.3
REVISION= 0
VERSION= 4.2.3-P2
DISTNAME= isc-dhcp-${VERSION}
PKGNAME= isc-dhcp-${VERSION}
PKGNAME= isc-dhcp-${VERSION:S/-P/./}
PKGNAME-main= isc-dhcp-server-${VERSION:S/-P/./}
PKGNAME-client= isc-dhcp-client-${VERSION:S/-P/./}
PKGNAME-omapi= isc-dhcp-omapi-${VERSION:S/-P/./}
CATEGORIES= net
DISTFILES= dhcp-${VERSION}.tar.gz
WRKDIST= ${WRKDIR}/dhcp-${VERSION}
PKGNAME-main= isc-dhcp-server-${VERSION}
PKGNAME-client= isc-dhcp-client-${VERSION}
PKGNAME-omapi= isc-dhcp-omapi-${VERSION}
MASTER_SITES= ${MASTER_SITE_ISC:=dhcp/${VERSION}/} \
${MASTER_SITE_ISC:=dhcp/}
MASTER_SITES= ${MASTER_SITE_ISC:=dhcp/} \
${MASTER_SITE_ISC:=dhcp/dhcp-3.0-history/}
HOMEPAGE= http://www.isc.org/products/DHCP/
HOMEPAGE= http://www.isc.org/software/dhcp/
MAINTAINER= Jakob Schlyter <jakob@openbsd.org>
# ISC
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c
USE_GROFF = Yes
NO_REGRESS= Yes
MULTI_PACKAGES= -main -omapi -client
CONFIGURE_STYLE= simple
USE_GROFF= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= --enable-early-chroot \
--enable-paranoia \
NO_REGRESS= Yes
EXAMPLEDIR= share/examples/isc-dhcp
do-configure:
cd ${WRKSRC} && ./configure \
--copts "${CONFIGURE_ARGS} -DPARANOIA -DEARLY_CHROOT ${CFLAGS}"
post-extract:
@sed s,y0y0y0,${PREFIX}, < ${FILESDIR}/site.conf > ${WRKSRC}/site.conf
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/${EXAMPLEDIR}
${INSTALL_DATA} ${WRKSRC}/server/dhcpd.conf ${PREFIX}/${EXAMPLEDIR}

View File

@ -1,5 +1,5 @@
MD5 (dhcp-3.1.3.tar.gz) = buiviyg8lbO0216Itt2aJg==
RMD160 (dhcp-3.1.3.tar.gz) = IzfRzCnnvorJc9i/7GMzZ903wSo=
SHA1 (dhcp-3.1.3.tar.gz) = kv6lA2w4qEDy+US2zR2QsY+VC3w=
SHA256 (dhcp-3.1.3.tar.gz) = yzYyR6iXvq9XCMmNOoDbqO3Y9jnWvR9K2mxaZLpR4tQ=
SIZE (dhcp-3.1.3.tar.gz) = 804097
MD5 (dhcp-4.2.3-P2.tar.gz) = FPV/1YDQFjPQ+tSAkAeoAQ==
RMD160 (dhcp-4.2.3-P2.tar.gz) = RFZjpEsYrNLwJJe2UscmVvmg4yg=
SHA1 (dhcp-4.2.3-P2.tar.gz) = bOET2OYwE0O2bU1xvlmjw0gFN40=
SHA256 (dhcp-4.2.3-P2.tar.gz) = XPeuLK2cTKAQN0iyR27I6nhITkCPj+WX5OCkr7BRtGk=
SIZE (dhcp-4.2.3-P2.tar.gz) = 9527546

View File

@ -1,11 +0,0 @@
# $OpenBSD: site.conf,v 1.1.1.1 2002/06/24 20:50:03 jakob Exp $
#
# ISC DHCP site.conf to locate things in y0y0y0
USERBINDIR=y0y0y0/bin
BINDIR=y0y0y0/sbin
CLIENTBINDIR=y0y0y0/sbin
ADMMANDIR=y0y0y0/man/cat8
FFMANDIR=y0y0y0/man/cat5
LIBMANDIR=y0y0y0/man/cat3
USRMANDIR=y0y0y0/man/cat1

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-Makefile_conf,v 1.2 2007/09/24 06:17:19 jakob Exp $
--- Makefile.conf.orig Thu Jun 16 21:39:35 2005
+++ Makefile.conf Fri Jul 13 09:25:09 2007
@@ -199,6 +199,7 @@ MINORVERSION=MinorVersion
##--openbsd--
#CF = cf/openbsd.h
#SCRIPT=openbsd
+INSTALL = install -c -m 555 -s
##--openbsd--
## FreeBSD

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-common_socket_c,v 1.1 2012/01/14 12:43:25 sthen Exp $
--- common/socket.c.orig Mon Jun 27 12:18:20 2011
+++ common/socket.c Fri Dec 23 14:14:40 2011
@@ -717,6 +717,7 @@ ssize_t send_packet6(struct interface_info *interface,
/*
* Set the target address we're sending to.
*/
+ to->sin6_scope_id = if_nametoindex(interface->name);
m.msg_name = to;
m.msg_namelen = sizeof(*to);
@@ -747,7 +748,6 @@ ssize_t send_packet6(struct interface_info *interface,
pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg);
memset(pktinfo, 0, sizeof(*pktinfo));
pktinfo->ipi6_ifindex = if_nametoindex(interface->name);
- m.msg_controllen = cmsg->cmsg_len;
result = sendmsg(interface->wfdesc, &m, 0);
if (result < 0) {

View File

@ -1,168 +0,0 @@
--- server/dhcpd.c Thu Jun 21 22:12:58 2001
+++ server/dhcpd.c Wed Oct 17 08:23:00 2001
@@ -56,6 +56,16 @@
#include "version.h"
#include <omapip/omapip_p.h>
+#if defined (PARANOIA)
+# include <sys/types.h>
+# include <unistd.h>
+# include <pwd.h>
+/* get around the ISC declaration of group */
+# define group real_group
+# include <grp.h>
+# undef group
+#endif /* PARANOIA */
+
static void usage PROTO ((void));
TIME cur_time;
@@ -204,6 +214,22 @@
omapi_object_dereference (&listener, MDL);
}
+#if defined (PARANOIA)
+/* to be used in one of two possible scenarios */
+static void setup_chroot (char *chroot_dir) {
+ if (geteuid())
+ log_fatal ("you must be root to use chroot");
+
+ if (chroot(chroot_dir)) {
+ log_fatal ("chroot(\"%s\"): %m", chroot_dir);
+ }
+ if (chdir ("/")) {
+ /* probably permission denied */
+ log_fatal ("chdir(\"/\"): %m");
+ }
+}
+#endif /* PARANOIA */
+
int main (argc, argv, envp)
int argc;
char **argv, **envp;
@@ -236,6 +262,14 @@
char *traceinfile = (char *)0;
char *traceoutfile = (char *)0;
#endif
+#if defined (PARANOIA)
+ char *set_user = 0;
+ char *set_group = 0;
+ char *set_chroot = 0;
+
+ uid_t set_uid = 0;
+ gid_t set_gid = 0;
+#endif /* PARANOIA */
/* Make sure we have stdin, stdout and stderr. */
status = open ("/dev/null", O_RDWR);
@@ -298,6 +332,20 @@
if (++i == argc)
usage ();
server = argv [i];
+#if defined (PARANOIA)
+ } else if (!strcmp (argv [i], "-user")) {
+ if (++i == argc)
+ usage ();
+ set_user = argv [i];
+ } else if (!strcmp (argv [i], "-group")) {
+ if (++i == argc)
+ usage ();
+ set_group = argv [i];
+ } else if (!strcmp (argv [i], "-chroot")) {
+ if (++i == argc)
+ usage ();
+ set_chroot = argv [i];
+#endif /* PARANOIA */
} else if (!strcmp (argv [i], "-cf")) {
if (++i == argc)
usage ();
@@ -397,6 +445,44 @@
trace_seed_stop, MDL);
#endif
+#if defined (PARANOIA)
+ /* get user and group info if those options were given */
+ if (set_user) {
+ struct passwd *tmp_pwd;
+
+ if (geteuid())
+ log_fatal ("you must be root to set user");
+
+ if (!(tmp_pwd = getpwnam(set_user)))
+ log_fatal ("no such user: %s", set_user);
+
+ set_uid = tmp_pwd->pw_uid;
+
+ /* use the user's group as the default gid */
+ if (!set_group)
+ set_gid = tmp_pwd->pw_gid;
+ }
+
+ if (set_group) {
+/* get around the ISC declaration of group */
+#define group real_group
+ struct group *tmp_grp;
+
+ if (geteuid())
+ log_fatal ("you must be root to set group");
+
+ if (!(tmp_grp = getgrnam(set_group)))
+ log_fatal ("no such group: %s", set_group);
+
+ set_gid = tmp_grp->gr_gid;
+#undef group
+ }
+
+# if defined (EARLY_CHROOT)
+ if (set_chroot) setup_chroot (set_chroot);
+# endif /* EARLY_CHROOT */
+#endif /* PARANOIA */
+
/* Default to the DHCP/BOOTP port. */
if (!local_port)
{
@@ -500,6 +586,10 @@
postconf_initialization (quiet);
+#if defined (PARANOIA) && !defined (EARLY_CHROOT)
+ if (set_chroot) setup_chroot (set_chroot);
+#endif /* PARANOIA && !EARLY_CHROOT */
+
/* test option should cause an early exit */
if (cftest && !lftest)
exit(0);
@@ -543,6 +633,22 @@
exit (0);
}
+#if defined (PARANOIA)
+ /* change uid to the specified one */
+
+ if (set_gid) {
+ if (setgroups (0, (void *)0))
+ log_fatal ("setgroups: %m");
+ if (setgid (set_gid))
+ log_fatal ("setgid(%d): %m", (int) set_gid);
+ }
+
+ if (set_uid) {
+ if (setuid (set_uid))
+ log_fatal ("setuid(%d): %m", (int) set_uid);
+ }
+#endif /* PARANOIA */
+
/* Read previous pid file. */
if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
status = read (i, pbuf, (sizeof pbuf) - 1);
@@ -888,6 +994,10 @@
log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s",
"\n [-cf config-file] [-lf lease-file]",
+#if defined (PARANOIA)
+ /* meld into the following string */
+ "\n [-user user] [-group group] [-chroot dir]"
+#endif /* PARANOIA */
#if defined (TRACING)
"\n [-tf trace-output-file]",
"\n [-play trace-input-file]",

View File

@ -1,6 +1,7 @@
--- server/dhcpd.c 2003-11-05 14:08:09.000000000 -0800
+++ server/dhcpd.c 2003-11-05 14:15:32.000000000 -0800
@@ -602,6 +602,12 @@
$OpenBSD: patch-server_dhcpd_c,v 1.1 2012/01/14 12:43:25 sthen Exp $
--- server/dhcpd.c.orig Thu Apr 21 10:08:15 2011
+++ server/dhcpd.c Fri Dec 23 14:14:41 2011
@@ -705,6 +705,12 @@ main(int argc, char **argv) {
if (lftest)
exit (0);
@ -11,5 +12,5 @@
+#endif /* PARANOIA */
+
/* Discover all the network interfaces and initialize them. */
discover_interfaces (DISCOVER_SERVER);
discover_interfaces(DISCOVER_SERVER);

View File

@ -1,10 +1,9 @@
@comment $OpenBSD: PLIST-client,v 1.3 2009/10/22 21:13:29 jakob Exp $
@comment $OpenBSD: PLIST-client,v 1.4 2012/01/14 12:43:25 sthen Exp $
@conflict isc-dhcp-*
@man man/man5/dhclient.conf.5
@man man/man5/dhclient.leases.5
@man man/man8/dhclient-script.8
@man man/man8/dhclient.8
@bin sbin/dhclient
sbin/dhclient-script
share/examples/isc-dhcp/
share/examples/isc-dhcp/dhclient.conf
@man man/cat5/dhclient.conf.5
@man man/cat5/dhclient.leases.5
@man man/cat8/dhclient-script.8
@man man/cat8/dhclient.8

View File

@ -1,12 +1,12 @@
@comment $OpenBSD: PLIST-main,v 1.3 2009/10/22 21:13:29 jakob Exp $
@comment $OpenBSD: PLIST-main,v 1.4 2012/01/14 12:43:25 sthen Exp $
@conflict isc-dhcp-*
@pkgpath net/isc-dhcp
man/cat5/dhcp-eval.5
man/cat5/dhcp-options.5
man/cat5/dhcpd.conf.5
man/cat5/dhcpd.leases.5
man/cat8/dhcpd.8
man/cat8/dhcrelay.8
@man man/man5/dhcp-eval.5
@man man/man5/dhcp-options.5
@man man/man5/dhcpd.conf.5
@man man/man5/dhcpd.leases.5
@man man/man8/dhcpd.8
@man man/man8/dhcrelay.8
@bin sbin/dhcpd
@bin sbin/dhcrelay
share/examples/isc-dhcp/

View File

@ -1,21 +1,23 @@
@comment $OpenBSD: PLIST-omapi,v 1.3 2009/10/22 21:13:29 jakob Exp $
@comment $OpenBSD: PLIST-omapi,v 1.4 2012/01/14 12:43:25 sthen Exp $
@conflict isc-dhcp-*
@bin bin/omshell
include/dhcpctl.h
include/dhcpctl/
include/dhcpctl/dhcpctl.h
include/isc-dhcp/
include/isc-dhcp/boolean.h
include/isc-dhcp/dst.h
include/isc-dhcp/int.h
include/isc-dhcp/lang.h
include/isc-dhcp/list.h
include/isc-dhcp/result.h
include/isc-dhcp/types.h
include/omapip/
include/omapip/alloc.h
include/omapip/buffer.h
include/omapip/convert.h
include/omapip/hash.h
include/omapip/isclib.h
include/omapip/omapip.h
include/omapip/omapip_p.h
include/omapip/result.h
include/omapip/trace.h
lib/libdhcpctl.a
lib/libdst.a
lib/libomapi.a
@man man/cat1/omshell.1
@man man/cat3/dhcpctl.3
@man man/cat3/omapi.3
@man man/man1/omshell.1
@man man/man3/dhcpctl.3
@man man/man3/omapi.3