OBS User unknown 2007-01-15 23:26:37 +00:00 committed by Git OBS Bridge
commit a36903d8a3
23 changed files with 2089 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

45
README.SuSE Normal file
View File

@ -0,0 +1,45 @@
Our net-snmp package was audited by Thomas Biege of the SuSE Security team
prior to the release of CERT Advisory CA-2002-03. Of course, this
is not a guarantee that future problems will not be found and does not
address flaws and insecurities inherent in software as powerful and
complex as an SNMP implementation. Because of this we recommend that
SNMP access (161/udp,162/udp) be blocked at your firewall.
There are also some important changes that have been made in this release
of our package:
o the daemon now sets a PID file in /var/run/
o logging is now done directly to /var/log/net-snmp.log instead
of sending stderr/stdout through syslog. If you don't want logging,
remove the '-l /var/log/net-snmp.log' from /etc/init.d/snmpd.
o the daemon is now started with the '-r'. This option prevents
snmpd from exiting if it doesn't have permission to read something.
This only occurs if you start snmpd on a high port as a non-root
root user.
o If you need to run snmptrapd, we've provided an example init
script in /usr/share/doc/packages/net-snmp/rc.snmptrapd. SNMP
traps should be avoided whenever possible because they are
unreliable (you should poll with snmpget instead) and snmptrapd
has been the source of many of the security problems with snmp
so please don't run this unless you are sure of what you are doing.
To install the script,
cp rc.snmptrapd /etc/init.d/snmptrapd
innserv /etc/init.d/snmptrapd
cd /usr/sbin && ln -s ../../etc/init.d/snmptrapd .
and create a configuration file named /etc/snmptrapd.conf. Then,
start the daemon with
rcsnmptrapd start
Logging is done to /var/log/net-snmptrapd.log.
o Master agentx support is enabled if you have modules in
/usr/lib/net-snmp/--the domain socket is created as
/var/run/agentx/master. You can change this to a network
interface if needed (see snmpd(1)). The snmpd init script
automatically detects and starts any sub-agents in placed into
/var/lib/net-snmp.
More documentation on the net-snmp package can be found in this directory
as well as the project's homepage: http://net-snmp.sourceforge.net/

26
net-snmp-5.1.1-pie.patch Normal file
View File

@ -0,0 +1,26 @@
Index: apps/Makefile.in
===================================================================
--- apps/Makefile.in.orig
+++ apps/Makefile.in
@@ -111,7 +111,7 @@
$(LINK) -o $@ snmptest.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS}
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
- $(LINK) -o $@ $(TRAPD_OBJECTS) $(INSTALLLIBS) $(LOCAL_LIBS) ${LDFLAGS} ${TRAPLIBS}
+ $(LINK) -o $@ -pie $(TRAPD_OBJECTS) $(INSTALLLIBS) $(LOCAL_LIBS) ${LDFLAGS} ${TRAPLIBS}
snmptrap$(EXEEXT): snmptrap.$(OSUFFIX) $(USELIBS)
$(LINK) -o $@ snmptrap.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS}
Index: agent/Makefile.in
===================================================================
--- agent/Makefile.in.orig
+++ agent/Makefile.in
@@ -129,7 +129,7 @@
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(HELPERLIB) $(LIBTARG) ${INSTALLLIBS}
- $(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} $(LOCAL_LIBS) ${LDFLAGS} ${OUR_AGENT_LIBS}
+ $(LINK) $(CFLAGS) -o $@ -pie ${LAGENTOBJS} $(LOCAL_LIBS) ${LDFLAGS} ${OUR_AGENT_LIBS}
libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS}

View File

