diff options
author | Martin Schlemmer <azarah@gentoo.org> | 2003-09-01 20:10:57 +0000 |
---|---|---|
committer | Martin Schlemmer <azarah@gentoo.org> | 2003-09-01 20:10:57 +0000 |
commit | 73d1152999a9207369133563796e951540cebe58 (patch) | |
tree | 58943e47b5415110649b2cc2d94237c7123e52a6 | |
parent | handle SO_BSDCOMPAT (diff) | |
download | gentoo-2-73d1152999a9207369133563796e951540cebe58.tar.gz gentoo-2-73d1152999a9207369133563796e951540cebe58.tar.bz2 gentoo-2-73d1152999a9207369133563796e951540cebe58.zip |
handle SO_BSDCOMPAT
-rw-r--r-- | app-admin/sysklogd/ChangeLog | 8 | ||||
-rw-r--r-- | app-admin/sysklogd/Manifest | 4 | ||||
-rw-r--r-- | app-admin/sysklogd/files/digest-sysklogd-1.4.1-r5 | 1 | ||||
-rw-r--r-- | app-admin/sysklogd/files/sysklogd-1.4.1-SO_BSDCOMPAT.patch | 72 | ||||
-rw-r--r-- | app-admin/sysklogd/sysklogd-1.4.1-r5.ebuild | 43 |
5 files changed, 125 insertions, 3 deletions
diff --git a/app-admin/sysklogd/ChangeLog b/app-admin/sysklogd/ChangeLog index fa181698d780..33ffd2edcaaa 100644 --- a/app-admin/sysklogd/ChangeLog +++ b/app-admin/sysklogd/ChangeLog @@ -1,7 +1,13 @@ # ChangeLog for app-admin/sysklogd # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/ChangeLog,v 1.14 2003/07/28 07:08:12 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/ChangeLog,v 1.15 2003/09/01 20:10:45 azarah Exp $ +*sysklogd-1.4.1-r5 (01 Sep 2003) + + 01 Sep 2003; Martin Schlemmer <azarah@gentoo.org> sysklogd-1.4.1-r5.ebuild, + files/sysklogd-1.4.1-SO_BSDCOMPAT.patch: + Handle SO_BSDCOMPAT being depricated in 2.5+ kernels, thanks to Alex Riesen + <fork0@users.sf.net> for reporting. *sysklogd-1.4.1-r4 (11 May 2003) diff --git a/app-admin/sysklogd/Manifest b/app-admin/sysklogd/Manifest index 1828bc0550db..1acd58a651d1 100644 --- a/app-admin/sysklogd/Manifest +++ b/app-admin/sysklogd/Manifest @@ -1,6 +1,6 @@ MD5 1bbb2df73422802217ec9999570ed2e2 sysklogd-1.4.1-r4.ebuild 1172 -MD5 e63a8c89fe608f23bcb587172133c588 ChangeLog 2495 -MD5 4de0f57cf83c7e5f2f5b2d8d96563136 sysklogd-1.4.1-r5.ebuild 1287 +MD5 5c07ada39fb2c8b1adf17635d02b3773 ChangeLog 2766 +MD5 b26dc8b3f6ba574c165d75f9465ddec4 sysklogd-1.4.1-r5.ebuild 1295 MD5 e25d7b583b7e4bd8be503b89e1771e90 files/sysklogd.confd 113 MD5 59219c3af9de241b92b3fd786c84f483 files/sysklogd.rc6 1007 MD5 5d4b89ceb689887a6cbb582b875bf3e7 files/syslogd-listfiles.8 2540 diff --git a/app-admin/sysklogd/files/digest-sysklogd-1.4.1-r5 b/app-admin/sysklogd/files/digest-sysklogd-1.4.1-r5 new file mode 100644 index 000000000000..9e53804f2d1c --- /dev/null +++ b/app-admin/sysklogd/files/digest-sysklogd-1.4.1-r5 @@ -0,0 +1 @@ +MD5 d214aa40beabf7bdb0c9b3c64432c774 sysklogd-1.4.1.tar.gz 81784 diff --git a/app-admin/sysklogd/files/sysklogd-1.4.1-SO_BSDCOMPAT.patch b/app-admin/sysklogd/files/sysklogd-1.4.1-SO_BSDCOMPAT.patch new file mode 100644 index 000000000000..c027f2784553 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.4.1-SO_BSDCOMPAT.patch @@ -0,0 +1,72 @@ +--- sysklogd-1.4.1/syslogd.c.orig 2003-09-01 22:00:04.172556504 +0200 ++++ sysklogd-1.4.1/syslogd.c 2003-09-01 22:04:33.503611960 +0200 +@@ -1212,6 +1212,44 @@ + #endif + + #ifdef SYSLOG_INET ++/* This is from a patch by Mikael Pettersson <mikpe@csd.uu.se> to ++ fix HAVE_SO_BSDCOMPAT issues with 2.5+ kernels and Erlang/OTP. ++ */ ++#if defined(__linux__) ++#include <sys/utsname.h> ++static int should_use_so_bsdcompat() ++{ ++ static int init_done; ++ static int so_bsdcompat_is_obsolete; ++ ++ if (!init_done) { ++ struct utsname utsname; ++ unsigned int version, patchlevel; ++ ++ init_done = 1; ++ if (uname(&utsname) < 0) { ++ fprintf(stderr, "uname: %s\r\n", strerror(errno)); ++ return 1; ++ } ++ /* Format is <version>.<patchlevel>.<sublevel><extraversion> ++ where the first three are unsigned integers and the last ++ is an arbitrary string. We only care about the first two. */ ++ if (sscanf(utsname.release, "%u.%u", &version, &patchlevel) != 2) { ++ fprintf(stderr, "uname: unexpected release '%s'\r\n", ++ utsname.release); ++ return 1; ++ } ++ /* SO_BSCOMPAT is deprecated and triggers warnings in 2.5 ++ kernels. It is a no-op in 2.4 but not in 2.2 kernels. */ ++ if (version > 2 || (version == 2 && patchlevel >= 5)) ++ so_bsdcompat_is_obsolete = 1; ++ } ++ return !so_bsdcompat_is_obsolete; ++} ++#else /* __linux__ */ ++#define should_use_so_bsdcompat() 1 ++#endif /* __linux__ */ ++ + static int create_inet_socket() + { + int fd, on = 1; +@@ -1232,14 +1270,16 @@ + close(fd); + return -1; + } +- /* We need to enable BSD compatibility. Otherwise an attacker +- * could flood our log files by sending us tons of ICMP errors. +- */ +- if (setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, \ +- (char *) &on, sizeof(on)) < 0) { +- logerror("setsockopt(BSDCOMPAT), suspending inet"); +- close(fd); +- return -1; ++ if (should_use_so_bsdcompat()) { ++ /* We need to enable BSD compatibility. Otherwise an attacker ++ * could flood our log files by sending us tons of ICMP errors. ++ */ ++ if (setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, \ ++ (char *) &on, sizeof(on)) < 0) { ++ logerror("setsockopt(BSDCOMPAT), suspending inet"); ++ close(fd); ++ return -1; ++ } + } + if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) { + logerror("bind, suspending inet"); diff --git a/app-admin/sysklogd/sysklogd-1.4.1-r5.ebuild b/app-admin/sysklogd/sysklogd-1.4.1-r5.ebuild new file mode 100644 index 000000000000..5d3c13c9d422 --- /dev/null +++ b/app-admin/sysklogd/sysklogd-1.4.1-r5.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/sysklogd-1.4.1-r5.ebuild,v 1.1 2003/09/01 20:10:45 azarah Exp $ + +S="${WORKDIR}/${P}" +DESCRIPTION="Standard log daemons" +SRC_URI="ftp://metalab.unc.edu/pub/Linux/system/daemons/${P}.tar.gz" +HOMEPAGE="http://www.infodrom.org/projects/sysklogd/" +KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips" +SLOT="0" +LICENSE="BSD" +DEPEND="virtual/glibc" +RDEPEND="dev-lang/perl sys-apps/debianutils" + +src_unpack() { + unpack ${A} + + cd ${S} + mv Makefile Makefile.orig + sed -e "s:-O3:${CFLAGS}:" Makefile.orig > Makefile + + # Handle SO_BSDCOMPAT being depricated in 2.5+ kernels. + cd ${S}; epatch ${FILESDIR}/${P}-SO_BSDCOMPAT.patch +} + +src_compile() { + emake LDFLAGS="" || die +} + +src_install() { + dosbin syslogd klogd ${FILESDIR}/syslogd-listfiles + doman *.[1-9] ${FILESDIR}/syslogd-listfiles.8 + exeinto /etc/cron.daily + newexe ${FILESDIR}/syslog-cron syslog.cron + dodoc ANNOUNCE CHANGES COPYING MANIFEST NEWS README.1st README.linux + dodoc ${FILESDIR}/syslog.conf + insinto /etc + doins ${FILESDIR}/syslog.conf + exeinto /etc/init.d + newexe ${FILESDIR}/sysklogd.rc6 sysklogd + insinto /etc/conf.d + newins ${FILESDIR}/sysklogd.confd sysklogd +} |