diff options
author | 2005-12-07 13:59:32 +0000 | |
---|---|---|
committer | 2005-12-07 13:59:32 +0000 | |
commit | 33e7e9b9967ccc5d6e00a7e1e540551fe2ddb79a (patch) | |
tree | c49485a177a66cc6e46de6ec8e11709aa1b48766 /net-misc/dhcp | |
parent | Stable on sparc wrt #114583 (diff) | |
download | historical-33e7e9b9967ccc5d6e00a7e1e540551fe2ddb79a.tar.gz historical-33e7e9b9967ccc5d6e00a7e1e540551fe2ddb79a.tar.bz2 historical-33e7e9b9967ccc5d6e00a7e1e540551fe2ddb79a.zip |
Split patches out into FILESDIR.
Stop installing dhclient-script.sample as baselayout has its own.
chroot creation no longer assumes a default directory.
We copy resolv.conf and localtime as a real files into the chroot now.
document resolv.conf in conf.d/dhcp for chroots, #113869.
init script now parses dhcpd.conf for pidfile and leasefile locations, #89428.
libdst.a gets installed now, #75544.
Package-Manager: portage-2.0.53
Diffstat (limited to 'net-misc/dhcp')
-rw-r--r-- | net-misc/dhcp/ChangeLog | 17 | ||||
-rw-r--r-- | net-misc/dhcp/Manifest | 19 | ||||
-rw-r--r-- | net-misc/dhcp/dhcp-3.0.3-r1.ebuild (renamed from net-misc/dhcp/dhcp-3.0.2.ebuild) | 102 | ||||
-rw-r--r-- | net-misc/dhcp/dhcp-3.0.3.ebuild | 154 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-3.0-fix-perms.patch | 15 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-3.0-paranoia.patch | 207 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp-3.0.3-libdst.patch | 14 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp.conf | 15 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcp.init | 49 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcrelay.conf | 9 | ||||
-rw-r--r-- | net-misc/dhcp/files/dhcrelay.init | 32 | ||||
-rw-r--r-- | net-misc/dhcp/files/digest-dhcp-3.0.2 | 2 | ||||
-rw-r--r-- | net-misc/dhcp/files/digest-dhcp-3.0.3 | 2 | ||||
-rw-r--r-- | net-misc/dhcp/files/digest-dhcp-3.0.3-r1 | 1 | ||||
-rw-r--r-- | net-misc/dhcp/metadata.xml | 8 |
15 files changed, 416 insertions, 230 deletions
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog index d5e29c877268..b539663afc25 100644 --- a/net-misc/dhcp/ChangeLog +++ b/net-misc/dhcp/ChangeLog @@ -1,6 +1,21 @@ # ChangeLog for net-misc/dhcp # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.60 2005/12/04 21:19:53 tgall Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.61 2005/12/07 13:59:32 uberlord Exp $ + +*dhcp-3.0.3-r1 (07 Dec 2005) + + 07 Dec 2005; Roy Marples <uberlord@gentoo.org> + +files/dhcp-3.0.3-libdst.patch, +files/dhcp-3.0-fix-perms.patch, + +files/dhcp-3.0-paranoia.patch, files/dhcp.conf, +files/dhcp.init, + files/dhcrelay.conf, +files/dhcrelay.init, metadata.xml, + -dhcp-3.0.2.ebuild, -dhcp-3.0.3.ebuild, +dhcp-3.0.3-r1.ebuild: + Split patches out into FILESDIR. + Stop installing dhclient-script.sample as baselayout has its own. + chroot creation no longer assumes a default directory. + We copy resolv.conf and localtime as a real files into the chroot now. + document resolv.conf in conf.d/dhcp for chroots, #113869. + init script now parses dhcpd.conf for pidfile and leasefile locations, #89428. + libdst.a gets installed now, #75544. 04 Dec 2005; Tom Gall <tgall@gentoo.org> dhcp-3.0.1-r1.ebuild: stable on ppc64 diff --git a/net-misc/dhcp/Manifest b/net-misc/dhcp/Manifest index 0e7eefec6c78..eaea29c538b1 100644 --- a/net-misc/dhcp/Manifest +++ b/net-misc/dhcp/Manifest @@ -1,15 +1,18 @@ -MD5 76e3359f7c970ef25be714f0f6343d89 ChangeLog 9891 +MD5 497bc9c4f38a2f603f0d03e60e2cb9b3 ChangeLog 10647 MD5 d0fccd0835d770dcc875b77a3e8bd92f dhcp-3.0.1-r1.ebuild 3989 -MD5 fd2864f5391129944f46c46c99fd1560 dhcp-3.0.2.ebuild 4135 -MD5 a01c944994028d0ae8f238d38f72b608 dhcp-3.0.3.ebuild 4403 -MD5 9384ae7ba3e9f56b8027ea92f607042d metadata.xml 215 +MD5 39c9e153c97b73c2a76c3e3fa3562fa4 dhcp-3.0.3-r1.ebuild 3951 MD5 2421c68dfdeec65048f1a97cbee1f4ca files/dhclient-ntp.patch 168 +MD5 d909d81a4d4ea39ddfc9898d33488c73 files/dhcp-3.0-fix-perms.patch 485 +MD5 66becf9870e0293bbd35d1fba770751a files/dhcp-3.0-paranoia.patch 5366 MD5 d0f61288e81ce020573f3f6965af8489 files/dhcp-3.0.2-gmake.patch 1872 +MD5 2bfa28477aff891d25c06a00677d261c files/dhcp-3.0.3-libdst.patch 322 MD5 ce6d18eef914ac8a39b0cb1bc4d63de2 files/dhcp-3.0.3-tr.patch 377 -MD5 5cde0a8fdf363490c4212726dfd06a38 files/dhcp.conf 769 +MD5 2a2635a76ada362d73f6c004a31199d0 files/dhcp.conf 952 +MD5 8825c027fbef1544e663d5a5f4cf6cd1 files/dhcp.init 1339 MD5 81b9256728a5daab31f0513ab55e8354 files/dhcp.rc6 1092 -MD5 6c69efa2b41915ec59e53bb065ac3d0c files/dhcrelay.conf 502 +MD5 02ea0c813e6dae9194379a195fa56e0c files/dhcrelay.conf 564 +MD5 6e2bc3e08290c60d4f339ab9182fce07 files/dhcrelay.init 748 MD5 8a19dd005c33231e02c03659f0c658df files/dhcrelay.rc6 626 MD5 323228061719fcac86be97a1a25d23b6 files/digest-dhcp-3.0.1-r1 128 -MD5 b060506f226297b90435f270b7345496 files/digest-dhcp-3.0.2 128 -MD5 fed4fe3fa59701ea010193e45aa907be files/digest-dhcp-3.0.3 128 +MD5 c6df78cb1777bebada64f9c629b9f8eb files/digest-dhcp-3.0.3-r1 62 +MD5 436163172942ee1a0bcfb47534a71cce metadata.xml 330 diff --git a/net-misc/dhcp/dhcp-3.0.2.ebuild b/net-misc/dhcp/dhcp-3.0.3-r1.ebuild index ba56b11f7e65..d60f4b184ff5 100644 --- a/net-misc/dhcp/dhcp-3.0.2.ebuild +++ b/net-misc/dhcp/dhcp-3.0.3-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.0.2.ebuild,v 1.5 2005/09/04 14:39:53 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.0.3-r1.ebuild,v 1.1 2005/12/07 13:59:32 uberlord Exp $ inherit eutils flag-o-matic toolchain-funcs @@ -8,9 +8,7 @@ PATCHVER=1 DESCRIPTION="ISC Dynamic Host Configuration Protocol" HOMEPAGE="http://www.isc.org/products/DHCP" -SRC_URI="ftp://ftp.isc.org/isc/dhcp/${P}.tar.gz - mirror://gentoo/${PN}-3-gentoo-${PATCHVER}.tar.bz2" - +SRC_URI="ftp://ftp.isc.org/isc/dhcp/${P}.tar.gz" LICENSE="isc-dhcp" SLOT="0" @@ -19,31 +17,36 @@ IUSE="static selinux" RDEPEND="virtual/libc selinux? ( sec-policy/selinux-dhcp )" - DEPEND="${RDEPEND} >=sys-apps/sed-4" PROVIDE="virtual/dhcpc" -PATCHDIR=${WORKDIR}/patch - src_unpack() { - unpack ${A} && cd "${S}" - - export EPATCH_SUFFIX="patch" - epatch ${PATCHDIR} - - has noman ${FEATURES} && sed -i 's:nroff:echo:' */Makefile.dist + unpack "${A}" + cd "${S}" + + # Enable chroot + epatch "${FILESDIR}/${PN}-3.0-paranoia.patch" + # Fix some permission issues + epatch "${FILESDIR}/${PN}-3.0-fix-perms.patch" + # Fix token ring compiling, #102473 + epatch "${FILESDIR}/${P}-tr.patch" + # Install libdst, #75544 + epatch "${FILESDIR}/${P}-libdst.patch" + # Fix building on Gentoo/FreeBSD + epatch "${FILESDIR}/${PN}-3.0.2-gmake.patch" + + # Enable dhclient to equery NTP servers, fixed #63868 + epatch "${FILESDIR}/dhclient-ntp.patch" # FreeBSD doesn't like -Werror that is forced on sed -i -e 's:-Werror::' Makefile.conf - - epatch ${FILESDIR}/${P}-gmake.patch } src_compile() { # 01/Mar/2003: Fix for bug #11960 by Jason Wever <weeve@gentoo.org> - [ "${ARCH}" == "sparc" ] && filter-flags -O3 -O2 -O + [[ ${ARCH} == "sparc" ]] && filter-flags -O3 -O2 -O use static && append-ldflags -static @@ -69,8 +72,7 @@ src_compile() { USRMANDIR = /usr/share/man/man1 END - ./configure \ - --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \ + ./configure --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \ || die "configure failed" emake || die "compile problem" @@ -82,23 +84,20 @@ src_install() { insinto /etc/dhcp newins server/dhcpd.conf dhcpd.conf.sample newins client/dhclient.conf dhclient.conf.sample - dosed "s:/etc/dhclient-script:/etc/dhcp/dhclient-script:" \ - /etc/dhcp/dhclient.conf.sample - mv "${D}/sbin/dhclient-script" "${D}/etc/dhcp/dhclient-script.sample" - dodoc ANONCVS CHANGES README RELNOTES doc/* + dodoc README RELNOTES doc/* newdoc client/dhclient.conf dhclient.conf.sample newdoc client/scripts/linux dhclient-script.sample newdoc server/dhcpd.conf dhcpd.conf.sample - exeinto /etc/init.d - newexe "${FILESDIR}/dhcp.rc6" dhcp - newexe "${FILESDIR}/dhcrelay.rc6" dhcrelay + newinitd "${FILESDIR}/dhcp.init" dhcp + newinitd "${FILESDIR}/dhcrelay.init" dhcrelay insinto /etc/conf.d newins "${FILESDIR}/dhcp.conf" dhcp newins "${FILESDIR}/dhcrelay.conf" dhcrelay keepdir /var/{lib,run}/dhcp + chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp } pkg_preinst() { @@ -107,40 +106,41 @@ pkg_preinst() { } pkg_postinst() { - chown dhcp:dhcp "${ROOT}/var/lib/dhcp" "${ROOT}/var/run/dhcp" einfo "You can edit /etc/conf.d/dhcp to customize dhcp settings" einfo einfo "The DHCP ebuild now includes chroot support." - einfo "If you like to run dhcpd in chroot AND this is a new install OR" - einfo "your dhcpd doesn't already run in chroot, simply run:" + einfo "If you would like to run dhcpd in a chroot, simply configure the" + einfo "CHROOT directory in /etc/conf.d/dhcp and then run:" einfo " ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - einfo "Before running the above command you might want to change the chroot" - einfo "dir in /etc/conf.d/dhcp, otherwise /chroot/dhcp will be used." echo } pkg_config() { - CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/dhcp 2>/dev/null` - - if [ ! -d "${CHROOT:=/chroot/dhcp}" ] ; then - ebegin "Setting up the chroot directory" - mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp} - cp -R /etc/{localtime,dhcp} "${CHROOT}/etc/" - cp -R /var/lib/dhcp "${CHROOT}/var/lib" - chown -R dhcp:dhcp "${CHROOT}/var/lib" "${CHROOT}/var/run/dhcp" - eend - - if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/dhcp`" ] ; then - sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \ - -i /etc/conf.d/dhcp - fi - - einfo "To enable logging from the DHCP server, configure your" - einfo "logger (`best_version virtual/logger`) to listen on ${CHROOT}/dev/log" - else - eerror - eerror "${CHROOT} already exists. Quitting." - eerror + CHROOT="$( + sed -n 's/^[[:blank:]]\?CHROOT="*\([^#"]\+\)"*/\1/p' \ + /etc/conf.d/dhcp + )" + + if [[ -z ${CHROOT} ]]; then + eerror "CHROOT not defined in /etc/conf.d/dhcp" + return 1 + fi + + if [[ -d ${CHROOT} ]] ; then + ewarn "${CHROOT} already exists - aborting" + return 0 fi + + ebegin "Setting up the chroot directory" + mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp} + cp /etc/{localtime,resolv.conf} "${CHROOT}/etc" + cp -R /etc/dhcp "${CHROOT}/etc/" + cp -R /var/lib/dhcp "${CHROOT}/var/lib" + chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp + eend + + local logger="$(best_version virtual/logger)" + einfo "To enable logging from the DHCP server, configure your" + einfo "logger (${logger}) to listen on ${CHROOT}/dev/log" } diff --git a/net-misc/dhcp/dhcp-3.0.3.ebuild b/net-misc/dhcp/dhcp-3.0.3.ebuild deleted file mode 100644 index 0d878c76c774..000000000000 --- a/net-misc/dhcp/dhcp-3.0.3.ebuild +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.0.3.ebuild,v 1.1 2005/10/12 16:53:02 uberlord Exp $ - -inherit eutils flag-o-matic toolchain-funcs - -PATCHVER=1 - -DESCRIPTION="ISC Dynamic Host Configuration Protocol" -HOMEPAGE="http://www.isc.org/products/DHCP" -SRC_URI="ftp://ftp.isc.org/isc/dhcp/${P}.tar.gz - mirror://gentoo/${PN}-3-gentoo-${PATCHVER}.tar.bz2" - - -LICENSE="isc-dhcp" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86" -IUSE="static selinux" - -RDEPEND="virtual/libc - selinux? ( sec-policy/selinux-dhcp )" - -DEPEND="${RDEPEND} - >=sys-apps/sed-4" - -PROVIDE="virtual/dhcpc" - -PATCHDIR=${WORKDIR}/patch - -src_unpack() { - unpack ${A} && cd "${S}" - - export EPATCH_SUFFIX="patch" - # 3.0.3 already has this patch - rm -f "${PATCHDIR}/003_all_dhcp-3.0.1-fix-invalid-attribute.patch" - epatch ${PATCHDIR} - - has noman ${FEATURES} && sed -i 's:nroff:echo:' */Makefile.dist - - # Enable dhclient to equery NTP servers, fixed #63868 - epatch "${FILESDIR}/dhclient-ntp.patch" - - # Fix token ring compiling - epatch "${FILESDIR}/${P}-tr.patch" - - # FreeBSD doesn't like -Werror that is forced on - sed -i -e 's:-Werror::' Makefile.conf - - epatch ${FILESDIR}/${PN}-3.0.2-gmake.patch -} - -src_compile() { - # 01/Mar/2003: Fix for bug #11960 by Jason Wever <weeve@gentoo.org> - [ "${ARCH}" == "sparc" ] && filter-flags -O3 -O2 -O - - use static && append-ldflags -static - - cat <<-END >> includes/site.h - #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf" - #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid" - #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases" - #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases" - #define DHCPD_LOG_FACILITY LOG_LOCAL1 - END - - cat <<-END > site.conf - CC = $(tc-getCC) - LFLAGS = ${LDFLAGS} - LIBDIR = /usr/lib - INCDIR = /usr/include - ETC = /etc/dhcp - VARDB = /var/lib/dhcp - VARRUN = /var/run/dhcp - ADMMANDIR = /usr/share/man/man8 - FFMANDIR = /usr/share/man/man5 - LIBMANDIR = /usr/share/man/man3 - USRMANDIR = /usr/share/man/man1 - END - - ./configure \ - --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \ - || die "configure failed" - - emake || die "compile problem" -} - -src_install() { - make install DESTDIR="${D}" || die - - insinto /etc/dhcp - newins server/dhcpd.conf dhcpd.conf.sample - newins client/dhclient.conf dhclient.conf.sample - dosed "s:/etc/dhclient-script:/etc/dhcp/dhclient-script:" \ - /etc/dhcp/dhclient.conf.sample - mv "${D}/sbin/dhclient-script" "${D}/etc/dhcp/dhclient-script.sample" - - dodoc ANONCVS CHANGES README RELNOTES doc/* - newdoc client/dhclient.conf dhclient.conf.sample - newdoc client/scripts/linux dhclient-script.sample - newdoc server/dhcpd.conf dhcpd.conf.sample - - exeinto /etc/init.d - newexe "${FILESDIR}/dhcp.rc6" dhcp - newexe "${FILESDIR}/dhcrelay.rc6" dhcrelay - insinto /etc/conf.d - newins "${FILESDIR}/dhcp.conf" dhcp - newins "${FILESDIR}/dhcrelay.conf" dhcrelay - - keepdir /var/{lib,run}/dhcp -} - -pkg_preinst() { - enewgroup dhcp - enewuser dhcp -1 -1 /var/lib/dhcp dhcp -} - -pkg_postinst() { - chown dhcp:dhcp "${ROOT}/var/lib/dhcp" "${ROOT}/var/run/dhcp" - - einfo "You can edit /etc/conf.d/dhcp to customize dhcp settings" - einfo - einfo "The DHCP ebuild now includes chroot support." - einfo "If you like to run dhcpd in chroot AND this is a new install OR" - einfo "your dhcpd doesn't already run in chroot, simply run:" - einfo " ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - einfo "Before running the above command you might want to change the chroot" - einfo "dir in /etc/conf.d/dhcp, otherwise /chroot/dhcp will be used." - echo -} - -pkg_config() { - CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/dhcp 2>/dev/null` - - if [ ! -d "${CHROOT:=/chroot/dhcp}" ] ; then - ebegin "Setting up the chroot directory" - mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp} - cp -R /etc/{localtime,dhcp} "${CHROOT}/etc/" - cp -R /var/lib/dhcp "${CHROOT}/var/lib" - chown -R dhcp:dhcp "${CHROOT}/var/lib" "${CHROOT}/var/run/dhcp" - eend - - if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/dhcp`" ] ; then - sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \ - -i /etc/conf.d/dhcp - fi - - einfo "To enable logging from the DHCP server, configure your" - einfo "logger (`best_version virtual/logger`) to listen on ${CHROOT}/dev/log" - else - eerror - eerror "${CHROOT} already exists. Quitting." - eerror - fi -} diff --git a/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch b/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch new file mode 100644 index 000000000000..13debb20ed0e --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0-fix-perms.patch @@ -0,0 +1,15 @@ +--- 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 @@ + if (lftest) + exit (0); + ++#if defined (PARANOIA) ++ /* Set proper permissions... */ ++ if (lchown (path_dhcpd_db, set_uid, set_gid)) ++ log_fatal ("lchown(%s, %d, %d): %m", path_dhcpd_db, (int) set_uid, (int) set_gid); ++#endif /* PARANOIA */ ++ + /* Discover all the network interfaces and initialize them. */ + discover_interfaces (DISCOVER_SERVER); + diff --git a/net-misc/dhcp/files/dhcp-3.0-paranoia.patch b/net-misc/dhcp/files/dhcp-3.0-paranoia.patch new file mode 100644 index 000000000000..886f5cb5ffe3 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0-paranoia.patch @@ -0,0 +1,207 @@ + +paranoia (non-root/chroot) patch for ISC dhcp 3.0 +file to patch: dhcp-3.0/server/dhcpd.c + +update from paranoia patch for ISC dhcp 2.0 + +Adds 3 options: + + -user <user> + -group <group> + -chroot <chroot_dir> + +Notes: + -DPARANOIA must be passed as an argument to the --copts option + of configure. Otherwise, the paranoia code will not be compiled + in. Example: ./configure --copts -DPARANOIA + + The chroot() call has been delayed in order to allow /dev/log to + be reopened after the configuration file has been read. This is + beneficial for systems on which /dev/log is a unix domain socket. + The main side effect is that dhcpd.conf should be placed in /etc, + instead of <chroot_dir>/etc. + + If dhcpd is to be run on a sysV-style architecture (or, more + generally, if /dev/log is a character device), one may opt to + create the <chroot_dir>/dev/log character device and add + -DEARLY_CHROOT to the --copts option of configure (in addition to + -DPARANOIA). This will perform the chroot() call at the earliest + convenience (before reading the configuration file). + + If the -user option is used, the lease and pid file directories + should be writable to the server process after it drops + privileges. + + +ari edelkind (12/10/2001) +last modified 12/10/2001 + + +--- dhcp-3.0/server/dhcpd.c Thu Jun 21 22:12:58 2001 ++++ dhcp-3.0+paranoia/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]", diff --git a/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch b/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch new file mode 100644 index 000000000000..8e93ac95bc40 --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.3-libdst.patch @@ -0,0 +1,14 @@ +--- dst/Makefile.dist.old 2004-12-24 13:31:22.986061032 +0000 ++++ dst/Makefile.dist 2004-12-24 13:47:19.036913364 +0000 +@@ -31,6 +31,10 @@ + all: libdst.a + + install: ++ mkdir -p $(DESTDIR)$(LIBDIR) ++ $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR) ++ $(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libdst.a ++ + + libdst.a: $(OBJ) + rm -f dst.a + diff --git a/net-misc/dhcp/files/dhcp.conf b/net-misc/dhcp/files/dhcp.conf index 7fce9043df79..f842c1b826e7 100644 --- a/net-misc/dhcp/files/dhcp.conf +++ b/net-misc/dhcp/files/dhcp.conf @@ -1,13 +1,14 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcp.conf,v 1.7 2004/12/20 18:54:23 max Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcp.conf,v 1.8 2005/12/07 13:59:32 uberlord Exp $ # Configure which interface or interfaces to for dhcp to listen on -# list all interfaces space separated. -IFACE="eth0" +# list all interfaces space separated. If this is not specified then +# we listen on all interfaces. +#IFACE="" -# Insert any other options needed -DHCPD_OPTS="-q" +# Insert any other dhcp options - see the man page for a full list. +#DHCPD_OPTS="" # If you wish to run dhcp in a chroot, run: # ebuild /var/db/pkg/net-misc/<dhcp version>/<dhcp-version>.ebuild config @@ -15,5 +16,7 @@ DHCPD_OPTS="-q" # You can specify a different chroot directory but MAKE SURE it's empty. #CHROOT="/chroot/dhcp" -# If you need name resolution under a chroot, uncomment the following: +# If you need name resolution under a chroot, you need to ensure that +# you have a working /etc/resolv.conf in your chroot and you +# uncomment the following: #export LD_PRELOAD="/usr/lib/libresolv.so /usr/lib/libnss_dns.so" diff --git a/net-misc/dhcp/files/dhcp.init b/net-misc/dhcp/files/dhcp.init new file mode 100644 index 000000000000..784b7ccf8690 --- /dev/null +++ b/net-misc/dhcp/files/dhcp.init @@ -0,0 +1,49 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcp.init,v 1.1 2005/12/07 13:59:32 uberlord Exp $ + +depend() { + need net + use logger dns +} + +get_var() { + sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#"]\+\)"*/\1/p' \ + "${CHROOT}/etc/dhcp/dhcpd.conf" +} + +start() { + if [[ ! -f "${CHROOT}/etc/dhcp/dhcpd.conf" ]] ; then + eerror "${CHROOT}/etc/dhcp/dhcpd.conf does not exist" + return 1 + fi + + local leasefile=$(get_var lease-file-name) + leasefile="${leasefile:-${CHROOT}/var/lib/dhcp/dhcpd.leases}" + if [[ ! -f ${leasefile} ]] ; then + ebegin "Creating ${leasefile}" + touch "${leasefile}" + chown dcp:dhcp "${leasefile}" + eend $? || return 1 + fi + + # Ensure that LD_PRELOAD is really exported + [[ -n ${LD_PRELOAD} ]] && export LD_PRELOAD="${LD_PRELOAD}" + + local pidfile=$(get_var pid-file-name) + pidfile="${pidfile:-/var/run/dhcp.pid}" + + ebegin "Starting ${CHROOT:+chrooted }dhcpd" + eval start-stop-daemon --start --exec /usr/sbin/dhcpd \ + -- -q -pf "${pidfile}" \ + -user dhcp -group dhcp "${DHCPD_OPTS}" \ + ${CHROOT:+-chroot "${CHROOT}"} "${IFACE}" + eend $? && save_options pidfile "${CHROOT}${pidfile}" +} + +stop() { + ebegin "Stopping dhcpd" + start-stop-daemon --stop --pidfile "$(get_options pidfile)" + eend $? +} diff --git a/net-misc/dhcp/files/dhcrelay.conf b/net-misc/dhcp/files/dhcrelay.conf index 2b7f91a39efe..516f8361a0c5 100644 --- a/net-misc/dhcp/files/dhcrelay.conf +++ b/net-misc/dhcp/files/dhcrelay.conf @@ -1,13 +1,14 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcrelay.conf,v 1.4 2004/12/20 19:21:39 max Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcrelay.conf,v 1.5 2005/12/07 13:59:32 uberlord Exp $ # Configure which interface or interfaces to for dhcp to listen on -# list all interfaces space separated. -IFACE="eth0" +# list all interfaces space separated. If this is not specified then +# we listen on all interfaces. +#IFACE="" # Insert any other options needed. See dhcrelay(8) for details. -DHCRELAY_OPTS="-q" +#DHCRELAY_OPTS="" # Space separated list of IPs to forward BOOTP/DHCP packets to. DHCRELAY_SERVERS="" diff --git a/net-misc/dhcp/files/dhcrelay.init b/net-misc/dhcp/files/dhcrelay.init new file mode 100644 index 000000000000..c373f4a6eac2 --- /dev/null +++ b/net-misc/dhcp/files/dhcrelay.init @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcrelay.init,v 1.1 2005/12/07 13:59:32 uberlord Exp $ + +depend() { + need net + use logger +} + +start() { + if [[ -z ${DHCRELAY_SERVERS} ]]; then + eerror "No DHCRELAY_SERVERS specified in /etc/conf.d/dhcrelay" + return 1 + fi + + local IFACES="" i + for i in ${IFACE} ; do + IFACES="${IFACES} -i ${i}" + done + + ebegin "Starting dhcrelay" + eval start-stop-daemon --start --exec /usr/sbin/dhcrelay \ + -- "${IFACES}" -q "${DHCRELAY_OPTS}" "${DHCRELAY_SERVERS}" + eend $? +} + +stop() { + ebegin "Stopping dhcrelay" + start-stop-daemon --stop --pidfile /var/run/dhcrelay.pid + eend $? +} diff --git a/net-misc/dhcp/files/digest-dhcp-3.0.2 b/net-misc/dhcp/files/digest-dhcp-3.0.2 deleted file mode 100644 index bde8daecd235..000000000000 --- a/net-misc/dhcp/files/digest-dhcp-3.0.2 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 04800a111521e7442749b2ce883f962b dhcp-3.0.2.tar.gz 853313 -MD5 d5f2610cff1207633770035b126aea8f dhcp-3-gentoo-1.tar.bz2 2825 diff --git a/net-misc/dhcp/files/digest-dhcp-3.0.3 b/net-misc/dhcp/files/digest-dhcp-3.0.3 deleted file mode 100644 index c0c842966e03..000000000000 --- a/net-misc/dhcp/files/digest-dhcp-3.0.3 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 f91416a0b8ed3fd0601688cf0b7df58f dhcp-3.0.3.tar.gz 870240 -MD5 d5f2610cff1207633770035b126aea8f dhcp-3-gentoo-1.tar.bz2 2825 diff --git a/net-misc/dhcp/files/digest-dhcp-3.0.3-r1 b/net-misc/dhcp/files/digest-dhcp-3.0.3-r1 new file mode 100644 index 000000000000..b5c6d4ce1238 --- /dev/null +++ b/net-misc/dhcp/files/digest-dhcp-3.0.3-r1 @@ -0,0 +1 @@ +MD5 f91416a0b8ed3fd0601688cf0b7df58f dhcp-3.0.3.tar.gz 870240 diff --git a/net-misc/dhcp/metadata.xml b/net-misc/dhcp/metadata.xml index 05e6d2289c71..55c25a450e0b 100644 --- a/net-misc/dhcp/metadata.xml +++ b/net-misc/dhcp/metadata.xml @@ -1,6 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> -<herd>no-herd</herd> -<maintainer><email>max@gentoo.org</email></maintainer> + <herd>base-system</herd> + <maintainer> + <email>uberlord@gentoo.org</email> + <name>Roy Marples</name> + </maintainer> + <longdescription>The ISC DHCP client/server package.</longdescription> </pkgmetadata> |