diff options
author | kuriyama <kuriyama@FreeBSD.org> | 2005-07-13 10:37:24 +0800 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 2005-07-13 10:37:24 +0800 |
commit | 4bbe8e2ac5cc6d39b1b02c7aca0e863f5b047140 (patch) | |
tree | 27a587fd73efc7d87b5d6e967b248bb18ef8a367 /net-mgmt/net-snmp-devel | |
parent | c9122534d13ff9e3eca1826ac01b336094745f25 (diff) | |
download | freebsd-ports-gnome-4bbe8e2ac5cc6d39b1b02c7aca0e863f5b047140.tar.gz freebsd-ports-gnome-4bbe8e2ac5cc6d39b1b02c7aca0e863f5b047140.tar.zst freebsd-ports-gnome-4bbe8e2ac5cc6d39b1b02c7aca0e863f5b047140.zip |
- Fix negative integers on 64bit platforms [1].
- Upgrade to 5.2.1.2 and portlint fixes [2].
- Fix security problem in local/fixproc script [3].
PR: ports/82148 [1], ports/83058 [2]
Submitted by: Deomid Ryabkov <myself@rojer.pp.ru> [1],
Renato Botelho <freebsd@galle.com.br> [2],
remko [3]
References: http://vuxml.freebsd.org/3e0072d4-d05b-11d9-9aed-000e0c2e438a.html [3]
Obtained from: http://cvs.sourceforge.net/viewcvs.py/net-snmp/net-snmp/local/fixproc?r1=5.0&r2=5.0.6.1&diff_format=u [3]
Diffstat (limited to 'net-mgmt/net-snmp-devel')
-rw-r--r-- | net-mgmt/net-snmp-devel/Makefile | 34 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/distinfo | 4 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-asn1.c | 23 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-local:fixproc | 150 |
4 files changed, 159 insertions, 52 deletions
diff --git a/net-mgmt/net-snmp-devel/Makefile b/net-mgmt/net-snmp-devel/Makefile index 8eeed238248a..deb46c16fd45 100644 --- a/net-mgmt/net-snmp-devel/Makefile +++ b/net-mgmt/net-snmp-devel/Makefile @@ -6,14 +6,16 @@ # PORTNAME= snmp -PORTVERSION= 5.2.1 -PORTREVISION= 2 -PKGNAMEPREFIX= net- +PORTVERSION= 5.2.1.2 CATEGORIES= net-mgmt ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= net-snmp +PKGNAMEPREFIX= net- DISTNAME= ${PKGNAMEPREFIX}${PORTNAME}-${PORTVERSION} +MAINTAINER= kuriyama@FreeBSD.org +COMMENT= An extendable SNMP implementation + .if defined(WITH_INETADDRESS_HACK) EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-snmplib::mib.c .endif @@ -21,9 +23,6 @@ EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-snmplib::mib.c EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-local:Makefile.in .endif -MAINTAINER= kuriyama@FreeBSD.org -COMMENT= An extendable SNMP implementation - .if defined(WITH_TKMIB) RUN_DEPEND= ${SITE_PERL}/${PERL_ARCH}/Tk.pm:${PORTSDIR}/x11-toolkits/p5-Tk .endif @@ -103,15 +102,15 @@ NET_SNMP_MIB_MODULE_LIST=host disman/event-mib smux mibII/mta_sendmail mibII/tcp _NET_SNMP_MIB_MODULES= .for module1 in ${NET_SNMP_MIB_MODULE_LIST} _module1=${module1} -_define= false +_define=false . for module2 in ${NET_SNMP_MIB_MODULES} _module2=${module2} . if ${_module1} == ${_module2} -_define= true +_define=true . endif . endfor . if ${_define} == true -_NET_SNMP_MIB_MODULES+= ${module1} +_NET_SNMP_MIB_MODULES+=${module1} PLIST_SUB+= WITH_${module1:C|.*/||:U}="" . else PLIST_SUB+= WITH_${module1:C|.*/||:U}="@comment " @@ -221,22 +220,21 @@ patch-autoconf: @${MV} ${WRKSRC}/aclocal.m4.tmp ${WRKSRC}/aclocal.m4 patch-script-files: -.for file in ${SCRIPT_FILES} +.for filename in ${SCRIPT_FILES} @${REINPLACE_CMD} ${SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${WRKSRC}/local/${file} + ${WRKSRC}/local/${filename} .endfor patch-startup-files: -.for file in ${STARTUP_FILES} +.for filename in ${STARTUP_FILES} @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${FILESDIR}/${file}.sample > ${WRKDIR}/${file} + ${FILESDIR}/${filename}.sample > ${WRKDIR}/${filename} .endfor post-configure: @${FIND} ${WRKSRC} -name Makefile | \ ${XARGS} ${REINPLACE_CMD} -E -e '/^INSTALL[ ]+=/s|$$| -m 755|' - post-build: .if !defined(WITHOUT_PERL) ${FIND} ${WRKSRC}/perl -name Makefile | \ @@ -256,8 +254,8 @@ strip-files: @cd ${PREFIX}/sbin; ${STRIP_CMD} ${SBIN_FILES} install-startup-files: -.for file in ${STARTUP_FILES} - @${INSTALL_SCRIPT} ${WRKDIR}/${file} ${STARTUP_DIR} +.for filename in ${STARTUP_FILES} + @${INSTALL_SCRIPT} ${WRKDIR}/${filename} ${STARTUP_DIR} .endfor install-config-files: @@ -266,8 +264,8 @@ install-config-files: install-doc-files: .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} -. for file in ${DOC_FILES} - @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR} +. for filename in ${DOC_FILES} + @${INSTALL_DATA} ${WRKSRC}/${filename} ${DOCSDIR} . endfor .endif diff --git a/net-mgmt/net-snmp-devel/distinfo b/net-mgmt/net-snmp-devel/distinfo index c1099d713e3b..ebd51e9c089e 100644 --- a/net-mgmt/net-snmp-devel/distinfo +++ b/net-mgmt/net-snmp-devel/distinfo @@ -1,2 +1,2 @@ -MD5 (net-snmp-5.2.1.tar.gz) = 4c38451b1f5914789da370b79dc06124 -SIZE (net-snmp-5.2.1.tar.gz) = 3971320 +MD5 (net-snmp-5.2.1.2.tar.gz) = 34159770a7fe418d99fdd416a75358b1 +SIZE (net-snmp-5.2.1.2.tar.gz) = 3869893 diff --git a/net-mgmt/net-snmp-devel/files/patch-asn1.c b/net-mgmt/net-snmp-devel/files/patch-asn1.c index 8dc5fe0108d6..e7ec9b103f0b 100644 --- a/net-mgmt/net-snmp-devel/files/patch-asn1.c +++ b/net-mgmt/net-snmp-devel/files/patch-asn1.c @@ -1,5 +1,5 @@ ---- snmplib/asn1.c.orig.2 Sat Dec 11 00:07:16 2004 -+++ snmplib/asn1.c Thu Feb 24 23:42:30 2005 +--- snmplib/asn1.c.orig Fri Dec 10 18:07:16 2004 ++++ snmplib/asn1.c Fri Jun 10 20:09:34 2005 @@ -181,6 +181,9 @@ #include <in.h> #endif @@ -32,7 +32,14 @@ mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1)); /* * mask is 0xFF000000 on a big-endian machine -@@ -2674,6 +2685,12 @@ +@@ -2668,19 +2679,26 @@ + register long integer = *intp; + int testvalue = (*intp < 0) ? -1 : 0; + size_t start_offset = *offset; ++ int imaxbytes = 4; + + if (intsize != sizeof(long)) { + _asn_size_err(errpre, intsize, sizeof(long)); return 0; } @@ -45,7 +52,15 @@ if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) { return 0; } -@@ -2823,6 +2840,10 @@ + *(*pkt + *pkt_len - (++*offset)) = (u_char) integer; + integer >>= 8; + +- while (integer != testvalue) { ++ while (integer != testvalue && (--imaxbytes)) { + if (((*pkt_len - *offset) < 1) + && !(r && asn_realloc(pkt, pkt_len))) { + return 0; +@@ -2823,6 +2841,10 @@ if (intsize != sizeof(unsigned long)) { _asn_size_err(errpre, intsize, sizeof(unsigned long)); return 0; diff --git a/net-mgmt/net-snmp-devel/files/patch-local:fixproc b/net-mgmt/net-snmp-devel/files/patch-local:fixproc index 5d6e3515467d..4fa37283c36f 100644 --- a/net-mgmt/net-snmp-devel/files/patch-local:fixproc +++ b/net-mgmt/net-snmp-devel/files/patch-local:fixproc @@ -1,21 +1,23 @@ ---- local/fixproc.orig Sat Apr 20 09:30:13 2002 -+++ local/fixproc Sat Mar 6 01:59:59 2004 +--- local/fixproc.orig Sat Apr 20 16:30:13 2002 ++++ local/fixproc Wed Jul 13 08:53:37 2005 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!%%PERL%% # # fixproc [-min n] [-max n] [-check | -kill | -restart | -exist | -fix] proc ... # -@@ -129,7 +129,7 @@ +@@ -129,7 +129,9 @@ # # Timothy Kong 3/1995 -$database_file = '/local/etc/fixproc.conf'; ++use File::Temp qw(tempfile); ++ +$database_file = '%%PREFIX%%/etc/fixproc.conf'; $debug = 0; # specify debug level using -dN # currently defined: -d1 -@@ -155,6 +155,14 @@ +@@ -155,6 +157,14 @@ $shell_header = "#!/bin/sh\n"; $shell_end_marker = 'shell_end_marker'; @@ -30,61 +32,122 @@ &read_args(); &read_database(); # &dump_database(); # debug only -@@ -203,7 +211,9 @@ +@@ -191,20 +201,19 @@ + sub create_sh_script + { + local ($file) = pop (@_); ++ local ($fh) = pop (@_); + local ($i) = pop (@_); + +- printf (stderr "create_sh_script\n") if ($debug > 0); ++ printf (STDERR "create_sh_script\n") if ($debug > 0); + + $! = $fixproc_error; +- open (file, ">"."$file") || die "$0: cannot open $file\n"; + while ( $shell_lines[$i] ne $shell_end_marker ) + { +- printf (file "%s", $shell_lines[$i]); ++ printf ($fh "%s", $shell_lines[$i]); $i++; } - close (file); +- close (file); - system "chmod +x $file"; -+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, -+ $atime,$mtime,$ctime,$blksize,$blocks) = stat($file); -+ chmod $mode | 0111, $file; - return file; +- return file; ++ close ($fh); ++ chmod 0755, $file; } -@@ -237,8 +247,8 @@ + +@@ -212,7 +221,7 @@ + { + local ($proc) = pop(@_); + +- printf (stderr "do_fix\n") if ($debug > 0); ++ printf (STDERR "do_fix\n") if ($debug > 0); + + if ($fix{$proc} eq '') + { +@@ -230,15 +239,14 @@ + else + { + # it must be "shell", so execute the shell script defined in database ++ local ($tmpfh, $tmpfile) = tempfile("fix_XXXXXXXX", DIR => "/tmp"); + +- local ($tmpfile) = "/tmp/fix_$$"; +- +- &create_sh_script ($fix{$proc}, $tmpfile); ++ &create_sh_script ($fix{$proc}, $tmpfh, $tmpfile); # return code is number divided by 256 $error_code = (system "$tmpfile") / 256; - system "rm $tmpfile"; - return ($fix_failed_error) if ($error_code != 0); -+ unlink $tmpfile; ++ unlink($tmpfile); + return ($cannot_fix_error) if ($error_code != 0); # sleep needed here? return &do_exist ($proc); } -@@ -268,7 +278,7 @@ +@@ -249,7 +257,7 @@ + { + local ($proc) = pop(@_); + +- printf (stderr "do_check\n") if ($debug > 0); ++ printf (STDERR "do_check\n") if ($debug > 0); + + if ($check{$proc} eq '') + { +@@ -262,13 +270,13 @@ + # if not "exist", then it must be "shell", so execute the shell script + # defined in database + +- local ($tmpfile) = "/tmp/check_$$"; ++ local ($tmpfh, $tmpfile) = tempfile("check_XXXXXXXX", DIR => "/tmp"); + +- &create_sh_script ($check{$proc}, $tmpfile); ++ &create_sh_script ($fix{$proc}, $tmpfh, $tmpfile); # return code is number divided by 256 $error_code = (system "$tmpfile") / 256; - system "rm $tmpfile"; -+ unlink $tmpfile; ++ unlink($tmpfile); return ($check_failed_error) if ($error_code != 0); # check passed, continue -@@ -285,10 +295,12 @@ +@@ -281,14 +289,16 @@ + { + local ($proc) = pop(@_); + +- printf (stderr "do_exist\n") if ($debug > 0); ++ printf (STDERR "do_exist\n") if ($debug > 0); # do ps, check to see if min <= no. of processes <= max $! = $fixproc_error; - open (command, "/bin/ps -e | /bin/grep $proc | /bin/wc -l |") -+ open (command, "/bin/ps $ps_opts |") ++ open (COMMAND, "/bin/ps $ps_opts |") || die "$0: can't run ps-grep-wc command\n"; - $proc_count = <command>; - if (($proc_count < $min{$proc}) || ($proc_count > $max{$proc})) -+ @allprocs = <command>; -+ close command; ++ @allprocs = <COMMAND>; ++ close COMMAND; + @procs = grep(/$proc/, @allprocs); + if (($#procs < $min{$proc}) || ($#procs > $max{$proc})) { return $check_failed_error; } -@@ -305,41 +317,48 @@ +@@ -301,45 +311,52 @@ + local ($proc) = pop(@_); + local ($second_kill_needed); + +- printf (stderr "do_kill\n") if ($debug > 0); ++ printf (STDERR "do_kill\n") if ($debug > 0); # first try kill $! = $fixproc_error; - open (command, "/bin/ps -e | /bin/grep $proc |") -+ open (command, "/bin/ps $ps_opts |") ++ open (COMMAND, "/bin/ps $ps_opts |") || die "$0: can't run ps-grep-awk command\n"; - while (<command>) +- while (<command>) ++ while (<COMMAND>) { - # match the first field of ps -e + if /$proc/ { @@ -96,16 +159,17 @@ + kill 15, $1; + } } -+ close command; ++ close COMMAND; # if process still exist, try kill -9 sleep 2; $! = $fixproc_error; - open (command, "/bin/ps -e | /bin/grep $proc |") -+ open (command, "/bin/ps $ps_opts |") ++ open (COMMAND, "/bin/ps $ps_opts |") || die "$0: can't run ps-grep-awk command\n"; $second_kill_needed = 0; - while (<command>) +- while (<command>) ++ while (<COMMAND>) { - # match the first field of ps -e + if /$proc/ { @@ -118,21 +182,51 @@ $second_kill_needed = 1; + } } -+ close command; ++ close COMMAND; return ($no_error) if ($second_kill_needed == 0); # see if kill -9 worked sleep 2; $! = $fixproc_error; - open (command, "/bin/ps -e | /bin/grep $proc |") -+ open (command, "/bin/ps $ps_opts |") ++ open (COMMAND, "/bin/ps $ps_opts |") || die "$0: can't run ps-grep-awk command\n"; - while (<command>) +- while (<command>) ++ while (<COMMAND>) { # a process still exist, return error - return $cannot_kill_error; + return $cannot_kill_error if /$proc/; } -+ close command; ++ close COMMAND; return $no_error; # good, all dead } +@@ -349,7 +366,7 @@ + local ($proc) = pop(@_); + local ($error_code); + +- printf (stderr "do_restart\n") if ($debug > 0); ++ printf (STDERR "do_restart\n") if ($debug > 0); + + $error_code = &do_kill ($proc); + return $error_code if ($error_code != $no_error); +@@ -369,7 +386,7 @@ + local ($proc) = pop(@_); + local ($error_code); + +- printf (stderr "work_on_proc\n") if ($debug > 0); ++ printf (STDERR "work_on_proc\n") if ($debug > 0); + + if ($cmd_line_action eq '') + { +@@ -475,8 +492,8 @@ + local ($str2); + + $! = $fixproc_error; +- open (db, $database_file) || die 'cannot open database file $database_file\n'; +- while (<db>) ++ open (DB, $database_file) || die 'cannot open database file $database_file\n'; ++ while (<DB>) + { + if ((! /\S/) || (/^[ \t]*#.*$/)) + { |