Sync from SUSE:SLFO:Main net-snmp revision 74db4a1a54b44371e89b8669aaa0cd53

This commit is contained in:
Adrian Schröter 2024-05-03 16:57:43 +02:00
commit c7f7988915
33 changed files with 6779 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

41
README.SUSE Normal file
View File

@ -0,0 +1,41 @@
An SNMP agent is a powerful and complex software and, as such, may
be affected by flaws and security issues. 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-snmpd.log instead
of sending stderr/stdout through syslog.
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 init script
in /etc/init.d/snmptrapd, but the service is disabled by default.
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 enable the service, run
chkconfig snmptrapd on
and create a configuration file named /etc/snmp/snmptrapd.conf.
Then, start the daemon with
rcsnmptrapd start
Logging is done to /var/log/net-snmpd.log.
For more information see the manpages for snmptrapd and snmptrapd.conf.
o Master AgentX support is enabled if you have modules in
/usr/lib/net-snmp/agents. 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://www.net-snmp.org/

4
baselibs.conf Normal file
View File

@ -0,0 +1,4 @@
libsnmp40
net-snmp-devel
requires -net-snmp-<targettype>
requires "libsnmp40-<targettype> = <version>"

View File

@ -0,0 +1,11 @@
diff -Nurp net-snmp-5.9.1-orig/agent/mibgroup/hardware/fsys/fsys_mntent.c net-snmp-5.9.1/agent/mibgroup/hardware/fsys/fsys_mntent.c
--- net-snmp-5.9.1-orig/agent/mibgroup/hardware/fsys/fsys_mntent.c 2021-10-14 10:41:53.432186916 +0000
+++ net-snmp-5.9.1/agent/mibgroup/hardware/fsys/fsys_mntent.c 2021-10-18 06:24:35.385893383 +0000
@@ -75,6 +75,7 @@ static const char *other_fs[] = {
"jfs",
"jffs2",
"lofs",
+ "lustre",
"mvfs",
"nsspool",
"nssvol",

View File

@ -0,0 +1,24 @@
Index: net-snmp-5.9/perl/ASN/Makefile.PL
===================================================================
--- net-snmp-5.9.orig/perl/ASN/Makefile.PL
+++ net-snmp-5.9/perl/ASN/Makefile.PL
@@ -9,6 +9,7 @@ use Config;
use MakefileSubs;
my $lib_version;
+my %MakeParams = ();
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
Index: net-snmp-5.9/perl/Makefile.PL
===================================================================
--- net-snmp-5.9.orig/perl/Makefile.PL
+++ net-snmp-5.9/perl/Makefile.PL
@@ -4,6 +4,7 @@ use ExtUtils::MakeMaker;
use Config;
require 5;
use MakefileSubs;
+my %MakeParams = ();
# Prevent that MakeMaker complains about unknown parameter names.
NetSNMPGetOpts();

View File

@ -0,0 +1,21 @@
Index: net-snmp-5.9/dist/snmpd.service
===================================================================
--- net-snmp-5.9.orig/dist/snmpd.service
+++ net-snmp-5.9/dist/snmpd.service
@@ -10,6 +10,16 @@ Description=Simple Network Management Pr
After=syslog.target network.target
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
# Type=notify is also supported. It should be set when snmpd.socket is not used.
Type=simple
ExecStart=/usr/sbin/snmpd -f

View File

@ -0,0 +1,21 @@
Index: net-snmp-5.9/dist/snmptrapd.service
===================================================================
--- net-snmp-5.9.orig/dist/snmptrapd.service
+++ net-snmp-5.9/dist/snmptrapd.service
@@ -7,6 +7,16 @@ Description=Simple Network Management Pr
After=syslog.target network.target
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
# Type=notify is also supported. It should be set when snmptrapd.socket is not
# used.
Type=simple

View File

@ -0,0 +1,86 @@
diff -Nurp net-snmp-5.8-orig/agent/mibgroup/host/data_access/swinst_rpm.c net-snmp-5.8/agent/mibgroup/host/data_access/swinst_rpm.c
--- net-snmp-5.8-orig/agent/mibgroup/host/data_access/swinst_rpm.c 2018-10-10 09:45:14.907075076 +0000
+++ net-snmp-5.8/agent/mibgroup/host/data_access/swinst_rpm.c 2018-10-10 19:31:51.161967195 +0000
@@ -101,8 +101,7 @@ netsnmp_swinst_arch_load( netsnmp_contai
const char *g;
rpmtd td_name, td_version, td_release, td_group, td_time;
#else
- char *n, *v, *r, *g;
- int32_t *t;
+ const char *n, *v, *r, *g;
#endif
time_t install_time;
size_t date_len;
@@ -146,14 +145,14 @@ netsnmp_swinst_arch_load( netsnmp_contai
install_time = rpmtdGetNumber(td_time);
g = rpmtdGetString(td_group);
#else
- headerGetEntry( h, RPMTAG_NAME, NULL, (void**)&n, NULL);
- headerGetEntry( h, RPMTAG_VERSION, NULL, (void**)&v, NULL);
- headerGetEntry( h, RPMTAG_RELEASE, NULL, (void**)&r, NULL);
- headerGetEntry( h, RPMTAG_GROUP, NULL, (void**)&g, NULL);
- headerGetEntry( h, RPMTAG_INSTALLTIME, NULL, (void**)&t, NULL);
+ n = headerGetString( h, RPMTAG_NAME);
+ v = headerGetString( h, RPMTAG_VERSION);
+ r = headerGetString( h, RPMTAG_RELEASE);
+ g = headerGetString( h, RPMTAG_GROUP);
+ install_time = headerGetNumber( h, RPMTAG_INSTALLTIME);
+
entry->swName_len = snprintf( entry->swName, sizeof(entry->swName),
"%s-%s-%s", n, v, r);
- install_time = *t;
#endif
entry->swType = (g && NULL != strstr( g, "System Environment"))
? 2 /* operatingSystem */
diff -Nurp net-snmp-5.8-orig/agent/mibgroup/host/hr_swinst.c net-snmp-5.8/agent/mibgroup/host/hr_swinst.c
--- net-snmp-5.8-orig/agent/mibgroup/host/hr_swinst.c 2018-10-10 09:45:14.907075076 +0000
+++ net-snmp-5.8/agent/mibgroup/host/hr_swinst.c 2018-10-10 19:34:48.935596621 +0000
@@ -479,9 +479,9 @@ var_hrswinst(struct variable * vp,
}
#else
# ifdef HAVE_LIBRPM
- char *rpm_groups;
- if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) {
- if ( strstr(rpm_groups, "System Environment") != NULL )
+ const char *rpm_group = headerGetString(swi->swi_h, RPMTAG_GROUP);
+ if ( NULL != rpm_group ) {
+ if ( strstr(rpm_group, "System Environment") != NULL )
long_return = 2; /* operatingSystem */
else
long_return = 4; /* applcation */
@@ -498,9 +498,8 @@ var_hrswinst(struct variable * vp,
case HRSWINST_DATE:
{
#ifdef HAVE_LIBRPM
- int32_t *rpm_data;
- if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
- time_t installTime = *rpm_data;
+ time_t installTime = headerGetNumber(swi->swi_h, RPMTAG_INSTALLTIME);
+ if ( 0 != installTime) {
ret = date_n_time(&installTime, var_len);
} else {
ret = date_n_time(NULL, var_len);
@@ -660,7 +659,7 @@ Save_HR_SW_info(int ix)
if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
int offset;
Header h;
- char *n, *v, *r;
+ const char *n, *v, *r;
offset = swi->swi_recs[ix - 1];
@@ -685,11 +684,9 @@ Save_HR_SW_info(int ix)
swi->swi_h = h;
swi->swi_prevx = ix;
- headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
- headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
- NULL);
- headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
- NULL);
+ n = headerGetString(swi->swi_h, RPMTAG_NAME);
+ v = headerGetString(swi->swi_h, RPMTAG_VERSION);
+ r = headerGetString(swi->swi_h, RPMTAG_RELEASE);
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
}

View File

@ -0,0 +1,84 @@
diff -Nurp net-snmp-5.8-orig/net-snmp-config.in net-snmp-5.8/net-snmp-config.in
--- net-snmp-5.8-orig/net-snmp-config.in 2018-10-10 09:45:14.947075442 +0000
+++ net-snmp-5.8/net-snmp-config.in 2018-10-10 09:48:04.792631474 +0000
@@ -41,6 +41,14 @@ count()
echo $#
}
+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@
@@ -140,9 +148,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)
@@ -153,6 +163,7 @@ else
echo $NSC_LIBDIR
;;
--ldflags|--ld*)
+ check_devel_files
echo $NSC_LDFLAGS
;;
--build-lib-dirs)
@@ -190,29 +201,37 @@ else
#################################################### client lib
--libs)
# use this one == --netsnmp-libs + --external-libs
+ check_devel_files
echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS
;;
--netsnmp-libs)
+ check_devel_files
echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS
;;
--external-libs)
+ check_devel_files
echo $NSC_LDFLAGS $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@
;;
#################################################### 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)
# use this one == --netsnmp-agent-libs + --external-libs
+ check_devel_files
echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS
;;
--netsnmp-agent-libs)
+ check_devel_files
echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS
;;
--external-agent-libs)
+ check_devel_files
echo $NSC_LDFLAGS $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS
;;
####################################################
@@ -238,6 +257,7 @@ else
####################################################
--compile-subagent)
+ check_devel_files
shift
shifted=1
while test "x$done" = "x" -a "x$1" != "x" ; do