@ -0,0 +1,20 @@
--- snmplib/mib.c.xx 2005-02-02 21:14:34.167265497 +0100
+++ snmplib/mib.c 2005-02-02 21:15:40.937887906 +0100
@@ -1521,7 +1521,7 @@
return 0;
}
} else {
- sprintf(tmp, "%lu", *var->val.integer);
+ sprintf(tmp, "%u", (unsigned int)(*var->val.integer & 0xffffffff));
if (!snmp_strcat
(buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) {
return 0;
@@ -1585,7 +1585,7 @@
return 0;
}
}
- sprintf(tmp, "%lu", *var->val.integer);
+ sprintf(tmp, "%u", (unsigned int)(*var->val.integer & 0xffffffff));
if (!snmp_strcat
(buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) {
return 0;

View File

@ -0,0 +1,13 @@
Index: agent/mibgroup/agentx/protocol.h
===================================================================
--- agent/mibgroup/agentx/protocol.h.orig
+++ agent/mibgroup/agentx/protocol.h
@@ -13,7 +13,7 @@ extern "C" {
#define AGENTX_PORT 705
#ifndef NETSNMP_AGENTX_SOCKET
-#define NETSNMP_AGENTX_SOCKET "/var/agentx/master"
+#define NETSNMP_AGENTX_SOCKET "/var/run/agentx/master"
#endif
/*

View File

@ -0,0 +1,95 @@
--- testing/rfc1213/snmpfun.sh
+++ testing/rfc1213/snmpfun.sh
@@ -1,4 +1,3 @@
-
# functions used by RFC-1213 MIB test modules
myport=$SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT
@@ -11,6 +10,23 @@
TEST_AUTHPRIV_PARMS="-l authNoPriv -a MD5 -A testpass"
fi
+check_skip_arp_tests ()
+{
+ #
+ # skip all tests relying on a filed arp table. e.g. on s390 boxes this
+ # does not have to be the case
+ #
+ TABLE_ENTRIES="at.atTable ip.ipNetToMediaTable"
+ ARP_COUNT=`/sbin/arp | grep -v incomplete | wc -l`
+ for entry in $TABLE_ENTRIES ; do
+ if [ "x$1" == "x$entry" -a $ARP_COUNT == 0 ] ; then
+ echo "skipping $1, because the arp table is empty." >&2
+ return 0
+ fi
+ done
+ return 1
+}
+
config()
{
rm -f $SNMP_CONFIG_FILE
@@ -54,25 +70,35 @@
get_snmp_table()
{
test_start "Access table $2 by SNMPv$1..."
- CAPTURE "snmpgetnext -Of -v $1 -c test $myport $2"
- CHECKFILE '' "\.$2\."
- if [ "$snmp_last_test_result" = 0 ] ; then
- test_finish FAIL
+ check_skip_arp_tests
+ if check_skip_arp_tests "$2" ; then
+ test_finish SKIPPED
else
- test_finish PASS
+ CAPTURE "snmpgetnext -Of -v $1 -c test $myport $2"
+ CHECKFILE '' "\.$2\."
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
fi
}
get_snmpv3_table()
{
- test_start "Access table $2 by SNMPv3..."
- CAPTURE "snmpgetnext -Of -v 3 -u testrwuser $TEST_AUTHPRIV_PARMS $myport $2"
- CHECKFILE '' "\.$2\."
- if [ "$snmp_last_test_result" = 0 ] ; then
- test_finish FAIL
+ test_start "Access table $2 by SNMPv3..."
+ if check_skip_arp_tests "$2" ; then
+ test_finish SKIPPED
else
- test_finish PASS
+ CAPTURE "snmpgetnext -Of -v 3 -u testrwuser $TEST_AUTHPRIV_PARMS $myport $2"
+ CHECKFILE '' "\.$2\."
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
fi
}
+
--- testing/rfc1213/test_fun
+++ testing/rfc1213/test_fun
@@ -51,6 +51,9 @@
if [ x$1 == x"PASS" ];then
pass_num=`expr $pass_num + 1`
pass_info "PASS\n"
+ elif [ x$1 == x"SKIPPED" ];then
+ pass_num=`expr $pass_num + 1`
+ pass_info "SKIPPED\n"
else
fail_num=`expr $fail_num + 1`
fail_info "FAIL\n"
@@ -66,3 +69,4 @@
fi
}
+

222
net-snmp-5.3.0.1-audit.diff Normal file
View File

@ -0,0 +1,222 @@
Index: agent/mibgroup/examples/ucdDemoPublic.c
===================================================================
--- agent/mibgroup/examples/ucdDemoPublic.c.orig
+++ agent/mibgroup/examples/ucdDemoPublic.c
@@ -219,7 +219,11 @@ write_ucdDemoPublicString(int action,
}
if (action == COMMIT) {
if (var_val_len != 0) {
- strcpy(publicString, var_val);
+ strncpy(publicString, var_val, sizeof(publicString)-1);
+ /* XXX thomas: just some sanity checks */
+ if(strlen(var_val) > sizeof(publicString)-1 || strlen(var_val) != var_val_len)
+ publicString[sizeof(publicString)-1] = '\0';
+ else
publicString[var_val_len] = '\0';
} else
publicString[0] = '\0';
Index: agent/mibgroup/mibII/system_mib.c
===================================================================
--- agent/mibgroup/mibII/system_mib.c.orig
+++ agent/mibgroup/mibII/system_mib.c
@@ -126,7 +126,7 @@ system_parse_config_sysloc(const char *t
char tmpbuf[1024];
if (strlen(cptr) >= sizeof(sysLocation)) {
- snprintf(tmpbuf, 1024,
+ snprintf(tmpbuf, sizeof(tmpbuf),
"syslocation token too long (must be < %lu):\n\t%s",
(unsigned long)sizeof(sysLocation), cptr);
config_perror(tmpbuf);
@@ -173,7 +173,7 @@ system_parse_config_syscon(const char *t
char tmpbuf[1024];
if (strlen(cptr) >= sizeof(sysContact)) {
- snprintf(tmpbuf, 1024,
+ snprintf(tmpbuf, sizeof(tmpbuf),
"syscontact token too long (must be < %lu):\n\t%s",
(unsigned long)sizeof(sysContact), cptr);
config_perror(tmpbuf);
@@ -220,7 +220,7 @@ system_parse_config_sysname(const char *
char tmpbuf[1024];
if (strlen(cptr) >= sizeof(sysName)) {
- snprintf(tmpbuf, 1024,
+ snprintf(tmpbuf, sizeof(tmpbuf),
"sysname token too long (must be < %lu):\n\t%s",
(unsigned long)sizeof(sysName), cptr);
config_perror(tmpbuf);
Index: agent/mibgroup/mibII/var_route.c
===================================================================
--- agent/mibgroup/mibII/var_route.c.orig
+++ agent/mibgroup/mibII/var_route.c
@@ -1378,7 +1378,7 @@ Route_Scan_Reload(void)
/*
* Sort it!
*/
- qsort((char *) rthead, rtsize, sizeof(rthead[0]), qsort_compare);
+ qsort((char *) rthead, rtsize, sizeof(rthead[0]), (int (*) (const void*, const void*)) qsort_compare);
}
#endif
#endif
Index: agent/mibgroup/util_funcs.c
===================================================================
--- agent/mibgroup/util_funcs.c.orig
+++ agent/mibgroup/util_funcs.c
@@ -139,6 +139,10 @@ make_tempfile(void)
}
#endif
if (fd >= 0) {
+ if(fchmod(fd, 0600) != 0) {
+ close(fd);
+ return NULL;
+ }
close(fd);
DEBUGMSGTL(("make_tempfile", "temp file created: %s\n", name));
return name;
Index: agent/auto_nlist.c
===================================================================
--- agent/auto_nlist.c.orig
+++ agent/auto_nlist.c
@@ -64,6 +64,7 @@ auto_nlist_value(const char *string)
it->nl[0].n_name = (char *) malloc(strlen(string) + 2);
#if defined(aix4) || defined(aix5)
strcpy(it->nl[0].n_name, string);
+ it->nl[0].n_name[strlen(string)+1] = '\0';
#else
sprintf(it->nl[0].n_name, "_%s", string);
#endif
@@ -72,6 +73,7 @@ auto_nlist_value(const char *string)
#if !(defined(aix4) || defined(aix5))
if (it->nl[0].n_type == 0) {
strcpy(it->nl[0].n_name, string);
+ it->nl[0].n_name[strlen(string)+1] = '\0';
init_nlist(it->nl);
}
#endif
Index: apps/snmptest.c
===================================================================
--- apps/snmptest.c.orig
+++ apps/snmptest.c
@@ -456,6 +456,7 @@ input_variable(netsnmp_variable_list * v
goto getValue;
}
memcpy(vp->val.string, buf, strlen(buf) - 1);
+ vp->val.string[sizeof(vp->val.string)-1] = 0;
vp->val_len = strlen(buf) - 1;
} else if (ch == 'x') {
size_t buf_len = 256;
Index: apps/snmptrapd_handlers.c
===================================================================
--- apps/snmptrapd_handlers.c.orig
+++ apps/snmptrapd_handlers.c
@@ -24,6 +24,9 @@
#include <sys/wait.h>
#endif
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include <net-snmp/config_api.h>
#include <net-snmp/output_api.h>
#include <net-snmp/mib_api.h>
@@ -840,10 +843,11 @@ do_external(char *cmd, struct hostent *h
#else
char command_buf[128];
char file_buf[L_tmpnam];
+ int win_fd;
tmpnam(file_buf);
- file = fopen(file_buf, "w");
- if (!file) {
+ win_fd = open(file_buf, O_RDWR | O_CREAT | O_EXCL, 0600);
+ if (win_fd < 0 || (file = fdopen(win_fd, "w")) == NULL)
fprintf(stderr, "fopen: %s: %s\n", file_buf, strerror(errno));
} else {
send_handler_data(file, host, pdu, transport);
Index: snmplib/parse.c
===================================================================
--- snmplib/parse.c.orig
+++ snmplib/parse.c
@@ -4187,7 +4187,7 @@ static struct node *
parse(FILE * fp, struct node *root)
{
char token[MAXTOKEN];
- char name[MAXTOKEN];
+ char name[MAXTOKEN+1];
int type = LABEL;
int lasttype = LABEL;
@@ -4279,7 +4279,8 @@ parse(FILE * fp, struct node *root)
case ENDOFFILE:
continue;
default:
- strcpy(name, token);
+ strncpy(name, token, sizeof(name));
+ name[sizeof(name)-1] = '\0';
type = get_token(fp, token, MAXTOKEN);
nnp = NULL;
if (type == MACRO) {
@@ -4296,7 +4297,8 @@ parse(FILE * fp, struct node *root)
print_error(name, "is a reserved word", lasttype);
continue; /* see if we can parse the rest of the file */
}
- strcpy(name, token);
+ strncpy(name, token, sizeof(name));
+ name[sizeof(name)-1] = '\0';
type = get_token(fp, token, MAXTOKEN);
nnp = NULL;
Index: snmplib/tools.c
===================================================================
--- snmplib/tools.c.orig
+++ snmplib/tools.c
@@ -695,7 +695,7 @@ dump_snmpEngineID(const u_char * estring
/*
* s += snprintf(s, remaining_len+3, "\"%s\"", esp);
*/
- s += sprintf(s, "\"%s\"", esp);
+ s += sprintf(s, "\"%.*s\"", sizeof(buf)-strlen(buf)-3, esp);
goto dump_snmpEngineID_quit;
break;
/*NOTREACHED*/ case 5: /* Octets. */
Index: testing/TESTCONF.sh
===================================================================
--- testing/TESTCONF.sh.orig
+++ testing/TESTCONF.sh
@@ -77,8 +77,8 @@ if [ "x$SNMP_TMPDIR" = "x" -a "x$SNMP_HE
fi
SNMP_TMP_PERSISTENTDIR=$SNMP_TMPDIR/persist
export SNMP_TMP_PERSISTENTDIR
- mkdir $SNMP_TMPDIR
- mkdir $SNMP_TMP_PERSISTENTDIR
+ mkdir -m 0700 $SNMP_TMPDIR
+ mkdir -m 0700 $SNMP_TMP_PERSISTENTDIR
fi
if [ "x$SNMP_SAVE_TMPDIR" = "x" ]; then
Index: testing/eval_suite.sh
===================================================================
--- testing/eval_suite.sh.orig
+++ testing/eval_suite.sh
@@ -79,7 +79,11 @@ exit 0
PROGRAM=
ARGUMENTS="$*"
-TMPFILE=/tmp/eval_suite.sh$$
+umask 0077 # just to be on the save side
+TMPDIR=/tmp/ucd-snmpd-eval-dir.$$
+/bin/rm -rf $TMPDIR
+/bin/mkdir -m 0700 $TMPDIR || exit -1
+TMPFILE=$TMPDIR/eval_suite.sh$$
TESTLISTFILE=eval_testlist
@@ -205,6 +209,7 @@ done # endwhile
# Cleanup, exit.
#
rm -f $TMPFILE
+rm -rf $TMPDIR
exit $TESTFAILURE

View File

@ -0,0 +1,13 @@
Index: Makefile.in
===================================================================
--- Makefile.in.orig
+++ Makefile.in
@@ -167,7 +167,7 @@
fi
perlinstall:
- @(cd perl ; $(MAKE) install) ; \
+ @(cd perl ; $(MAKE) install_vendor) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi

View File

@ -0,0 +1,40 @@
Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -1037,7 +1037,7 @@
# system check
-AC_CANONICAL_TARGET
+AC_CANONICAL_TARGET([])
changequote(, )
PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
if test "x$PARTIALTARGETOS" = "xmingw32msvc"; then
@@ -2332,8 +2332,6 @@
[
AC_MSG_RESULT([no])
# Linux RedHat 6.1 won't link libwrap without libnsl
- AC_CHECK_FUNC(yp_get_default_domain, ,
- AC_CHECK_LIB(nsl, yp_get_default_domain))
AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl])
AC_TRY_LINK([#include <sys/types.h>
#include <tcpd.h>
@@ -3754,7 +3752,7 @@
# we need to have a local variable `hz' in scope and set to a useful
# value whenever we use one of these constants.
#
-AC_CACHE_CHECK(whether TCP timers depend on \`hz',ac_cv_TCPTV_NEEDS_HZ,
+AC_CACHE_CHECK(whether TCP timers depend on hz,ac_cv_TCPTV_NEEDS_HZ,
[AC_EGREP_CPP(hz,
[#include <netinet/tcp_timer.h>
TCPTV_SRTTDFLT
@@ -3808,7 +3806,7 @@
ME=`$WHOAMI`
if test -f /etc/resolv.conf; then
- LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
+ LOC=`cat /etc/resolv.conf | grep '^domain' | tail -n 1 | awk '{print $NF}'`
else
LOC="@no.where"
fi

View File

@ -0,0 +1,15 @@
Index: agent/mibgroup/ucd-snmp/versioninfo.c
===================================================================
--- agent/mibgroup/ucd-snmp/versioninfo.c.orig
+++ agent/mibgroup/ucd-snmp/versioninfo.c
@@ -130,8 +130,8 @@ var_extensible_version(struct variable *
case VERCONFIG:
#ifdef NETSNMP_CONFIGURE_OPTIONS
*var_len = strlen(config_opts);
- if (*var_len > 1024)
- *var_len = 1024; /* mib imposed restriction */
+ if (*var_len > 300)
+ *var_len = 300; /* mib imposed restriction */
return (u_char *) config_opts;
#else
sprintf(errmsg, "");

3
net-snmp-5.4.rc2.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d9acf6b85f7b6fd38c3bd11e449a4857b85f61b18b5953250d71691a0657b7cf
size 3613485

View File

@ -0,0 +1,186 @@
Index: perl/SNMP/SNMP.xs
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/perl/SNMP/SNMP.xs,v
retrieving revision 5.69
diff -u -p -r5.69 SNMP.xs
--- perl/SNMP/SNMP.xs 25 Oct 2006 16:16:24 -0000 5.69
+++ perl/SNMP/SNMP.xs 12 Nov 2006 13:40:28 -0000
@@ -117,16 +117,16 @@ static int __snprint_value _((char *, si
netsnmp_variable_list*, struct tree *,
int, int));
static int __sprint_num_objid _((char *, oid *, int));
-static int __scan_num_objid _((char *, oid *, int *));
+static int __scan_num_objid _((char *, oid *, size_t *));
static int __get_type_str _((int, char *));
static int __get_label_iid _((char *, char **, char **, int));
-static int __oid_cmp _((oid *, int, oid *, int));
+static int __oid_cmp _((oid *, size_t, oid *, size_t));
static int __tp_sprint_num_objid _((char*,SnmpMibNode *));
static SnmpMibNode * __get_next_mib_node _((SnmpMibNode *));
static struct tree * __oid2tp _((oid*, int, struct tree *, int*));
-static struct tree * __tag2oid _((char *, char *, oid *, int *, int *, int));
-static int __concat_oid_str _((oid *, int *, char *));
-static int __add_var_val_str _((netsnmp_pdu *, oid *, int, char *,
+static struct tree * __tag2oid _((char *, char *, oid *, size_t *, int *, int));
+static int __concat_oid_str _((oid *, size_t *, char *));
+static int __add_var_val_str _((netsnmp_pdu *, oid *, size_t, char *,
int, int));
static int __send_sync_pdu _((netsnmp_session *, netsnmp_pdu *,
netsnmp_pdu **, int , SV *, SV *, SV *));
@@ -149,8 +149,8 @@ typedef struct bulktbl {
oid req_oid[MAX_OID_LEN]; /* The OID originally requested. */
oid last_oid[MAX_OID_LEN]; /* Last-seen OID under this branch. */
AV *vars; /* Array of Varbinds for this OID. */
- int req_len; /* Length of requested OID. */
- int last_len; /* Length of last-seen OID. */
+ size_t req_len; /* Length of requested OID. */
+ size_t last_len; /* Length of last-seen OID. */
char norepeat; /* Is this a non-repeater OID? */
char complete; /* Non-zero if this tree complete. */
char ignore; /* Ignore this OID, not requested. */
@@ -585,7 +585,7 @@ static int
__scan_num_objid (buf, objid, len)
char *buf;
oid *objid;
-int *len;
+size_t *len;
{
char *cp;
*len = 0;
@@ -798,9 +798,9 @@ int flag;
static int
__oid_cmp(oida_arr, oida_arr_len, oidb_arr, oidb_arr_len)
oid *oida_arr;
-int oida_arr_len;
+size_t oida_arr_len;
oid *oidb_arr;
-int oidb_arr_len;
+size_t oidb_arr_len;
{
for (;oida_arr_len && oidb_arr_len;
oida_arr++, oida_arr_len--, oidb_arr++, oidb_arr_len--) {
@@ -876,14 +876,14 @@ __tag2oid(tag, iid, oid_arr, oid_arr_len
char * tag;
char * iid;
oid * oid_arr;
-int * oid_arr_len;
+size_t * oid_arr_len;
int * type;
int best_guess;
{
struct tree *tp = NULL;
struct tree *rtp = NULL;
oid newname[MAX_OID_LEN], *op;
- int newname_len = 0;
+ size_t newname_len = 0;
const char *cp = NULL;
char *module = NULL;
@@ -1024,7 +1024,7 @@ found:
static int
__concat_oid_str(doid_arr, doid_arr_len, soid_str)
oid *doid_arr;
-int *doid_arr_len;
+size_t *doid_arr_len;
char * soid_str;
{
char soid_buf[STR_BUF_SIZE];
@@ -1050,7 +1050,7 @@ static int
__add_var_val_str(pdu, name, name_length, val, len, type)
netsnmp_pdu *pdu;
oid *name;
- int name_length;
+ size_t name_length;
char * val;
int len;
int type;
@@ -2202,7 +2202,7 @@ _bulkwalk_recv_pdu(walk_context *context
** assume that we've walked past the end of the subtree. Set this
** subtree to be completed, and go on to the next variable.
*/
- if (((int)vars->name_length < expect->req_len) ||
+ if ((vars->name_length < expect->req_len) ||
(memcmp(vars->name, expect->req_oid, expect->req_len*sizeof(oid))))
{
DBPRT(2,(DBOUT " walked off branch - marking subtree as complete.\n"));
@@ -3041,7 +3041,7 @@ snmp_set(sess_ref, varlist_ref, perl_cal
netsnmp_pdu *pdu, *response;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
char *tag_pv;
snmp_xs_cb_data *xs_cb_data;
SV **sess_ptr_sv;
@@ -3242,7 +3242,7 @@ snmp_get(sess_ref, retry_nosuch, varlist
struct tree *tp;
int len;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV *tmp_sv;
int type;
char tmp_type_str[MAX_TYPE_NAME_LEN];
@@ -3460,7 +3460,7 @@ snmp_getnext(sess_ref, varlist_ref, perl
struct tree *tp;
int len;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV *tmp_sv;
int type;
char tmp_type_str[MAX_TYPE_NAME_LEN];
@@ -3704,7 +3704,7 @@ snmp_getbulk(sess_ref, nonrepeaters, max
struct tree *tp;
int len;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV *tmp_sv;
int type;
char tmp_type_str[MAX_TYPE_NAME_LEN];
@@ -3932,7 +3932,7 @@ snmp_bulkwalk(sess_ref, nonrepeaters, ma
netsnmp_session *ss;
netsnmp_pdu *pdu = NULL;
oid oid_arr[MAX_OID_LEN];
- int oid_arr_len;
+ size_t oid_arr_len;
SV **sess_ptr_sv;
SV **err_str_svp;
SV **err_num_svp;
@@ -4243,7 +4243,7 @@ snmp_trapV1(sess_ref,enterprise,agent,ge
netsnmp_pdu *pdu = NULL;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV **sess_ptr_sv;
SV **err_str_svp;
SV **err_num_svp;
@@ -4382,7 +4382,7 @@ snmp_trapV2(sess_ref,uptime,trap_oid,var
netsnmp_pdu *pdu = NULL;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV **sess_ptr_sv;
SV **err_str_svp;
SV **err_num_svp;
@@ -4519,7 +4519,7 @@ snmp_inform(sess_ref,uptime,trap_oid,var
netsnmp_pdu *response;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
snmp_xs_cb_data *xs_cb_data;
SV **sess_ptr_sv;
SV **err_str_svp;
@@ -4750,7 +4750,7 @@ snmp_translate_obj(var,mode,use_long,aut
char str_buf[STR_BUF_SIZE];
char str_buf_temp[STR_BUF_SIZE];
oid oid_arr[MAX_OID_LEN];
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
char * label;
char * iid;
int status = FAILURE;

View File

@ -0,0 +1,86 @@
Index: net-snmp-config.in
===================================================================
--- net-snmp-config.in.orig
+++ net-snmp-config.in
@@ -27,6 +27,14 @@ check_build_dir()
fi
}
+check_devel_files()
+{
+ if [ ! -e "${NSC_INCDIR}/net-snmp/net-snmp-config.h" ] ; then
+ echo "Can not find \"${NSC_INCDIR}/net-snmp/net-snmp-config.h\". The net-snmp development files seems to be missing. Exiting" >&2
+ # exit 2
+ fi
+}
+
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
@@ -104,9 +112,11 @@ else
;;
#################################################### compile
--base-cflags)
+ check_devel_files
echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR}
;;
--cflags|--cf*)
+ check_devel_files
echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR}
;;
--srcdir)
@@ -117,6 +127,7 @@ else
echo $NSC_LIBDIR
;;
--ldflags|--ld*)
+ check_devel_files
echo $NSC_LDFLAGS
;;
--build-lib-dirs)
@@ -150,30 +161,38 @@ else
;;
#################################################### client lib
--libs)
+ check_devel_files
# use this one == --netsnmp-libs + --external-libs
echo $NSC_LDFLAGS $NSC_LIBDIR -lnetsnmp $NSC_LIBS
;;
--netsnmp-libs)
+ check_devel_files
echo $NSC_LIBDIR -lnetsnmp
;;
--external-libs)
+ check_devel_files
echo $NSC_LDFLAGS $NSC_LIBS
;;
#################################################### agent lib
--base-agent-libs)
+ check_devel_files
echo $NSC_BASE_AGENT_LIBS
;;
--base-subagent-libs)
+ check_devel_files
echo $NSC_BASE_SUBAGENT_LIBS
;;
--agent-libs)
+ check_devel_files
# use this one == --netsnmp-agent-libs + --external-libs
echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_BASE_AGENT_LIBS $NSC_AGENTLIBS
;;
--netsnmp-agent-libs)
+ check_devel_files
echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS
;;
--external-agent-libs)
+ check_devel_files
echo $NSC_LDFLAGS $NSC_AGENTLIBS
;;
####################################################
@@ -314,6 +333,7 @@ else
####################################################
--compile-subagent)
+ check_devel_files
shift
while test "x$done" = "x" -a "x$1" != "x" ; do
case $1 in

420
net-snmp.changes Normal file
View File

@ -0,0 +1,420 @@
-------------------------------------------------------------------
Mon Nov 13 16:04:58 CET 2006 - mrueckert@suse.de
- update to 5.4.rc2:
tons of bugfixes, and new features. just to name a few:
- enabled embedded perl
- new MIB table to manage net-snmp access control extensions
- hal to abstract os specific aspects of the systems
- tree matching support for snmptrapd
- reworked transport creation in snmplib
- using the incoming ip for outgoing packets if possible.
- ipv6 aware tcp/udp mibs
- removed patches:
(all of them are either upstream or obsolete)
net-snmp-5.2.1-acinclude.diff
net-snmp-5.2.1-acquotation.patch
net-snmp-5.2.1-compat.patch
net-snmp-5.2.1-localperl.diff
net-snmp-5.2.1-perl.diff
net-snmp-5.3.0.1-64bit.diff
net-snmp-5.3.0.1_agentx_socket_path_doc.patch
net-snmp-5.3.0.1_deprecated_sysctl_retrans_time.patch
net-snmp-5.3.0.1_disman_mib_crash.patch
net-snmp-5.3.0.1_ethtool.patch
net-snmp-5.3.0.1_linux_types_header.patch
net-snmp-5.3.0.1_missing_ifNumber.patch
net-snmp-5.3.0.1_netsnmp_register_mib_crash.patch
net-snmp-5.3.0.1_perl_ld_run_path.patch
net-snmp-5.3.0.1_sighup_vacm.patch
net-snmp-5.3.0.1-smux-trap.diff
net-snmp-5.3.0.1.tar.bz2
net-snmp-5.3.0.1_tcpwrapper_log_severity.patch
net-snmp-5.3.0.1_testsuite_no_smux.patch
net-snmp-5.3.0.1_tunnel_compilation.patch
net-snmp-5.3_perl_agent.xs-pointersize.patch
net-snmp-5.3_perl-printf.patch
net-snmp-5.4_default_store_return_value.patch
oid-names2_5.3.patch
- added net-snmp-5.4_net-snmp-config_headercheck.patch:
warn if net-snmp-config is used but development files are missing.
- updated net-snmp-5.2.1-autoconf.diff to apply cleanly against 5.4
new name: net-snmp-5.4.rc1-autoconf.diff
- updated net-snmp-5.2.1-versinfo.diff to apply cleanly against 5.4
new name: net-snmp-5.4.rc2-versinfo.diff
- added net-snmp-5.4.rc2_perl_SNMP_size_t.patch:
dont use int if you want size_t. fixes failures in the perl test
suite.
-------------------------------------------------------------------
Thu Oct 19 17:25:58 CEST 2006 - mrueckert@suse.de
- added net-snmp-5.4_default_store_return_value.patch:
backport my patch from 5.4 so we can get rid of the build errors.
the patch removes/disables dead code.
-------------------------------------------------------------------
Fri Aug 4 02:34:14 CEST 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_perl_ld_run_path.patch:
the old perl replacement line broke linking of the SNMP libraries
into the perl modules. the patch sets the LD_RUN_PATH for the
build process to LIBDIR. (#180888)
-------------------------------------------------------------------
Thu May 4 17:05:26 CEST 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_sighup_vacm.patch:
The snmp agent was broken on SIGHUP. It lost all its MIB
informations. (upstream bug: #1473289)
- added net-snmp-5.3.0.1_deprecated_sysctl_retrans_time.patch:
The snmpd used a deprecated sysctl to get the retransmit time
from the kernel. We didnt use this module but the mib library
triggered the sysctl. The patch uses retrans_time_ms when
available and corrects the correction factor for the old sysctl.
(bug: #170140, upstream: #1437287)
- reenabled the lmsensors support. was disabled for testing and
never reenabled.
-------------------------------------------------------------------
Thu Apr 20 16:47:31 CEST 2006 - mrueckert@suse.de
- net-snmp-5.3.0.1_missing_ifNumber.patch:
The 5.3 agent on Linux systems did not implement the 'ifNumber'
MIB object. (#159501)
-------------------------------------------------------------------
Wed Apr 19 14:33:10 CEST 2006 - mrueckert@suse.de
- logrotate does not like if the postrotate script returns with
a non zero returncode.
- add missing "-e" in echo line
-------------------------------------------------------------------
Mon Apr 3 17:51:21 CEST 2006 - mrueckert@suse.de
- dont call "/etc/init.d/snmpd restart". this could start the
daemon unconditionally (too large log file).
switched to "/etc/init.d/snmpd try-restart"
-------------------------------------------------------------------
Mon Apr 3 14:51:39 CEST 2006 - mrueckert@suse.de
- run logrotate on startup if the logfile is too large. (#131072)
-------------------------------------------------------------------
Tue Mar 28 14:16:34 CEST 2006 - mrueckert@suse.de
- fix compilation with ethtool support. (#155709)
- added option to ignore accepted connections (#86634)
net-snmp-5.3.0.1_tcpwrapper_log_severity.patch
new sysconfig option: SNMPD_LOG_SUCCESSFUL_CONNECTIONS
- pass the correct path to configure to set the desired log file
- make smux listen to localhost by default. (#116742)
- remove confpath patch. (#147808,#159768)
-------------------------------------------------------------------
Mon Mar 27 15:30:26 CEST 2006 - mrueckert@suse.de
- updated and reenabled the audit patch
-------------------------------------------------------------------
Fri Mar 17 20:02:35 CET 2006 - mrueckert@suse.de
- ported sysconfig options from sles9
SNMPD_LOGLEVEL -> SPECIFY the log level for the snmpd
SNMPD_USE_SMUX -> disable SMUX socket
-------------------------------------------------------------------
Fri Mar 10 00:20:11 CET 2006 - mrueckert@suse.de
- disable embedded perl for now.
-------------------------------------------------------------------
Wed Mar 8 05:17:49 CET 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_agentx_socket_path_doc.patch:
fixes: net-snmp snmpd.conf(5) manpage gives wrong default
for AgentXSocket (#129437)
- ported fix for bug #129923 from sles9
- suppress the error message in the ucd-snmp upgrade script
-------------------------------------------------------------------
Wed Feb 22 18:45:23 CET 2006 - mrueckert@suse.de
- we move the configs into /etc/snmp [#77935]
- removed debugging packages from the build requires.
-------------------------------------------------------------------
Thu Feb 16 16:03:38 CET 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1-smux-trap.diff
dont loose the value of string variables via smux traps [#150091]
-------------------------------------------------------------------
Fri Feb 3 16:39:21 CET 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_disman_mib_crash.patch
o fixes a crash in the disman mib loading
- net-snmp-5.3.0.1_netsnmp_register_mib_crash.patch
o dont crash while registering mibs
- net-snmp-5.3_perl_agent.xs-pointersize.patch
o dont use int if you mean intptr_t(IV)
- net-snmp-5.3_perl-printf.patch
o unused format specifier in printf
- net-snmp-5.3_vendorperl.patch
o do make install_vendor
-------------------------------------------------------------------
Wed Jan 25 21:43:27 CET 2006 - mrueckert@suse.de
- removed net-snmp-5.2.1-cmdline.diff
better solution from upstream
-------------------------------------------------------------------
Wed Jan 25 21:38:36 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Mon Jan 23 00:50:55 CET 2006 - mrueckert@suse.de
- update to version 5.3.0.1
- removed patches that got applied upstream or superseeded by
upstream fixes:
net-snmp-5.2.1-uptime.diff
net-snmp-5.2.1-typeclash.diff
net-snmp-5.2.1-gcc.diff
net-snmp-5.2.1-dlopen-conf.diff
net-snmp-5.2.1-enomedium.diff
net-snmp-5.2.1-mktemp.diff
net-snmp-5.2.1-close-all-fds.diff
net-snmp-5.2.1-more-cpus.diff
net-snmp-5.2.1-nowraplibs.patch
net-snmp-5.2.1.set-var-value.patch
- added 4 new patches:
net-snmp-5.3_perl_agent.xs-pointersize.patch
- fixes some casts of pointers to ints -> segfaults in the test
suite
net-snmp-5.3_perl-printf.patch
- fixes a printf warning
net-snmp-5.3_vendorperl.patch
- call perl modules install with install_vendor
net-snmp-5.1.1-pie.patch
- build snmpd and snmptrapd with pie
-------------------------------------------------------------------
Tue Nov 15 17:12:53 CET 2005 - uli@suse.de
- no point in running the test suite in QEMU
-------------------------------------------------------------------
Wed Sep 7 13:53:40 CEST 2005 - mrueckert@suse.de
- Added rpm-devel to the requires of the -devel package
-------------------------------------------------------------------
Fri Jun 17 17:46:41 CEST 2005 - mrueckert@suse.de
- added disman/event-mib to the mib list (Bug #91039)
- replaced patch25 (asn1 handling fix) with patch from the upstream.
(Bug #73804)
- build snmpd and snmptrap with with -fpie/-pie
-------------------------------------------------------------------
Fri Jun 10 11:43:48 CEST 2005 - mrueckert@suse.de
- Fixed test suite for boxes with empty arp tables.
-------------------------------------------------------------------
Tue May 17 12:52:00 CEST 2005 - hvogel@suse.de
- Include the right header for compat mode (Bug #64074)
- Fix length for type ASN_UNSIGNED (Bug #73804)
- Get rid of WRAPLIBS in net-snmp-config (Bug #75879)
- Fix ac quotation
-------------------------------------------------------------------
Tue Feb 22 14:28:17 CET 2005 - meissner@suse.de
- moved tkmib and mib2c* to perl subpackage, since
they require it. #63992
-------------------------------------------------------------------
Wed Feb 16 18:28:44 CET 2005 - meissner@suse.de
- Multiple non Intel CPU detection added.
-------------------------------------------------------------------
Sun Feb 6 18:50:48 CET 2005 - meissner@suse.de
- Upgraded to 5.1.2 release. (lots of bugfixes as usual)
-------------------------------------------------------------------
Wed Feb 2 22:06:33 CET 2005 - meissner@suse.de
- overflow counter32 and gauge32 on 64bit systems correctly. #50384
-------------------------------------------------------------------
Fri Nov 26 11:23:58 CET 2004 - meissner@suse.de
- close all non standard filedescriptors on start.
-------------------------------------------------------------------
Thu Nov 25 12:01:56 CET 2004 - meissner@suse.de
- Upgraded to 5.2 final.
-------------------------------------------------------------------
Mon Oct 25 17:16:58 CEST 2004 - meissner@suse.de
- Upgraded to 5.2.1rc2. Dropped merged patches, rediffed
old ones.
-------------------------------------------------------------------
Tue Aug 17 14:28:42 CEST 2004 - coolo@suse.de
- fixing pre-requires
-------------------------------------------------------------------
Thu Aug 12 17:40:53 CEST 2004 - meissner@suse.de
- Upgrade to 5.1.2 final.
-------------------------------------------------------------------
Thu Jul 29 15:29:32 CEST 2004 - meissner@suse.de
- Upgraded to upstream 5.1.2.rc2.
-------------------------------------------------------------------
Fri Jul 23 13:03:17 CEST 2004 - meissner@suse.de
- Upgraded to 5.1.2.rc1.
- Dropped some old patches / parts of old patches.
- Fixed problem on little endian 64bit machines.
-------------------------------------------------------------------
Thu Jul 15 14:45:08 CEST 2004 - meissner@suse.de
- removed double free on failure in netsnmp_register_old_api().
(bug #42580)
- do not specify -c /etc/snmpd.conf (since it is already built in).
(bug #41706)
- require openssl-devel in -devel package.
-------------------------------------------------------------------
Tue Jul 6 16:15:23 CEST 2004 - meissner@suse.de
- replaced undefined C construct (x[n] = y[n++]) which caused the
testsuite to fail on i386.
-------------------------------------------------------------------
Mon Jul 5 11:45:35 CEST 2004 - uli@suse.de
- sleep .3 s before starting agents (bug #42588)
-------------------------------------------------------------------
Wed Jun 30 09:42:51 CEST 2004 - meissner@suse.de
- Fixed 2 places of file descriptor leakage which lead to segfaults
during readdir/fgets. #33958
-------------------------------------------------------------------
Fri Mar 19 16:22:35 CET 2004 - meissner@suse.de
- remove the #define PACKAGE_ from the included autoconf
generated config.h file. #36355
-------------------------------------------------------------------
Fri Mar 19 00:56:32 CET 2004 - ro@suse.de
- use stop_on_removal and restart_on_update macros (#36306)
- package /var/log/net-snmp as %ghost (#36435)
-------------------------------------------------------------------
Tue Mar 16 23:20:36 CET 2004 - ro@suse.de
- use mktemp in fixproc (#36103)
-------------------------------------------------------------------
Mon Mar 15 16:56:15 CET 2004 - ro@suse.de
- avoid segfault in version-info (limit to 300 bytes)
- open devices with NONBLOCK, don't wait for cdrom
- avoid segfault in proc-cmdline output
-------------------------------------------------------------------
Mon Feb 16 14:26:25 CET 2004 - ro@suse.de
- previous 64-bit fix went just one bit too far, fixed
-------------------------------------------------------------------
Wed Feb 11 17:22:14 CET 2004 - ro@suse.de
- added smux mib (for quagga)
-------------------------------------------------------------------
Mon Feb 9 15:28:16 CET 2004 - ro@suse.de
- fix dlopen detection in configure
-------------------------------------------------------------------
Wed Feb 4 11:57:54 CET 2004 - ro@suse.de
- added requires for perl-TermReadKey
-------------------------------------------------------------------
Tue Jan 20 17:03:52 CET 2004 - ro@suse.de
- try to fix at least some 64bit issues (eg. #33958)
-------------------------------------------------------------------
Thu Jan 15 17:35:03 CET 2004 - ro@suse.de
- update arguments in rc-script
-------------------------------------------------------------------
Fri Jan 9 12:24:10 CET 2004 - kukuk@suse.de
- Fix some 64bit critical compiler warnings
-------------------------------------------------------------------
Fri Dec 12 12:09:03 CET 2003 - hare@suse.de
- Fixed includes for build with evlog.
-------------------------------------------------------------------
Fri Nov 14 12:55:17 CET 2003 - ro@suse.de
- update to 5.1
-------------------------------------------------------------------
Fri Nov 14 12:54:47 CET 2003 - ro@suse.de
- build perl module as perl-SNMP
-------------------------------------------------------------------
Fri Nov 14 12:54:41 CET 2003 - ro@suse.de
- enable ucd-snmp compatibility
-------------------------------------------------------------------
Thu Oct 23 16:41:21 CEST 2003 - ro@suse.de
- update to 5.1.pre2
-------------------------------------------------------------------
Thu Oct 23 15:55:33 CEST 2003 - ro@suse.de
- revised audit patch
- branched devel subpackage
- added rpm support
-------------------------------------------------------------------
Wed Oct 22 17:29:22 CEST 2003 - ro@suse.de
- created package and ported patches from ucd-snmp

15
net-snmp.logrotate Normal file
View File

@ -0,0 +1,15 @@
/var/log/net-snmpd.log {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
create 600 root root
sharedscripts
postrotate
/etc/init.d/snmpd try-restart ||:
endscript
}

531
net-snmp.spec Normal file
View File

@ -0,0 +1,531 @@
#
# spec file for package net-snmp (Version 5.4.rc2)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: net-snmp
%define pkg_name net-snmp
Version: 5.4.rc2
Release: 1
#
License: BSD License and BSD-like, Other License(s), see package
Group: Productivity/Networking/Other
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: openssl-devel rpm-devel sensors tcpd-devel
Requires: perl-TermReadKey logrotate
PreReq: %insserv_prereq %fillup_prereq /sbin/chkconfig
Provides: snmp ucdsnmp
Obsoletes: snmp ucdsnmp
%define netsnmp_logfile /var/log/net-snmpd.log
%define netsnmp_agentx_socket_dir_fhs /var/run/agentx
%define netsnmp_agentx_socket_dir_rfc /var/agentx
#
URL: http://sourceforge.net/projects/net-snmp
Source: %{pkg_name}-%{version}.tar.bz2
Source1: rc.net-snmp
Source2: snmpd.conf
Source3: README.SuSE
Source4: rc.snmptrapd
Source5: net-snmp.logrotate
Source6: test_installed
Source7: net-snmp.sysconfig
Patch: net-snmp-5.3.0.1-audit.diff
Patch1: net-snmp-5.4.rc1-autoconf.diff
# unused patch atm
Patch2: net-snmp-5.2.1-socket_path.diff
Patch3: net-snmp-5.4.rc2-versinfo.diff
Patch4: net-snmp-5.2.1-overflow.diff
Patch5: net-snmp-5.2.1.testing.empty_arptable.patch
Patch6: net-snmp-5.1.1-pie.patch
Patch7: net-snmp-5.3_vendorperl.patch
Patch8: net-snmp-5.4_net-snmp-config_headercheck.patch
Patch9: net-snmp-5.4.rc2_perl_SNMP_size_t.patch
#
Summary: SNMP Daemon
%description
This package was originally based on the CMU 2.1.2.1 snmp code. It has
been greatly modified, restructured, enhanced, and fixed. It hardly
looks the same as anything that CMU has ever released. It was renamed
from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp to
net-snmp in November 2000.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package devel
Group: Productivity/Networking/Other
Requires: %{pkg_name} = %{version}, openssl-devel, rpm-devel, sensors, tcpd-devel
#
Summary: SNMP Daemon
%description devel
This package was originally based on the CMU 2.1.2.1 snmp code. It has
been greatly modified, restructured, enhanced, and fixed. It hardly
looks the same as anything that CMU has ever released. It was renamed
from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp to
net-snmp in November 2000.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n perl-SNMP
Group: Development/Libraries/Perl
Requires: %{pkg_name} = %{version}
#
Summary: Perl-SNMP
%description -n perl-SNMP
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
Authors:
--------
G.S. Marzot <gmarzot@nortelnetworks.com>
%prep
%setup -q -n %{pkg_name}-%{version}
%patch0
%patch1
##%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
find -name "CVS" -type d | xargs -r %{__rm} -rfv
find -name ".cvsignore" | xargs -r %{__rm} -fv
find -name "*.orig" | xargs -r %{__rm} -fv
%build
#autoconf
# possibly add later
# ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable
export CFLAGS="%{optflags} -fno-strict-aliasing"
%if 0%{?suse_version} > 1000
export CFLAGS="$CFLAGS -fstack-protector-all"
%endif
%configure \
--with-sys-contact="root@localhost" \
--with-mib-modules="misc/ipfwacc smux ucd-snmp/diskio ucd-snmp/lmSensors" \
--with-persistent-directory=/var/lib/net-snmp \
--with-agentx-socket=%{netsnmp_agentx_socket_dir_fhs}/master \
--with-sys-location="unknown" \
--with-logfile=%{netsnmp_logfile} \
--with-libwrap=%{_prefix} \
--with-defaults \
--enable-shared \
--disable-static \
--enable-as-needed \
--without-root-access \
--enable-local-smux \
--enable-ipv6 \
--enable-ucd-snmp-compatibility
%{__make} all
%ifnarch %arm
ulimit -c unlimited
%{__make} test ||:
%{__make} test TESTOPTS='-P tcp' ||:
%endif
%{__make} perlmodules ||:
LD_RUN_PATH="$PWD/snmplib/.libs" LD_LIBRARY_PATH="${PWD}/snmplib/.libs:${PWD}/agent/.libs:${PWD}/agent/helpers/.libs" %{__make} perltest ||:
%install
%makeinstall INSTALL_PREFIX=%{buildroot}
%{__install} -Dd %{buildroot}/var/log %{buildroot}/var/lib/net-snmp %{buildroot}/usr/lib/net-snmp/agents %{buildroot}%{netsnmp_agentx_socket_dir_fhs}
%{__install} -D -m 0755 %{SOURCE1} %{buildroot}/etc/init.d/snmpd
%{__install} -D -m 0600 %{SOURCE2} %{buildroot}/etc/snmp/snmpd.conf
%{__install} -m 0644 %{SOURCE3} .
%{__install} -m 0644 %{SOURCE4} .
%{__install} -D -m 0644 %{SOURCE5} %{buildroot}/etc/logrotate.d/net-snmp
%{__install} -m 0744 %{SOURCE6} testing/
%{__ln_s} -f /etc/init.d/snmpd %{buildroot}%{_sbindir}/rcsnmpd
%{__install} -m 0644 /dev/null %{buildroot}%{netsnmp_logfile}
pushd perl
%perl_make_install
%perl_process_packlist
%{__rm} -f %{buildroot}/%{perl_vendorarch}/Bundle/Makefile.subs.pl
popd
%{__grep} -v "^#define PACKAGE" %{buildroot}%{_includedir}/net-snmp/net-snmp-config.h > \
%{buildroot}%{_includedir}/net-snmp/net-snmp-config.h.new
%{__mv} %{buildroot}%{_includedir}/net-snmp/net-snmp-config.h{.new,}
%{__install} -D -m 0644 %{S:7} \
%{buildroot}/var/adm/fillup-templates/sysconfig.%{pkg_name}
#
%{__ln_s} -f %{netsnmp_agentx_socket_dir_fhs} %{buildroot}%{netsnmp_agentx_socket_dir_rfc}
%clean
%{__rm} -rf %{buildroot}
%preun
%stop_on_removal snmpd
%post
# if we are upgrading from older distros the config should be moved
# to the new place
CONFD="/etc/snmp"
OCONF="/etc/snmpd.conf"
NCONF="${CONFD}/snmpd.conf"
NCONFB="${CONFD}/snmpd.conf.rpmsave"
if [ -e "$OCONF" ] ; then
#
# in worst case we will get:
# /etc/snmp/snmpd.conf - the old /etc/snmpd.conf
# /etc/snmp/snmpd.conf.rpmnew - the config of the newly installed package.
# /etc/snmp/snmpd.conf.rpmsave - the old /etc/snmp/snmpd.conf
#
if [ ! -d "$CONFD" ] ; then
mkdir "$CONFD"
fi
#
# we dont need to handle the case that /etc/snmp/snmpd.conf
# exists. rpm does that for us.
# it creates /etc/snmp/snmpd.conf.rpmnew
#
if [ -e "$NCONF" ] ; then
mv "$NCONF" "$NCONFB"
echo "warning: /etc/snmp/snmpd.conf backed up as /etc/snmp/snmpd.conf.rpmsave" >&2
fi
echo "warning: /etc/snmpd.conf moved to /etc/snmp/snmpd.conf" >&2
mv "$OCONF" "$NCONF"
fi
# we might be updating from ucdsnmp soon
/sbin/chkconfig -c snmpd 2> /dev/null && FIRST_ARG=2
%{fillup_and_insserv snmpd}
%postun
%restart_on_update snmpd
%{insserv_cleanup}
%files
%defattr(-,root,root)
%doc AGENT.txt COPYING EXAMPLE.conf EXAMPLE.conf.def
%doc README* FAQ NEWS TODO rc.snmptrapd
%dir /etc/snmp
%config(noreplace) /etc/snmp/snmpd.conf
%config /etc/init.d/snmpd
%{_bindir}/encode_keychange
%{_bindir}/fixproc
%{_bindir}/ipf-mod.pl
%{_bindir}/net-snmp-config
%{_bindir}/snmpbulkget
%{_bindir}/snmpbulkwalk
%{_bindir}/snmpcheck
%{_bindir}/snmpconf
%{_bindir}/snmpdelta
%{_bindir}/snmpdf
%{_bindir}/snmpget
%{_bindir}/snmpgetnext
%{_bindir}/snmpinform
%{_bindir}/snmpnetstat
%{_bindir}/snmpset
%{_bindir}/snmpstatus
%{_bindir}/snmptable
%{_bindir}/snmptest
%{_bindir}/snmptranslate
%{_bindir}/snmptrap
%{_bindir}/snmpusm
%{_bindir}/snmpvacm
%{_bindir}/snmpwalk
%{_bindir}/traptoemail
%dir %{_prefix}/lib/net-snmp
%dir %{_prefix}/lib/net-snmp/agents
%{_libdir}/libsnmp*.so.*
%{_libdir}/libnetsnmp*.so.*
%{_mandir}/man[158]/*
%{_sbindir}/*
%{_datadir}/snmp
/var/lib/net-snmp
%dir %attr(700,root,root) %{netsnmp_agentx_socket_dir_fhs}
%ghost %{netsnmp_logfile}
%config(noreplace) /etc/logrotate.d/net-snmp
/var/adm/fillup-templates/sysconfig.%{pkg_name}
%{netsnmp_agentx_socket_dir_rfc}
%files devel
%defattr(-,root,root)
%doc ChangeLog PORTING testing
%{_mandir}/man3/*
%{_includedir}/ucd-snmp
%{_includedir}/net-snmp
%{_libdir}/libsnmp*.*a
%{_libdir}/libsnmp*.so
%{_libdir}/libnetsnmp*.*a
%{_libdir}/libnetsnmp*.so
%files -n perl-SNMP
%defattr(-,root,root)
%{perl_vendorarch}/auto/SNMP
%{perl_vendorarch}/auto/NetSNMP
%{perl_vendorarch}/auto/Bundle
%{perl_vendorarch}/SNMP.pm
%{perl_vendorarch}/NetSNMP
/var/adm/perl-modules/%{name}
%{_bindir}/tkmib
%{_bindir}/mib2c
%{_bindir}/mib2c-update
%changelog -n net-snmp
* Mon Nov 13 2006 - mrueckert@suse.de
- update to 5.4.rc2:
tons of bugfixes, and new features. just to name a few:
- enabled embedded perl
- new MIB table to manage net-snmp access control extensions
- hal to abstract os specific aspects of the systems
- tree matching support for snmptrapd
- reworked transport creation in snmplib
- using the incoming ip for outgoing packets if possible.
- ipv6 aware tcp/udp mibs
- removed patches:
(all of them are either upstream or obsolete)
net-snmp-5.2.1-acinclude.diff
net-snmp-5.2.1-acquotation.patch
net-snmp-5.2.1-compat.patch
net-snmp-5.2.1-localperl.diff
net-snmp-5.2.1-perl.diff
net-snmp-5.3.0.1-64bit.diff
net-snmp-5.3.0.1_agentx_socket_path_doc.patch
net-snmp-5.3.0.1_deprecated_sysctl_retrans_time.patch
net-snmp-5.3.0.1_disman_mib_crash.patch
net-snmp-5.3.0.1_ethtool.patch
net-snmp-5.3.0.1_linux_types_header.patch
net-snmp-5.3.0.1_missing_ifNumber.patch
net-snmp-5.3.0.1_netsnmp_register_mib_crash.patch
net-snmp-5.3.0.1_perl_ld_run_path.patch
net-snmp-5.3.0.1_sighup_vacm.patch
net-snmp-5.3.0.1-smux-trap.diff
net-snmp-5.3.0.1.tar.bz2
net-snmp-5.3.0.1_tcpwrapper_log_severity.patch
net-snmp-5.3.0.1_testsuite_no_smux.patch
net-snmp-5.3.0.1_tunnel_compilation.patch
net-snmp-5.3_perl_agent.xs-pointersize.patch
net-snmp-5.3_perl-printf.patch
net-snmp-5.4_default_store_return_value.patch
oid-names2_5.3.patch
- added net-snmp-5.4_net-snmp-config_headercheck.patch:
warn if net-snmp-config is used but development files are missing.
- updated net-snmp-5.2.1-autoconf.diff to apply cleanly against 5.4
new name: net-snmp-5.4.rc1-autoconf.diff
- updated net-snmp-5.2.1-versinfo.diff to apply cleanly against 5.4
new name: net-snmp-5.4.rc2-versinfo.diff
- added net-snmp-5.4.rc2_perl_SNMP_size_t.patch:
dont use int if you want size_t. fixes failures in the perl test
suite.
* Thu Oct 19 2006 - mrueckert@suse.de
- added net-snmp-5.4_default_store_return_value.patch:
backport my patch from 5.4 so we can get rid of the build errors.
the patch removes/disables dead code.
* Fri Aug 04 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_perl_ld_run_path.patch:
the old perl replacement line broke linking of the SNMP libraries
into the perl modules. the patch sets the LD_RUN_PATH for the
build process to LIBDIR. (#180888)
* Thu May 04 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_sighup_vacm.patch:
The snmp agent was broken on SIGHUP. It lost all its MIB
informations. (upstream bug: #1473289)
- added net-snmp-5.3.0.1_deprecated_sysctl_retrans_time.patch:
The snmpd used a deprecated sysctl to get the retransmit time
from the kernel. We didnt use this module but the mib library
triggered the sysctl. The patch uses retrans_time_ms when
available and corrects the correction factor for the old sysctl.
(bug: #170140, upstream: #1437287)
- reenabled the lmsensors support. was disabled for testing and
never reenabled.
* Thu Apr 20 2006 - mrueckert@suse.de
- net-snmp-5.3.0.1_missing_ifNumber.patch:
The 5.3 agent on Linux systems did not implement the 'ifNumber'
MIB object. (#159501)
* Wed Apr 19 2006 - mrueckert@suse.de
- logrotate does not like if the postrotate script returns with
a non zero returncode.
- add missing "-e" in echo line
* Mon Apr 03 2006 - mrueckert@suse.de
- dont call "/etc/init.d/snmpd restart". this could start the
daemon unconditionally (too large log file).
switched to "/etc/init.d/snmpd try-restart"
* Mon Apr 03 2006 - mrueckert@suse.de
- run logrotate on startup if the logfile is too large. (#131072)
* Tue Mar 28 2006 - mrueckert@suse.de
- fix compilation with ethtool support. (#155709)
- added option to ignore accepted connections (#86634)
net-snmp-5.3.0.1_tcpwrapper_log_severity.patch
new sysconfig option: SNMPD_LOG_SUCCESSFUL_CONNECTIONS
- pass the correct path to configure to set the desired log file
- make smux listen to localhost by default. (#116742)
- remove confpath patch. (#147808,#159768)
* Mon Mar 27 2006 - mrueckert@suse.de
- updated and reenabled the audit patch
* Fri Mar 17 2006 - mrueckert@suse.de
- ported sysconfig options from sles9
SNMPD_LOGLEVEL -> SPECIFY the log level for the snmpd
SNMPD_USE_SMUX -> disable SMUX socket
* Fri Mar 10 2006 - mrueckert@suse.de
- disable embedded perl for now.
* Wed Mar 08 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_agentx_socket_path_doc.patch:
fixes: net-snmp snmpd.conf(5) manpage gives wrong default
for AgentXSocket (#129437)
- ported fix for bug #129923 from sles9
- suppress the error message in the ucd-snmp upgrade script
* Wed Feb 22 2006 - mrueckert@suse.de
- we move the configs into /etc/snmp [#77935]
- removed debugging packages from the build requires.
* Thu Feb 16 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1-smux-trap.diff
dont loose the value of string variables via smux traps [#150091]
* Fri Feb 03 2006 - mrueckert@suse.de
- added net-snmp-5.3.0.1_disman_mib_crash.patch
o fixes a crash in the disman mib loading
- net-snmp-5.3.0.1_netsnmp_register_mib_crash.patch
o dont crash while registering mibs
- net-snmp-5.3_perl_agent.xs-pointersize.patch
o dont use int if you mean intptr_t(IV)
- net-snmp-5.3_perl-printf.patch
o unused format specifier in printf
- net-snmp-5.3_vendorperl.patch
o do make install_vendor
* Wed Jan 25 2006 - mrueckert@suse.de
- removed net-snmp-5.2.1-cmdline.diff
better solution from upstream
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Mon Jan 23 2006 - mrueckert@suse.de
- update to version 5.3.0.1
- removed patches that got applied upstream or superseeded by
upstream fixes:
net-snmp-5.2.1-uptime.diff
net-snmp-5.2.1-typeclash.diff
net-snmp-5.2.1-gcc.diff
net-snmp-5.2.1-dlopen-conf.diff
net-snmp-5.2.1-enomedium.diff
net-snmp-5.2.1-mktemp.diff
net-snmp-5.2.1-close-all-fds.diff
net-snmp-5.2.1-more-cpus.diff
net-snmp-5.2.1-nowraplibs.patch
net-snmp-5.2.1.set-var-value.patch
- added 4 new patches:
net-snmp-5.3_perl_agent.xs-pointersize.patch
- fixes some casts of pointers to ints -> segfaults in the test
suite
net-snmp-5.3_perl-printf.patch
- fixes a printf warning
net-snmp-5.3_vendorperl.patch
- call perl modules install with install_vendor
net-snmp-5.1.1-pie.patch
- build snmpd and snmptrapd with pie
* Tue Nov 15 2005 - uli@suse.de
- no point in running the test suite in QEMU
* Wed Sep 07 2005 - mrueckert@suse.de
- Added rpm-devel to the requires of the -devel package
* Fri Jun 17 2005 - mrueckert@suse.de
- added disman/event-mib to the mib list (Bug #91039)
- replaced patch25 (asn1 handling fix) with patch from the upstream.
(Bug #73804)
- build snmpd and snmptrap with with -fpie/-pie
* Fri Jun 10 2005 - mrueckert@suse.de
- Fixed test suite for boxes with empty arp tables.
* Tue May 17 2005 - hvogel@suse.de
- Include the right header for compat mode (Bug #64074)
- Fix length for type ASN_UNSIGNED (Bug #73804)
- Get rid of WRAPLIBS in net-snmp-config (Bug #75879)
- Fix ac quotation
* Tue Feb 22 2005 - meissner@suse.de
- moved tkmib and mib2c* to perl subpackage, since
they require it. #63992
* Wed Feb 16 2005 - meissner@suse.de
- Multiple non Intel CPU detection added.
* Sun Feb 06 2005 - meissner@suse.de
- Upgraded to 5.1.2 release. (lots of bugfixes as usual)
* Wed Feb 02 2005 - meissner@suse.de
- overflow counter32 and gauge32 on 64bit systems correctly. #50384
* Fri Nov 26 2004 - meissner@suse.de
- close all non standard filedescriptors on start.
* Thu Nov 25 2004 - meissner@suse.de
- Upgraded to 5.2 final.
* Mon Oct 25 2004 - meissner@suse.de
- Upgraded to 5.2.1rc2. Dropped merged patches, rediffed
old ones.
* Tue Aug 17 2004 - coolo@suse.de
- fixing pre-requires
* Thu Aug 12 2004 - meissner@suse.de
- Upgrade to 5.1.2 final.
* Thu Jul 29 2004 - meissner@suse.de
- Upgraded to upstream 5.1.2.rc2.
* Fri Jul 23 2004 - meissner@suse.de
- Upgraded to 5.1.2.rc1.
- Dropped some old patches / parts of old patches.
- Fixed problem on little endian 64bit machines.
* Thu Jul 15 2004 - meissner@suse.de
- removed double free on failure in netsnmp_register_old_api().
(bug #42580)
- do not specify -c /etc/snmpd.conf (since it is already built in).
(bug #41706)
- require openssl-devel in -devel package.
* Tue Jul 06 2004 - meissner@suse.de
- replaced undefined C construct (x[n] = y[n++]) which caused the
testsuite to fail on i386.
* Mon Jul 05 2004 - uli@suse.de
- sleep .3 s before starting agents (bug #42588)
* Wed Jun 30 2004 - meissner@suse.de
- Fixed 2 places of file descriptor leakage which lead to segfaults
during readdir/fgets. #33958
* Fri Mar 19 2004 - meissner@suse.de
- remove the #define PACKAGE_ from the included autoconf
generated config.h file. #36355
* Fri Mar 19 2004 - ro@suse.de
- use stop_on_removal and restart_on_update macros (#36306)
- package /var/log/net-snmp as %%ghost (#36435)
* Tue Mar 16 2004 - ro@suse.de
- use mktemp in fixproc (#36103)
* Mon Mar 15 2004 - ro@suse.de
- avoid segfault in version-info (limit to 300 bytes)
- open devices with NONBLOCK, don't wait for cdrom
- avoid segfault in proc-cmdline output
* Mon Feb 16 2004 - ro@suse.de
- previous 64-bit fix went just one bit too far, fixed
* Wed Feb 11 2004 - ro@suse.de
- added smux mib (for quagga)
* Mon Feb 09 2004 - ro@suse.de
- fix dlopen detection in configure
* Wed Feb 04 2004 - ro@suse.de
- added requires for perl-TermReadKey
* Tue Jan 20 2004 - ro@suse.de
- try to fix at least some 64bit issues (eg. #33958)
* Thu Jan 15 2004 - ro@suse.de
- update arguments in rc-script
* Fri Jan 09 2004 - kukuk@suse.de
- Fix some 64bit critical compiler warnings
* Fri Dec 12 2003 - hare@suse.de
- Fixed includes for build with evlog.
* Fri Nov 14 2003 - ro@suse.de
- update to 5.1
* Fri Nov 14 2003 - ro@suse.de
- build perl module as perl-SNMP
* Fri Nov 14 2003 - ro@suse.de
- enable ucd-snmp compatibility
* Thu Oct 23 2003 - ro@suse.de
- update to 5.1.pre2
* Thu Oct 23 2003 - ro@suse.de
- revised audit patch
- branched devel subpackage
- added rpm support
* Wed Oct 22 2003 - ro@suse.de
- created package and ported patches from ucd-snmp

36
net-snmp.sysconfig Normal file
View File

@ -0,0 +1,36 @@
## Path: System/Net-SNMP
## Description: Log level of the snmp server.
## Type: string(!,a,c,e,w,n,i,d,0,1,2,3,4,5,6,7)
## Default: d
#
# Defines the log level for the snmpd.
#
# The default is set to d (7, LOG_DEBUG)
# This reflects the default for old init script.
#
SNMPD_LOGLEVEL="d"
## Path: System/Net-SNMP
## Description: En-/Disables SNMP SMUX support.
## Type: yesno
## Default: yes
#
# If this setting is set to "no" the snmpd will no longer bind
# the TCP Port 199.
#
# The default is set to "yes" to provide backward compatibility.
#
SNMPD_USE_SMUX="yes"
## Path: System/Net-SNMP
### Description: Connecion logging.
### Type: yesno
### Default: yes
##
## If this settings is yes, net-snmp will not log any successfull connections.
## If it is set to no, "--dontLogTCPWrappersConnects" will added to the
## snmpd cmdline. (see "man 5 snmpd.conf")
##
## The default is set to "yes" to provide backward compatibility.
##
SNMPD_LOG_SUCCESSFUL_CONNECTIONS="yes"

175
rc.net-snmp Normal file
View File

@ -0,0 +1,175 @@
#! /bin/sh
# Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Christopher Mahmood <ckm+snmp@suse.de>, Remo Behn <ray+snmp@suse.de>
#
# /etc/init.d/snmpd
#
### BEGIN INIT INFO
# Provides: net-snmp snmp
# Required-Start: $network
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: start net-snmpd
### END INIT INFO
SNMPD=/usr/sbin/snmpd
AGENTDIR=/usr/lib/net-snmp/agents
SNMPDCONF=/etc/snmp/snmpd.conf
test -x $SNMPD || exit 5
# Check for existence of needed config file and read it
SNMPD_CONFIG=/etc/sysconfig/net-snmp
test -r $SNMPD_CONFIG || { echo "$SNMPD_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
# Read config
. $SNMPD_CONFIG
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
# check whether to enable agentx support and get list of installed
# agents
get_agents()
{
agents=
agentargs=''
for agent in $AGENTDIR/*; do
test -x $agent || continue
agents="$agents $agent"
agentargs="-x /var/run/agentx/master"
done
}
case "$1" in
start)
echo -n "Starting snmpd"
#
# do not even try to start if the log file is (2GB-1MB) big.
# the snmpd doesnt handle LFS properly
#
SNMPD_LOGFILE="/var/log/net-snmpd.log"
if [ -e "$SNMPD_LOGFILE" ] ; then
SNMPD_SIZE_LOGFILE="$(stat -c "%s" $SNMPD_LOGFILE)"
SNMPD_SIZE_MAX="1073741824"
if [ $SNMPD_SIZE_LOGFILE -gt $SNMPD_SIZE_MAX ] ; then
echo -e "\n\"$SNMPD_LOGFILE\" was to large. Running 'logrotate' for net-snmp." >&2
/usr/sbin/logrotate /etc/logrotate.d/net-snmp
fi # if [ $SNMPD_SIZE_LOGFILE -gt $SNMPD_SIZE_MAX ] ; then
fi # if [ -e "$SNMPD_LOGFILE" ] ; then
get_agents
# Do not add -c /etc/snmpd.conf, since it is already loaded by default.
if [ $SNMPDCONF = "/etc/snmp/snmpd.conf" ]; then
SNMPDCONF=""
else
SNMPDCONF="-c $SNMPDCONF"
fi
case "${SNMPD_USE_SMUX:-yes}" in
[Nn][Oo])
SNMPDNOSMUX="-I -smux"
;;
esac
case "${SNMPD_LOG_SUCCESSFUL_CONNECTIONS:-yes}" in
[Nn][Oo])
SNMPDNOTCPWRAPPERLOG="--dontLogTCPWrappersConnects"
;;
esac
startproc $SNMPD $SNMPDCONF -r -A -LF ${SNMPD_LOGLEVEL:-d} $SNMPD_LOGFILE -p /var/run/snmpd.pid $agentargs $SNMPDNOSMUX $SNMPDNOTCPWRAPPERLOG
rc_status -v
rc_reset
# start all agents
if test -n $agents; then
usleep 300000
for agent in $agents; do
echo -en "\tStarting `basename $agent`"
startproc -t1 $agent
rc_status -v ; rc_reset
done
fi
;;
stop)
echo -n "Shutting down snmpd:"
killproc -TERM $SNMPD
rc_status -v ; rc_reset
# we also need to make sure all agents die
if test -n $agents; then
for agent in $AGENTDIR/*; do
test -x $agent || continue
echo -ne "\tShutting down `basename $agent`:"
killproc $agent
rc_status -v ; rc_reset
done
fi
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
echo -n "Reload service snmpd:"
killproc -HUP $SNMPD
rc_status -v
;;
reload)
echo -n "Reload service snmpd:"
killproc -HUP $SNMPD
rc_status -v
;;
status)
echo -n "Checking for service snmpd:"
checkproc $SNMPD
rc_status -v
get_agents
if test -n "$agents"; then
echo -e "Checking for agents:"
for agent in $agents; do
echo -en "\t`basename $agent`"
checkproc $agent
rc_status -v
done
fi
;;
*)
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
exit 1
;;
esac
rc_exit

91
rc.snmptrapd Normal file
View File

@ -0,0 +1,91 @@
#! /bin/sh
# Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Christopher Mahmood <ckm@suse.de>, 2002
#
# /etc/init.d/snmptrapd
#
### BEGIN INIT INFO
# Provides: snmpdtrapd
# Required-Start: $network
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: start net-snmptrapd
### END INIT INFO
SNMPTRAPD=/usr/sbin/snmptrapd
test -x $SNMPTRAPD || exit 5
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting snmptrapd:"
startproc $SNMPTRAPD -c /etc/snmptrapd.conf -Lf /var/log/net-snmpd.log
rc_status -v
;;
stop)
echo -n "Shutting down snmptrapd:"
killproc -TERM $SNMPTRAPD
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
echo -n "Reload service snmptrapd:"
killproc -HUP $SNMPTRAPD
rc_status -v
;;
reload)
echo -n "Reload service snmptrapd:"
killproc -HUP $SNMPTRAPD
rc_status -v
;;
status)
echo -n "Checking for service snmptrapd:"
checkproc $SNMPTRAPD
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
exit 1
;;
esac
rc_exit

0
ready Normal file
View File

19
snmpd.conf Normal file
View File

@ -0,0 +1,19 @@
# Please see /usr/share/doc/packages/net-snmp/EXAMPLE.conf for a
# more complete example and snmpd.conf(5).
#
# Writing is disabled by default for security reasons. If you'd like
# to enable it uncomment the rwcommunity line and change the community
# name to something nominally secure (keeping in mind that this is
# transmitted in clear text).
# don't use ' < > in strings for syslocation or syscontact
# Note that if you define the following here you won't be able to change
# them with snmpset
syslocation Server Room
syscontact Sysadmin (root@localhost)
# These really aren't meant for production use. They include all MIBS
# and can use considerable resources. See snmpd.conf(5) for information
# on setting up groups and limiting MIBS.
rocommunity public 127.0.0.1
# rwcommunity mysecret 127.0.0.1

14
test_installed Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# ckm@suse.com
# runs the test suite on the installed package instead of in the build
# tree, really only useful for QA
base=/usr/share/doc/packages/net-snmp/testing
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:${base}"
export MIBDIRS=/usr/share/snmp/mibs
rcsnmpd stop &>/dev/null
cd ${base} || exit 1
RUNTESTS -a