View File

@ -0,0 +1,17 @@
Index: net-snmp-5.7.2/local/tkmib
===================================================================
--- net-snmp-5.7.2.orig/local/tkmib
+++ net-snmp-5.7.2/local/tkmib
@@ -27,10 +27,9 @@ instructions.
if (!$havetk) {
print "
-ERROR: You don't have the Tk module installed. You should be able to
-install this by running (as root):
+ERROR: You don't have the Tk module installed.
- perl -MCPAN -e 'install Tk'
+ Please install the perl-Tk package.
";
}

View File

@ -0,0 +1,140 @@
diff -Nurp net-snmp-5.8-orig/apps/snmpstatus.c net-snmp-5.8/apps/snmpstatus.c
--- net-snmp-5.8-orig/apps/snmpstatus.c 2018-10-10 09:45:14.955075516 +0000
+++ net-snmp-5.8/apps/snmpstatus.c 2018-10-10 10:15:16.131576910 +0000
@@ -96,6 +96,15 @@ size_t length_ipOutRequests =
#define NETSNMP_DS_APP_DONT_FIX_PDUS 0
+/* Flags to control which additional information to request and print */
+#define NETSNMP_STATUS_REQ_NETSTAT 0x0001
+#define NETSNMP_STATUS_REQ_NETOPER 0x0002
+#define NETSNMP_STATUS_REQ_ALL 0xffff
+
+/* By default request and print everything and let the user decide what
+ to suppress */
+static unsigned int rq_status = NETSNMP_STATUS_REQ_ALL;
+
static void
optProc(int argc, char *const *argv, int opt)
{
@@ -114,6 +123,22 @@ optProc(int argc, char *const *argv, int
}
}
break;
+ case 'S': /* 'S' == 'Suppress' */
+ while (*optarg) {
+ switch (*optarg++) {
+ case 'n':
+ rq_status &= ~NETSNMP_STATUS_REQ_NETSTAT;
+ break;
+ case 'i':
+ rq_status &= ~NETSNMP_STATUS_REQ_NETOPER;
+ break;
+ default:
+ fprintf(stderr, "Unknown flag passed to -S: %c\n",
+ optarg[-1]);
+ exit(1);
+ }
+ }
+ break;
}
}
@@ -128,6 +153,12 @@ usage(void)
" -C APPOPTS\t\tSet various application specific behaviours:\n");
fprintf(stderr,
"\t\t\t f: do not fix errors and retry the request\n");
+ fprintf(stderr,
+ " -S REQOPTS\t\tDo not request and print information about:\n");
+ fprintf(stderr,
+ "\t\t\t n: network (packets sent/received, operational status)\n");
+ fprintf(stderr,
+ "\t\t\t i: interface operational status\n");
}
@@ -154,7 +185,7 @@ main(int argc, char *argv[])
/*
* get the common command line arguments
*/
- switch (snmp_parse_args(argc, argv, &session, "C:", &optProc)) {
+ switch (snmp_parse_args(argc, argv, &session, "C:S:", &optProc)) {
case NETSNMP_PARSE_ARGS_ERROR:
goto out;
case NETSNMP_PARSE_ARGS_SUCCESS_EXIT:
@@ -185,8 +216,10 @@ main(int argc, char *argv[])
pdu = snmp_pdu_create(SNMP_MSG_GET);
snmp_add_null_var(pdu, objid_sysDescr, length_sysDescr);
snmp_add_null_var(pdu, objid_sysUpTime, length_sysUpTime);
- snmp_add_null_var(pdu, objid_ipInReceives, length_ipInReceives);
- snmp_add_null_var(pdu, objid_ipOutRequests, length_ipOutRequests);
+ if (rq_status & NETSNMP_STATUS_REQ_NETSTAT) {
+ snmp_add_null_var(pdu, objid_ipInReceives, length_ipInReceives);
+ snmp_add_null_var(pdu, objid_ipOutRequests, length_ipOutRequests);
+ }
/*
* do the request
@@ -279,6 +312,10 @@ main(int argc, char *argv[])
if (response)
snmp_free_pdu(response);
+ /* Suppress request to retrieve network statistics */
+ if (!(rq_status & NETSNMP_STATUS_REQ_NETSTAT))
+ goto done;
+
/*
* create PDU for GET request and add object names to request
*/
@@ -386,11 +423,11 @@ main(int argc, char *argv[])
}
printf("Interfaces: %d, Recv/Trans packets: %d/%d | IP: %d/%d\n",
interfaces, ipackets, opackets, ipin, ipout);
- if (down_interfaces > 0) {
+ if ((rq_status & NETSNMP_STATUS_REQ_NETOPER) && (down_interfaces > 0)) {
printf("%d interface%s down!\n",
down_interfaces, down_interfaces > 1 ? "s are" : " is");
}
-
+ done:
snmp_close(ss);
out:
diff -Nurp net-snmp-5.8-orig/man/snmpstatus.1.def net-snmp-5.8/man/snmpstatus.1.def
--- net-snmp-5.8-orig/man/snmpstatus.1.def 2018-10-10 09:45:14.951075479 +0000
+++ net-snmp-5.8/man/snmpstatus.1.def 2018-10-10 10:15:16.131576910 +0000
@@ -32,7 +32,7 @@
snmpstatus - retrieves a fixed set of management information from a network entity
.SH SYNOPSIS
.B snmpstatus
-[COMMON OPTIONS] [\-Cf] AGENT
+[COMMON OPTIONS] [\-Cf] [\-Sni] AGENT
.SH DESCRIPTION
.B snmpstatus
is an SNMP application that retrieves several important statistics
@@ -94,6 +94,11 @@ variable (unless the
option is given, see below), but this variable will then be missing
from the displayed data.
.PP
+It is also possible to suppress parts of the default output by
+using the option
+.B \-S
+(see below).
+.PP
.SH OPTIONS
.TP
.B COMMON OPTIONS
@@ -108,5 +113,13 @@ by the agent and retry a request. In thi
the command will display the data that it can. If the \-Cf option
is specified, then snmpstatus will not try to fix
errors, and the error will cause the command to terminate.
+.TP
+.B \-Sn
+Do not retrieve and print network statistics such as packets
+sent and received and the number of network interfaces that
+are down.
+.TP
+.B \-Si
+Do not print the number of network interfaces that are down.
.SH "SEE ALSO"
snmpcmd(1), snmpget(1)

View File

@ -0,0 +1,13 @@
Index: net-snmp-5.7.2/agent/mibgroup/agentx/protocol.h
===================================================================
--- net-snmp-5.7.2.orig/agent/mibgroup/agentx/protocol.h
+++ net-snmp-5.7.2/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 "/run/agentx/master"
#endif
/*

View File

@ -0,0 +1,187 @@
diff -Nurp net-snmp-5.9.1-orig/agent/mibgroup/agentx/subagent.c net-snmp-5.9.1/agent/mibgroup/agentx/subagent.c
--- net-snmp-5.9.1-orig/agent/mibgroup/agentx/subagent.c 2021-05-26 00:19:35.000000000 +0200
+++ net-snmp-5.9.1/agent/mibgroup/agentx/subagent.c 2022-03-09 16:44:30.609053225 +0100
@@ -80,6 +80,7 @@ typedef struct _net_snmpsubagent_magic_s
struct agent_netsnmp_set_info {
int transID;
int mode;
+ int req_pending;
int errstat;
time_t uptime;
netsnmp_session *sess;
@@ -190,6 +191,7 @@ save_set_vars(netsnmp_session * ss, nets
ptr->sess = ss;
ptr->mode = SNMP_MSG_INTERNAL_SET_RESERVE1;
ptr->uptime = netsnmp_get_agent_uptime();
+ ptr->req_pending = 0;
ptr->var_list = snmp_clone_varbind(pdu->variables);
if (ptr->var_list == NULL) {
@@ -204,6 +206,18 @@ save_set_vars(netsnmp_session * ss, nets
}
struct agent_netsnmp_set_info *
+pending_trans_set_info(netsnmp_session * sess, netsnmp_pdu *pdu)
+{
+ struct agent_netsnmp_set_info *ptr;
+
+ for (ptr = Sets; ptr != NULL; ptr = ptr->next)
+ if (ptr->sess == sess && ptr->transID == pdu->transid)
+ break;
+
+ return ptr;
+}
+
+struct agent_netsnmp_set_info *
restore_set_vars(netsnmp_session * sess, netsnmp_pdu *pdu)
{
struct agent_netsnmp_set_info *ptr;
@@ -413,6 +427,14 @@ handle_agentx_packet(int operation, nets
* XXXWWW we have to map this twice to both RESERVE1 and RESERVE2
*/
DEBUGMSGTL(("agentx/subagent", " -> testset\n"));
+ asi = pending_trans_set_info(session, pdu);
+ if (asi) {
+ DEBUGMSGTL(("agentx/subagent",
+ "dropping testset retry for transid 0x%x in mode %d\n",
+ (unsigned)pdu->transid, asi->mode));
+ //SNMP_FREE(retmagic); XXX necessary?
+ return 1;
+ }
asi = save_set_vars(session, pdu);
if (asi == NULL) {
SNMP_FREE(smagic);
@@ -434,6 +456,13 @@ handle_agentx_packet(int operation, nets
send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
return 1;
}
+ if (asi->req_pending) {
+ DEBUGMSGTL(("agentx/subagent",
+ "dropping commitset - request pending for transid 0x%x in mode %d\n",
+ (unsigned)pdu->transid, asi->mode));
+ //SNMP_FREE(retmagic); XXX necessary?
+ return 1;
+ }
if (asi->mode != SNMP_MSG_INTERNAL_SET_RESERVE2) {
SNMP_FREE(smagic);
snmp_log(LOG_WARNING,
@@ -456,6 +485,13 @@ handle_agentx_packet(int operation, nets
send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
return 1;
}
+ if (asi->req_pending) {
+ DEBUGMSGTL(("agentx/subagent",
+ "dropping cleanupset - request pending for transid 0x%x in mode %d\n",
+ (unsigned)pdu->transid, asi->mode));
+ //SNMP_FREE(retmagic); XXX necessary?
+ return 1;
+ }
if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1 ||
asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE2) {
asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_FREE;
@@ -481,6 +517,13 @@ handle_agentx_packet(int operation, nets
send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
return 1;
}
+ if (asi->req_pending) {
+ DEBUGMSGTL(("agentx/subagent",
+ "dropping undoset - request pending for transid 0x%x in mode %d\n",
+ (unsigned)pdu->transid, asi->mode));
+ //SNMP_FREE(retmagic); XXX necessary?
+ return 1;
+ }
asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_UNDO;
mycallback = handle_subagent_set_response;
retmagic = asi;
@@ -516,6 +559,8 @@ handle_agentx_packet(int operation, nets
retmagic);
if (result == 0) {
snmp_free_pdu( internal_pdu );
+ } else if (asi) {
+ asi->req_pending = 1;
}
return 1;
}
@@ -637,6 +682,7 @@ handle_subagent_set_response(int op, net
{
netsnmp_session *retsess;
struct agent_netsnmp_set_info *asi;
+ int new_mode;
int result;
if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) {
@@ -645,15 +691,63 @@ handle_subagent_set_response(int op, net
DEBUGMSGTL(("agentx/subagent",
"handling agentx subagent set response (mode=%d,req=0x%x,"
- "trans=0x%x,sess=0x%x)\n",
+ "trans=0x%x,sess=0x%x,magic=%p)\n",
(unsigned)pdu->command, (unsigned)pdu->reqid,
- (unsigned)pdu->transid, (unsigned)pdu->sessid));
+ (unsigned)pdu->transid, (unsigned)pdu->sessid,
+ magic));
+
pdu = snmp_clone_pdu(pdu);
if (!pdu)
return 1;
asi = (struct agent_netsnmp_set_info *) magic;
+
+ DEBUGMSGTL(("agentx/subagent",
+ "set response in mode %d (errstat %d, req_pending %d)\n",
+ asi->mode, pdu->errstat, asi->req_pending));
+
+ asi->req_pending = 0;
retsess = asi->sess;
+
+ if (!snmp_sess_pointer(retsess) || retsess->sessid != pdu->sessid) {
+ DEBUGMSGTL(("agentx/subagent",
+ "session id 0x%x gone for set response (transid 0x%x, reqid 0x%x)\n",
+ (unsigned)pdu->sessid, (unsigned)pdu->transid, (unsigned)pdu->reqid));
+
+ result = 0;
+
+ if (!pdu->errstat) {
+ switch (asi->mode) {
+ case SNMP_MSG_INTERNAL_SET_RESERVE1:
+ case SNMP_MSG_INTERNAL_SET_RESERVE2:
+ new_mode = SNMP_MSG_INTERNAL_SET_FREE;
+ break;
+
+ case SNMP_MSG_INTERNAL_SET_ACTION:
+ new_mode = SNMP_MSG_INTERNAL_SET_UNDO;
+ break;
+
+ default:
+ new_mode = 0;
+ }
+
+ if (new_mode) {
+ asi->mode = pdu->command = new_mode;
+ result = snmp_async_send(agentx_callback_sess, pdu,
+ handle_subagent_set_response, asi);
+ }
+ }
+
+ if (result == 0) {
+ /* don't need to (or cannot) FREE/UNDO */
+ free_set_vars(retsess, pdu);
+ snmp_free_pdu(pdu);
+ } else {
+ asi->req_pending = 1;
+ }
+ return 1;
+ }
+
asi->errstat = pdu->errstat;
if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1) {
@@ -669,6 +763,8 @@ handle_subagent_set_response(int op, net
handle_subagent_set_response, asi);
if (result == 0) {
snmp_free_pdu( pdu );
+ } else {
+ asi->req_pending = 1;
}
DEBUGMSGTL(("agentx/subagent",
" going from RESERVE1 -> RESERVE2\n"));

View File

@ -0,0 +1,34 @@
diff -Nrup net-snmp-5.9.1-orig/dist/snmpd.service net-snmp-5.9.1/dist/snmpd.service
--- net-snmp-5.9.1-orig/dist/snmpd.service 2021-10-21 15:22:42.168690298 +0000
+++ net-snmp-5.9.1/dist/snmpd.service 2021-10-21 15:23:10.579979496 +0000
@@ -21,8 +21,11 @@ ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions
# Type=notify is also supported. It should be set when snmpd.socket is not used.
-Type=simple
-ExecStart=/usr/sbin/snmpd -f
+Type=notify
+Environment=OPTIONS="-LS0-6d"
+EnvironmentFile=-/etc/sysconfig/snmpd
+ExecStart=/usr/sbin/snmpd $OPTIONS -f
+ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
diff -Nrup net-snmp-5.9.1-orig/dist/snmptrapd.service net-snmp-5.9.1/dist/snmptrapd.service
--- net-snmp-5.9.1-orig/dist/snmptrapd.service 2021-10-21 15:22:42.184689898 +0000
+++ net-snmp-5.9.1/dist/snmptrapd.service 2021-10-21 15:24:50.933468801 +0000
@@ -19,8 +19,11 @@ RestrictRealtime=true
# end of automatic additions
# Type=notify is also supported. It should be set when snmptrapd.socket is not
# used.
-Type=simple
-ExecStart=/usr/sbin/snmptrapd -f
+Type=notify
+Environment=OPTIONS="-Lsd"
+EnvironmentFile=-/etc/sysconfig/snmptrapd
+ExecStart=/usr/sbin/snmptrapd $OPTIONS -f
+ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,99 @@
Index: net-snmp-5.7.2/testing/rfc1213/snmpfun.sh
===================================================================
--- net-snmp-5.7.2.orig/testing/rfc1213/snmpfun.sh
+++ net-snmp-5.7.2/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 @@ else
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_snmpv3_variable()
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
}
+
Index: net-snmp-5.7.2/testing/rfc1213/test_fun
===================================================================
--- net-snmp-5.7.2.orig/testing/rfc1213/test_fun
+++ net-snmp-5.7.2/testing/rfc1213/test_fun
@@ -51,6 +51,9 @@ test_finish()
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 @@ summary()
fi
}
+

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
diff -Nurp net-snmp-5.9.2-orig/net-snmp-create-v3-user.in net-snmp-5.9.2/net-snmp-create-v3-user.in
--- net-snmp-5.9.2-orig/net-snmp-create-v3-user.in 2022-07-04 16:55:43.067366177 +0200
+++ net-snmp-5.9.2/net-snmp-create-v3-user.in 2022-07-04 16:57:54.927367685 +0200
@@ -138,7 +138,7 @@ prefix=@prefix@
datarootdir=@datarootdir@
# To suppress shellcheck complaints about $prefix and $datarootdir.
: "$prefix" "$datarootdir"
-outfile="@datadir@/snmp/snmpd.conf"
+outfile="/etc/snmp/snmpd.conf"
line="$token $user"
echo "adding the following line to $outfile:"
echo " $line"

24
net-snmp-5.9.2-pie.patch Normal file
View File

@ -0,0 +1,24 @@
diff -Nurp net-snmp-5.9.2-orig/agent/Makefile.in net-snmp-5.9.2/agent/Makefile.in
--- net-snmp-5.9.2-orig/agent/Makefile.in 2022-07-01 01:49:40.000000000 +0200
+++ net-snmp-5.9.2/agent/Makefile.in 2022-07-04 16:48:54.951361517 +0200
@@ -300,7 +300,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG)
- $(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
+ $(LINK) $(CFLAGS) -o $@ -pie ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS)
$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) @AGENTLIBS@
diff -Nurp net-snmp-5.9.2-orig/apps/Makefile.in net-snmp-5.9.2/apps/Makefile.in
--- net-snmp-5.9.2-orig/apps/Makefile.in 2022-07-01 01:49:40.000000000 +0200
+++ net-snmp-5.9.2/apps/Makefile.in 2022-07-04 16:48:54.951361517 +0200
@@ -190,7 +190,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
- $(LINK) ${CFLAGS} -o $@ $(TRAPD_OBJECTS) $(INSTALLLIBS) ${LDFLAGS} ${TRAPLIBS}
+ $(LINK) ${CFLAGS} -o $@ -pie $(TRAPD_OBJECTS) $(INSTALLLIBS) ${LDFLAGS} ${TRAPLIBS}
snmptrap$(EXEEXT): snmptrap.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmptrap.$(OSUFFIX) ${LDFLAGS} ${LIBS}

View File

@ -0,0 +1,94 @@
diff -Nurp net-snmp-5.9.3-orig/agent/snmp_agent.c net-snmp-5.9.3/agent/snmp_agent.c
--- net-snmp-5.9.3-orig/agent/snmp_agent.c 2022-07-13 23:14:14.000000000 +0200
+++ net-snmp-5.9.3/agent/snmp_agent.c 2023-01-05 12:44:03.533604744 +0100
@@ -3719,12 +3719,44 @@ netsnmp_handle_request(netsnmp_agent_ses
return 1;
}
+static int
+check_set_pdu_for_null_varbind(netsnmp_agent_session *asp)
+{
+ int i;
+ netsnmp_variable_list *v = NULL;
+
+ for (i = 1, v = asp->pdu->variables; v != NULL; i++, v = v->next_variable) {
+ if (v->type == ASN_NULL) {
+ /*
+ * Protect SET implementations that do not protect themselves
+ * against wrong type.
+ */
+ DEBUGMSGTL(("snmp_agent", "disallowing SET with NULL var for varbind %d\n", i));
+ asp->index = i;
+ return SNMP_ERR_WRONGTYPE;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
int
handle_pdu(netsnmp_agent_session *asp)
{
int status, inclusives = 0;
netsnmp_variable_list *v = NULL;
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+ /*
+ * Check for ASN_NULL in SET request
+ */
+ if (asp->pdu->command == SNMP_MSG_SET) {
+ status = check_set_pdu_for_null_varbind(asp);
+ if (status != SNMP_ERR_NOERROR) {
+ return status;
+ }
+ }
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+
/*
* for illegal requests, mark all nodes as ASN_NULL
*/
diff -Nurp net-snmp-5.9.3-orig/apps/snmpset.c net-snmp-5.9.3/apps/snmpset.c
--- net-snmp-5.9.3-orig/apps/snmpset.c 2022-07-13 23:14:14.000000000 +0200
+++ net-snmp-5.9.3/apps/snmpset.c 2023-01-05 12:44:06.377533268 +0100
@@ -182,6 +182,7 @@ main(int argc, char *argv[])
case 'x':
case 'd':
case 'b':
+ case 'n': /* undocumented */
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
case 'I':
case 'U':
diff -Nurp net-snmp-5.9.3-orig/testing/fulltests/default/T0142snmpv2csetnull_simple net-snmp-5.9.3/testing/fulltests/default/T0142snmpv2csetnull_simple
--- net-snmp-5.9.3-orig/testing/fulltests/default/T0142snmpv2csetnull_simple 1970-01-01 01:00:00.000000000 +0100
+++ net-snmp-5.9.3/testing/fulltests/default/T0142snmpv2csetnull_simple 2023-01-05 12:44:08.701474860 +0100
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../support/simple_eval_tools.sh
+
+HEADER SNMPv2c set of system.sysContact.0 with NULL varbind
+
+SKIPIF NETSNMP_DISABLE_SET_SUPPORT
+SKIPIF NETSNMP_NO_WRITE_SUPPORT
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+snmp_write_access='all'
+. ./Sv2cconfig
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0"
+
+CHECK ".1.3.6.1.2.1.1.4.0 = STRING:"
+
+CAPTURE "snmpset -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0 n x"
+
+CHECK "Reason: wrongType"
+
+STOPAGENT
+
+FINISHED

View File

@ -0,0 +1,20 @@
diff -Nurp net-snmp-5.9.3-orig/python/netsnmp/client_intf.c net-snmp-5.9.3/python/netsnmp/client_intf.c
--- net-snmp-5.9.3-orig/python/netsnmp/client_intf.c 2022-07-13 23:14:14.000000000 +0200
+++ net-snmp-5.9.3/python/netsnmp/client_intf.c 2022-09-23 16:21:44.040588303 +0200
@@ -872,9 +872,16 @@ py_netsnmp_attr_string(PyObject *obj, co
if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
if (attr) {
+#if PY_MAJOR_VERSION >= 3
*val = PyUnicode_AsUTF8AndSize(attr, len);
Py_DECREF(attr);
return 0;
+#else
+ int retval;
+ retval = PyBytes_AsStringAndSize(attr, val, len);
+ Py_DECREF(attr);
+ return retval;
+#endif
}
}

333
net-snmp-5.9.3-grep.patch Normal file
View File

@ -0,0 +1,333 @@
From 011de0e8fce88702619ba78cc80c900991a8e036 Mon Sep 17 00:00:00 2001
From: Andreas Stieger <Andreas.Stieger@gmx.de>
Date: Sun, 2 Oct 2022 16:10:38 +0200
Subject: [PATCH 02/10] configure: change use of fgrep to AC detected tool
GNU grep 3.8 started throwing warnings for direct usage,
deprecating it in favour of grep -F
[ bvanassche: regenerated configure script ]
---
configure | 4 ++--
configure.d/config_modules_agent | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 727164eb7..65b99c020 100755
--- a/configure
+++ b/configure
@@ -22257,8 +22257,8 @@ $as_echo "$NETSNMP_DEFAULT_MIBS" >&6; }
#
if echo " $agent_module_list " | \
- fgrep ' agentx/agentx_config ' | \
- fgrep ' agentx/protocol ' > /dev/null ; then
+ $FGREP ' agentx/agentx_config ' | \
+ $FGREP ' agentx/protocol ' > /dev/null ; then
NETSNMP_HAVE_AGENTX_LIBS_TRUE=''
NETSNMP_HAVE_AGENTX_LIBS_FALSE='#'
else
diff --git a/configure.d/config_modules_agent b/configure.d/config_modules_agent
index 1132da8d9..0169749d9 100644
--- a/configure.d/config_modules_agent
+++ b/configure.d/config_modules_agent
@@ -814,8 +814,8 @@ AC_MSG_RESULT($NETSNMP_DEFAULT_MIBS)
#
if echo " $agent_module_list " | \
- fgrep ' agentx/agentx_config ' | \
- fgrep ' agentx/protocol ' > /dev/null ; then
+ $FGREP ' agentx/agentx_config ' | \
+ $FGREP ' agentx/protocol ' > /dev/null ; then
NETSNMP_HAVE_AGENTX_LIBS_TRUE=''
NETSNMP_HAVE_AGENTX_LIBS_FALSE='#'
else
--
2.37.3
From 5ae5ad5234a8e0ef3661fe3ec3c77ae57b156bf5 Mon Sep 17 00:00:00 2001
From: Andreas Stieger <Andreas.Stieger@gmx.de>
Date: Sun, 2 Oct 2022 16:34:17 +0200
Subject: [PATCH 03/10] Makefile.in: change use of egrep to AC detected tool
GNU grep 3.8 started throwing warnings for direct usage,
deprecating it in favour of grep -E
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 9b0f0dbac..9fe3781e5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -119,7 +119,7 @@ agentxtrap snmptrapd: @FEATURETARGS@
# local build rules
#
sedscript: sedscript.in include/net-snmp/net-snmp-config.h $(srcdir)/agent/mibgroup/mibdefs.h
- $(CPP) $(srcdir)/sedscript.in | egrep '^s[/#]' | sed 's/REMOVEME//g;s# */#/#g;s/ *#/#/g;s#/ *#/#g;s/# g/#g/;' > sedscript
+ $(CPP) $(srcdir)/sedscript.in | ${EGREP} '^s[/#]' | sed 's/REMOVEME//g;s# */#/#g;s/ *#/#/g;s#/ *#/#g;s/# g/#g/;' > sedscript
echo 's/VERSIONINFO/$(VERSION)/g' >> sedscript
echo 's#DATADIR#$(datadir)#g' >> sedscript
echo 's#LIBDIR#$(libdir)#g' >> sedscript
--
2.37.3
From 9a577171ce728b97aeb42c455f5d09a2c3e2b51f Mon Sep 17 00:00:00 2001
From: Andreas Stieger <Andreas.Stieger@gmx.de>
Date: Sun, 2 Oct 2022 16:35:22 +0200
Subject: [PATCH 04/10] dist: update instructions and scripts to use grep -E
GNU grep 3.8 started throwing warnings for direct usage of egrep,
deprecating it in favour of grep -E
---
dist/RELEASE-INSTRUCTIONS | 2 +-
dist/makerelease.xml | 4 ++--
dist/net-snmp-solaris-build/buildpackage-solaris | 2 +-
dist/nsb-functions | 4 ++--
dist/patme | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dist/RELEASE-INSTRUCTIONS b/dist/RELEASE-INSTRUCTIONS
index 032a0c92e..a38e46a6d 100644
--- a/dist/RELEASE-INSTRUCTIONS
+++ b/dist/RELEASE-INSTRUCTIONS
@@ -87,7 +87,7 @@ STEP: 1.6: Check for changes
Commands to execute:
- svn -u status | egrep '^[^\?]'
+ svn -u status | grep -E '^[^\?]'
(Leaving Step: 1)
diff --git a/dist/makerelease.xml b/dist/makerelease.xml
index 0494fd098..f3c8bfa0e 100644
--- a/dist/makerelease.xml
+++ b/dist/makerelease.xml
@@ -21,7 +21,7 @@
them before continuing!
</text>
<commands>
- <command expectfailure="1">find . -name 'net-snmp-5*' | egrep '^[^\?]'</command>
+ <command expectfailure="1">find . -name 'net-snmp-5*' | grep -E '^[^\?]'</command>
</commands>
</step>
<step type="system" title="Setup Check">
@@ -130,7 +130,7 @@
this step finds outstanding modified files you need to check
them in or revert them before continuing!</text>
<commands>
- <command expectfailure="1">git status --porcelain | egrep '^[^\?]'</command>
+ <command expectfailure="1">git status --porcelain | grep -E '^[^\?]'</command>
</commands>
</step>
</steps>
diff --git a/dist/net-snmp-solaris-build/buildpackage-solaris b/dist/net-snmp-solaris-build/buildpackage-solaris
index 31f4f0c0e..72971111a 100644
--- a/dist/net-snmp-solaris-build/buildpackage-solaris
+++ b/dist/net-snmp-solaris-build/buildpackage-solaris
@@ -94,7 +94,7 @@ f snmp /etc/init.d/snmpd=./snmpd-init.d 0755 root sys
==
pkgproto -c snmp $TMP=/ |\
-egrep -v '^d .* / |^d .* /var |^d .* /opt |^ .*perllocal.pod=' |\
+grep -E -v '^d .* / |^d .* /var |^d .* /opt |^ .*perllocal.pod=' |\
sed -e "s/ $owner $group\$//" >> prototype || exit $?
# and ignore top level directories (must pre-exist)
diff --git a/dist/nsb-functions b/dist/nsb-functions
index 4865cc28a..f42a527a8 100644
--- a/dist/nsb-functions
+++ b/dist/nsb-functions
@@ -364,10 +364,10 @@ nsb_make()
# checking $? would only get us the rc from tee, which is useless
nsb_info "Checking for errors..."
- egrep -i "error|fail|warn|no such|exists|t find |ermission denied" $nsb_make_OUTPUT \
+ grep -E -i "error|fail|warn|no such|exists|t find |ermission denied" $nsb_make_OUTPUT \
> nsb_make-$target-allerrs.$NSB_DATE
# allow for a few exceptions
- egrep -v -i "^ok|testing .*failure|[a-z&_](fail|error)|warn|error(mib|\.3)|(LOG|SNMP)_ERR|In function|= FAILURE|DEBUGMSG|/\*|static library .* is not portable" nsb_make-$target-allerrs.$NSB_DATE \
+ grep -E -v -i "^ok|testing .*failure|[a-z&_](fail|error)|warn|error(mib|\.3)|(LOG|SNMP)_ERR|In function|= FAILURE|DEBUGMSG|/\*|static library .* is not portable" nsb_make-$target-allerrs.$NSB_DATE \
> nsb_make-$target-errs.$NSB_DATE
if [ -s nsb_make-$target-errs.$NSB_DATE ]; then
nsb_prompt "press enter to view errors"
diff --git a/dist/patme b/dist/patme
index 0fd50ee4a..6e62c80f9 100755
--- a/dist/patme
+++ b/dist/patme
@@ -101,7 +101,7 @@ sub load_primaries {
patch_info =>
qw_primary('check','Checking code directory status:', '',
[qw_paragraph('patch pieces:',
- sub { capture("egrep '^(---|\\+\\+\\+)' " .
+ sub { capture("grep -E '^(---|\\+\\+\\+)' " .
qwparam('patchfile'))},
width => 80,
height => 30),
--
2.37.3
From 1023b76d53a279d44fa0629c1fd3a3b82d39eb42 Mon Sep 17 00:00:00 2001
From: Andreas Stieger <Andreas.Stieger@gmx.de>
Date: Sun, 2 Oct 2022 16:36:57 +0200
Subject: [PATCH 05/10] local: convert direct usage of egrep to grep -E
GNU grep 3.8 started throwing warnings for direct usage,
deprecating it in favour of grep -E
[ bvanassche: changed one occurrence of egrep into grep -F instead of grep ]
---
local/gittools/shell-functions | 6 +++---
local/mib2c-update | 4 ++--
local/minimalist/feature-remove | 6 +++---
local/snmp-ucd.sh | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/local/gittools/shell-functions b/local/gittools/shell-functions
index eafcbfdb4..0b09df323 100644
--- a/local/gittools/shell-functions
+++ b/local/gittools/shell-functions
@@ -26,7 +26,7 @@ _ns_switchtobuilddir () {
_ns_getbuilddir() {
nssuffix=${1:-$nssuffix}
- nsbranch=`git branch | egrep '^\*' | sed 's/^..//'`
+ nsbranch=`git branch | grep -E '^\*' | sed 's/^..//'`
NSBUILDDIR="$nsbuildroot/$nsbranch"
NSSRCDIR="$PWD"
@@ -334,7 +334,7 @@ nsrollup() {
fi
if [ -f dist/release ] ; then
- if [ "`egrep ^$branch dist/release`" = "$branch rc" ] ; then
+ if [ "`grep -E ^$branch dist/release`" = "$branch rc" ] ; then
$nsverbose Skipping: branch is in rc phase of release
nsbranchesnotdone="$nsbranchesnotdone $branch"
@@ -411,7 +411,7 @@ nsrollup() {
}
nspull() {
- nscurrentbranch=`git branch | egrep '^\*' | sed 's/^..//'`
+ nscurrentbranch=`git branch | grep -E '^\*' | sed 's/^..//'`
_ns_checkclean
if [ $NSCLEAN != 1 ]; then
return
diff --git a/local/mib2c-update b/local/mib2c-update
index 4282f3332..5fe5fd33d 100755
--- a/local/mib2c-update
+++ b/local/mib2c-update
@@ -157,7 +157,7 @@ do_cp()
die "src $src is not a directory"
fi
safecd "$src"
- files=`ls ./*"$UPDATE_OID"* 2>/dev/null| egrep "(file|onf|m2d|txt|\.c|\.h)$"`
+ files=`ls ./*"$UPDATE_OID"* 2>/dev/null| grep -E "(file|onf|m2d|txt|\.c|\.h)$"`
if [ -z "$files" ]; then
echo " no files to copy from $src"
else
@@ -174,7 +174,7 @@ do_cp()
save_diff()
{
echo "Creating patch for your custom code"
- cnt=`ls ./"$UPDATE_CURR/"*"$UPDATE_OID"* 2>/dev/null | egrep "(file|onf|m2d|txt|\.c|\.h)$" | wc -l`
+ cnt=`ls ./"$UPDATE_CURR/"*"$UPDATE_OID"* 2>/dev/null | grep -E "(file|onf|m2d|txt|\.c|\.h)$" | wc -l`
if [ "$cnt" -eq 0 ]; then
echo " no custom code!"
FIRST_RUN=1
diff --git a/local/minimalist/feature-remove b/local/minimalist/feature-remove
index aae340d93..504f26e0b 100755
--- a/local/minimalist/feature-remove
+++ b/local/minimalist/feature-remove
@@ -99,15 +99,15 @@ for i in `grep NETSNMP_FEATURE_PROVIDE_ $featureheaderin | sed 's/.*FEATURE_PROV
#
# check to see if something required a parent
#
- elif egrep NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal > /dev/null ; then
- parentnames=`egrep NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal | sed 's/.*CHILD_OF_//;s/ .*//;'`
+ elif grep -E NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal > /dev/null ; then
+ parentnames=`grep -E NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal | sed 's/.*CHILD_OF_//;s/ .*//;'`
foundone=0
for parentname in $parentnames ; do
# if the parent was desired, then we are too:
if test $foundone = 0 ; then
- if egrep "NETSNMP_FEATURE_HAS_${parentname} " $featureheader > /dev/null ; then
+ if grep -E "NETSNMP_FEATURE_HAS_${parentname} " $featureheader > /dev/null ; then
echo "#define NETSNMP_FEATURE_HAS_$i 1" >> $featureheader
haslist="${haslist}${i} "
foundone=1
diff --git a/local/snmp-ucd.sh b/local/snmp-ucd.sh
index 7d16b746a..98d4094d0 100755
--- a/local/snmp-ucd.sh
+++ b/local/snmp-ucd.sh
@@ -60,7 +60,7 @@ killproc() { # <program> [signal]
#
pid=`pidofproc $base 2>/dev/null`
[ -z "$pid" ] && {
- pid=`ps $PSARGS | egrep $base | egrep -v egrep | egrep -v $0 | awk '{ print $2 }'`;
+ pid=`ps $PSARGS | grep -F "$base" | grep -v grep | grep -v $0 | awk '{ print $2 }'`;
}
[ -z "$pid" ] && {
echo "`basename $0`: killproc: Could not find process ID."
--
2.37.3
From 2b048bbe20d0e17ed6091c7ee75abc78e27423b5 Mon Sep 17 00:00:00 2001
From: Andreas Stieger <Andreas.Stieger@gmx.de>
Date: Sun, 2 Oct 2022 16:38:37 +0200
Subject: [PATCH 06/10] net-snmp-create-v3-user: convert egrep to grep -E
GNU grep 3.8 started throwing warnings for direct usage,
deprecating it in favour of grep -E
---
net-snmp-create-v3-user.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
index 19895a178..87121b9a1 100644
--- a/net-snmp-create-v3-user.in
+++ b/net-snmp-create-v3-user.in
@@ -3,7 +3,7 @@
# this shell script is designed to add new SNMPv3 users
# to Net-SNMP config file.
-if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then
+if @PSCMD@ | @EGREP@ ' snmpd *$' > /dev/null 2>&1 ; then
echo "Apparently at least one snmpd demon is already running."
echo "You must stop them in order to use this command."
exit 1
--
2.37.3
From bc314524507e39cc283904e69d2a670e1ee7a6be Mon Sep 17 00:00:00 2001
From: Andreas Stieger <Andreas.Stieger@gmx.de>
Date: Sun, 2 Oct 2022 16:39:57 +0200
Subject: [PATCH 07/10] testing/fulltests/support/simple_eval_tools.sh: egrep
to grep -E
GNU grep 3.8 started throwing warnings for direct usage,
deprecating it in favour of grep -E
---
testing/fulltests/support/simple_eval_tools.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testing/fulltests/support/simple_eval_tools.sh b/testing/fulltests/support/simple_eval_tools.sh
index 4b2178618..858c20f75 100644
--- a/testing/fulltests/support/simple_eval_tools.sh
+++ b/testing/fulltests/support/simple_eval_tools.sh
@@ -474,7 +474,7 @@ CHECKANDDIE() {
# Returns: Count of matched lines.
#
CHECKEXACT() { # <pattern_to_match_exactly>
- rval=`egrep -c "^$*\$|^$*[^a-zA-Z0-9_]|[^a-zA-Z0-9_]$*\$|[^a-zA-Z0-9_]$*[^a-zA-Z0-9_]" "$junkoutputfile" 2>/dev/null`
+ rval=`grep -E -c "^$*\$|^$*[^a-zA-Z0-9_]|[^a-zA-Z0-9_]$*\$|[^a-zA-Z0-9_]$*[^a-zA-Z0-9_]" "$junkoutputfile" 2>/dev/null`
snmp_last_test_result=$rval
EXPECTRESULT 1 # default
return $rval
--
2.37.3

BIN
net-snmp-5.9.3.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

16
net-snmp-5.9.3.tar.gz.asc Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE0Pj0ldphYMRO/78Q8HudLayxn9YFAmLPNbAACgkQ8HudLayx
n9ZoYRAAutAiZ4PzrWLkK2OUssCCbacKd+mswSuPsDOGe9OiJLedXGvI2+0iApba
avm3QZUDVID4LbHlNNHZxUWjQbCfl994pu5N0RHbJUZL9lLunkUDKZHv7AY/UCc4
cb35s0n8OTPpud7q3z+T1cmFV4C/mXaji2f/CAHu4biWqT1SUE3eMADgT/9hxJES
0wEk1vVus0Y7qj6J2WQ5TepmuTwMB22ynWs1ffIxSrGtMm7YRigblCeNwCwXEeMY
vdwoxeTNAloJB6xzcjJ9sHYU6fHdlghNg1fwJZ/F6zAiVeRSij/jvNNWYVMYnsuC
Nwqa2RnhQv/OzIqyjo5rn/h7X0WI5XXT4x1XQQzOCKr4nb2tPYl+Me3sT/56nMRU
nUJK8Mak+0ygt0FUeRv5UUsWryXZyoDNxbF+fBxR2/S9RWGaSliIddld9KSImAYW
Y6EO71tqYX137jJ0/KcXF7BOVZ8EvEkVcaphz236vYJoa15XgDm1MEg92Dv2QFtU
CevMidbtMew0+9LxI3ZpAasGlbzC1t7WO/iKgHtGku67Ke+n+eB95ZYnTkCPLEtd
185Ln5ZylhvHpMvYrxDhIEiKvDyTO/lefN/ovLwhQNNmDtUntiKvQh5jdiFwos4/
RxhzVnVdGGKSfLXwfZakU4QACfL/5YxxPtm/6h05dy/TIflZWAA=
=nlF8
-----END PGP SIGNATURE-----

3
net-snmp-rpmlintrc Normal file
View File

@ -0,0 +1,3 @@
addFilter("net-snmp-devel.* files-duplicate.*man.*")
addFilter("net-snmp.*incoherent-init-script-name")
addFilter("perl-SNMP.* zero-length.*\.bs")

2
net-snmp-tmpfs.conf Normal file
View File

@ -0,0 +1,2 @@
d /run/net-snmp 0755 root root
L /var/agentx - - - - /run/agentx

1510
net-snmp.changes Normal file

File diff suppressed because it is too large Load Diff

51
net-snmp.keyring Normal file
View File

@ -0,0 +1,51 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
=fpTJ
-----END PGP PUBLIC KEY BLOCK-----

17
net-snmp.logrotate Normal file
View File

@ -0,0 +1,17 @@
/var/log/net-snmpd.log {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
create 600 root root
su root root
sharedscripts
postrotate
/usr/bin/systemctl try-restart snmpd.service >/dev/null
/usr/bin/systemctl try-restart snmptrapd.service >/dev/null
endscript
}

465
net-snmp.spec Normal file
View File

@ -0,0 +1,465 @@
#
# spec file for package net-snmp
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define netsnmp_logfile %{_localstatedir}/log/net-snmpd.log
%define netsnmp_agentx_socket_dir_fhs %{_rundir}/agentx
%define netsnmp_agentx_socket_dir_rfc %{_localstatedir}/agentx
# Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
%ifnarch s390 s390x
%define netsnmp_with_sensors 1
%endif
%define libname libsnmp40
%bcond_without python2
Name: net-snmp
Version: 5.9.3
Release: 0
Summary: SNMP Daemon
License: BSD-3-Clause AND MIT
Group: Productivity/Networking/Other
URL: https://sourceforge.net/projects/net-snmp
Source: https://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/%{name}-%{version}.tar.gz
Source1: snmpd.conf
Source2: README.SUSE
Source3: net-snmp.logrotate
Source4: test_installed
Source7: https://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/%{name}-%{version}.tar.gz.asc
Source8: http://www.net-snmp.org/net-snmp-admin.asc#/%{name}.keyring
Source10: snmpd.sysconfig
Source11: snmptrapd.sysconfig
Source20: net-snmp-tmpfs.conf
Source98: net-snmp-rpmlintrc
Source99: baselibs.conf
Patch1: net-snmp-5.9.1-socket-path.patch
Patch2: net-snmp-5.9.1-testing-empty-arptable.patch
Patch3: net-snmp-5.9.2-pie.patch
Patch4: net-snmp-5.9.1-net-snmp-config-headercheck.patch
Patch5: net-snmp-5.9.1-perl-tk-warning.patch
Patch6: net-snmp-5.9.1-velocity-mib.patch
Patch7: net-snmp-5.9.1-snmpstatus-suppress-output.patch
Patch8: net-snmp-5.9.1-fix-Makefile.PL.patch
Patch9: net-snmp-5.9.1-modern-rpm-api.patch
Patch10: net-snmp-5.9.1-add-lustre-fs-support.patch
Patch11: net-snmp-5.9.1-harden_snmpd.service.patch
Patch12: net-snmp-5.9.1-harden_snmptrapd.service.patch
Patch13: net-snmp-5.9.1-suse-systemd-service-files.patch
Patch14: net-snmp-5.9.2-fix-create-v3-user-outfile.patch
Patch15: net-snmp-5.9.1-subagent-set-response.patch
Patch16: net-snmp-5.9.3-fixed-python2-bindings.patch
Patch17: net-snmp-5.9.3-grep.patch
Patch18: net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: procps
BuildRequires: python-rpm-macros
BuildRequires: rpm-devel
BuildRequires: systemd-rpm-macros
BuildRequires: tcpd-devel
Requires: logrotate
Requires: perl-SNMP = %{version}
Requires: perl-TermReadKey
Requires(post): %fillup_prereq
%{?systemd_requires}
%if 0%{?netsnmp_with_sensors}
BuildRequires: libsensors4-devel
%endif
%if 0%{?suse_version} >= 1550
# TW: generate subpackages for every python3 flavor
%define python_subpackage_only 1
%python_subpackages
%else
# same "defaults" for all distributions, used in files section
%define python_files() -n python3-%{**}
%define python_sitearch %{python3_sitearch}
%endif
%description
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
This package was originally based on the CMU 2.1.2.1 snmp code. It was
renamed from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp
to net-snmp in November 2000.
%package -n %{libname}
Summary: Shared Libraries from net-snmp
License: BSD-3-Clause AND MIT
Group: System/Libraries
Requires: perl-base = %{perl_version}
Requires: snmp-mibs >= %{version}
# Version 5.9.2 was wrongly packaging .so.39 in libsnmp40
Conflicts: libsnmp40 <= 5.9.2
%description -n %{libname}
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
* An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
* Command-line applications to retrieve and manipulate information from
SNMP-capable devices
* A daemon application for receiving SNMP notifications
* A library for developing new SNMP applications, with C and Perl APIs
* A graphical MIB browser.
This package holds the shared libraries from the net-snmp package.
%package devel
Summary: Development files from net-snmp
License: BSD-3-Clause AND MIT
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
# for mib2c
Requires: perl
Requires: perl-SNMP = %{version}
Requires: rpm-devel
Requires: tcpd-devel
Requires: zlib-devel
Requires: pkgconfig(libssl)
%if 0%{?netsnmp_with_sensors}
Requires: libsensors4-devel
%endif
%description devel
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
* An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
* Command-line applications to retrieve and manipulate information from
SNMP-capable devices
* A daemon application for receiving SNMP notifications
* A library for developing new SNMP applications, with C and Perl APIs
* A graphical MIB browser.
This package holds the development headers, libraries and API documentation
from the net-snmp package.
%package -n snmp-mibs
Summary: MIB files from net-snmp
License: BSD-3-Clause AND MIT
Group: Productivity/Networking/Other
%description -n snmp-mibs
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
This package holds the MIB files from the net-snmp package.
%package -n perl-SNMP
Summary: Perl5 SNMP Extension Module
License: GPL-2.0-or-later
Group: Development/Libraries/Perl
Requires: %{name} = %{version}
Requires: perl-base = %{perl_version}
%description -n perl-SNMP
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
%if 0%{?python_subpackage_only}
%package -n python-%{name}
Summary: The Python 3 'netsnmp' module for the Net-SNMP
License: BSD-3-Clause AND MIT
Group: Development/Libraries/Python
Requires: %{libname} = %{version}
%description -n python-%{name}
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
Net-SNMP toolkit library.
%else
%package -n python2-%{name}
Summary: The Python 'netsnmp' module for the Net-SNMP
License: BSD-3-Clause AND MIT
Group: Development/Libraries/Python
Requires: %{libname} = %{version}
Provides: %{name}-python = %{version}
Obsoletes: %{name}-python < %{version}
Provides: python-%{name} = %{version}
%description -n python2-%{name}
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
Net-SNMP toolkit library.
%package -n python3-%{name}
Summary: The Python 3 'netsnmp' module for the Net-SNMP
License: BSD-3-Clause AND MIT
Group: Development/Libraries/Python
Requires: %{libname} = %{version}
%description -n python3-%{name}
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
Net-SNMP toolkit library.
%endif
%prep
%setup -q
%autopatch -p1
%build
MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
tsm-mib tlstm-mib"
%if 0%{?netsnmp_with_sensors}
MIBS="$MIBS ucd-snmp/lmsensorsMib"
%endif
autoreconf -fvi
%configure \
--with-sys-contact="root@localhost" \
--with-sys-location="unknown" \
--with-mib-modules="$MIBS" \
--with-cflags="%{optflags} -fcommon" \
--with-ldflags="-Wl,-z,relro -Wl,-z,now" \
--with-persistent-directory="%{_localstatedir}/lib/net-snmp" \
--with-agentx-socket="%{netsnmp_agentx_socket_dir_fhs}/master" \
--with-temp-file-pattern=%{_localstatedir}/run/net-snmp/snmp-tmp-XXXXXX \
--with-logfile="%{netsnmp_logfile}" \
--with-libwrap="%{_prefix}" \
--with-perl-modules="INSTALLDIRS=vendor" \
--with-defaults \
--with-pic \
--sysconfdir=%{_sysconfdir} \
--enable-shared \
--disable-static \
--enable-as-needed \
--without-root-access \
--enable-local-smux \
--enable-ipv6 \
--enable-ucd-snmp-compatibility \
--enable-mfd-rewrites \
--with-security-modules=tsm,usm \
--with-transports=TLSTCP,DTLSUDP \
--with-systemd \
--with-openssl \
--enable-blumenthal-aes \
--disable-des \
--disable-md5
# Parallel build deps not properly stated
%make_build -j1
pushd python
%python_exec setup.py build --basedir="../"
popd
%install
%make_install INSTALL_PREFIX=%{buildroot}
install -Dd %{buildroot}%{_localstatedir}/log %{buildroot}%{_localstatedir}/lib/net-snmp %{buildroot}%{_libexecdir}/net-snmp/agents %{buildroot}%{netsnmp_agentx_socket_dir_fhs}
install -D -m 0644 dist/snmpd.service %{buildroot}%{_unitdir}/snmpd.service
install -D -m 0644 dist/snmptrapd.service %{buildroot}%{_unitdir}/snmptrapd.service
install -D -m 0600 %{SOURCE1} %{buildroot}%{_sysconfdir}/snmp/snmpd.conf
install -m 0644 %{SOURCE2} .
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_distconfdir}/logrotate.d
install -D -m 0644 %{SOURCE3} %{buildroot}%{_distconfdir}/logrotate.d/net-snmp
%else
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/net-snmp
%endif
install -m 0744 %{SOURCE4} testing/
ln -sf service %{buildroot}%{_sbindir}/rcsnmpd
ln -sf service %{buildroot}%{_sbindir}/rcsnmptrapd
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
pushd python
%python_install
popd
grep -a -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 %{SOURCE10} %{buildroot}%{_fillupdir}/sysconfig.snmpd
install -D -m 0644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.snmptrapd
# tmpfiles
install -m 755 -d %{buildroot}/%{_tmpfilesdir}
install -m 644 %{SOURCE20} %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
#
ln -s -f %{netsnmp_agentx_socket_dir_fhs} %{buildroot}%{netsnmp_agentx_socket_dir_rfc}
#
find %{buildroot} -type f -name "*.la" -delete -print
%pre
%service_add_pre snmpd.service snmptrapd.service
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/net-snmp ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
%if 0%{?suse_version} > 1500
%posttrans
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/net-snmp ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
%post
%fillup_only -n snmpd
%fillup_only -n snmptrapd
%tmpfiles_create %{_tmpfilesdir}/net-snmp.conf
%service_add_post snmpd.service snmptrapd.service
%preun
%service_del_preun snmpd.service snmptrapd.service
%postun
%service_del_postun snmpd.service snmptrapd.service
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%license COPYING
%doc AGENT.txt EXAMPLE.conf EXAMPLE.conf.def
%doc FAQ NEWS TODO CHANGES
%doc README README.agent-mibs README.agentx README.krb5 README.snmpv3 README.thread
%dir %{_sysconfdir}/snmp
%config(noreplace) %{_sysconfdir}/snmp/snmpd.conf
%{_unitdir}/snmpd.service
%{_unitdir}/snmptrapd.service
%{_tmpfilesdir}/net-snmp.conf
%{_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}/snmptls
%{_bindir}/snmptranslate
%{_bindir}/snmptrap
%{_bindir}/snmpusm
%{_bindir}/snmpvacm
%{_bindir}/snmpwalk
%{_bindir}/traptoemail
%{_bindir}/net-snmp-create-v3-user
%{_bindir}/net-snmp-cert
%{_bindir}/agentxtrap
%{_bindir}/snmp-bridge-mib
%{_bindir}/checkbandwidth
%{_bindir}/snmpping
%{_bindir}/snmpps
%{_bindir}/snmptop
%dir %{_libexecdir}/net-snmp
%dir %{_libexecdir}/net-snmp/agents
%{_mandir}/man[158]/*
%{_sbindir}/*
%{_localstatedir}/lib/net-snmp
%dir %ghost %attr(700,root,root) %{netsnmp_agentx_socket_dir_fhs}
%ghost %{netsnmp_logfile}
%if 0%{?suse_version} > 1500
%{_distconfdir}/logrotate.d/net-snmp
%else
%config(noreplace) %{_sysconfdir}/logrotate.d/net-snmp
%endif
%{_fillupdir}/sysconfig.snmpd
%{_fillupdir}/sysconfig.snmptrapd
%{netsnmp_agentx_socket_dir_rfc}
%{_datadir}/snmp/snmpconf-data/
%{_datadir}/snmp/snmp_perl.pl
%{_datadir}/snmp/snmp_perl_trapd.pl
%files -n snmp-mibs
%dir %{_datadir}/snmp
%{_datadir}/snmp/mibs/
%files -n %{libname}
%license COPYING
%{_libdir}/libsnmp*.so.*
%{_libdir}/libnetsnmp*.so.*
%files devel
%doc ChangeLog PORTING
%{_mandir}/man3/*
%{_includedir}/ucd-snmp
%{_includedir}/net-snmp
%{_libdir}/libsnmp*.so
%{_libdir}/libnetsnmp*.so
%{_libdir}/pkgconfig/netsnmp-agent.pc
%{_libdir}/pkgconfig/netsnmp.pc
%{_bindir}/mib2c
%{_bindir}/mib2c-update
%{_datadir}/snmp/mib2c*
%files -n perl-SNMP
%{perl_vendorarch}/auto/SNMP
%{perl_vendorarch}/auto/NetSNMP
%{perl_vendorarch}/Bundle
%{perl_vendorarch}/SNMP.pm
%{perl_vendorarch}/NetSNMP
%{_bindir}/tkmib
%if %{with python2} && ! 0%{?python_subpackage_only}
%files -n python2-%{name}
%doc README
%{python2_sitearch}/*
%endif
%files %{python_files %{name}}
%doc README
%{python_sitearch}/*
%changelog

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

9
snmpd.sysconfig Normal file
View File

@ -0,0 +1,9 @@
## Path: System/Net-SNMP
## Description: snmpd command line options
## Type: string
## Default: ""
#
# '-f' is implicitly added by snmptrapd systemd unit file
# OPTIONS="-L60-6d"
#
OPTIONS=""

9
snmptrapd.sysconfig Normal file
View File

@ -0,0 +1,9 @@
## Path: System/Net-SNMP
## Description: snmptrapd command line options
## Type: string
## Default: ""
#
# '-f' is implicitly added by snmptrapd systemd unit file
# OPTIONS="-Lsd"
#
OPTIONS=""

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