forked from pool/net-snmp
Accepting request 966136 from network:utilities
OBS-URL: https://build.opensuse.org/request/show/966136 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/net-snmp?expand=0&rev=100
This commit is contained in:
commit
3c1595c335
12
net-snmp-5.9.1-fix-create-v3-user-outfile.patch
Normal file
12
net-snmp-5.9.1-fix-create-v3-user-outfile.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nurp net-snmp-5.9.1-orig/net-snmp-create-v3-user.in net-snmp-5.9.1/net-snmp-create-v3-user.in
|
||||
--- net-snmp-5.9.1-orig/net-snmp-create-v3-user.in 2021-05-26 00:19:35.000000000 +0200
|
||||
+++ net-snmp-5.9.1/net-snmp-create-v3-user.in 2022-03-09 16:15:47.782006944 +0100
|
||||
@@ -136,7 +136,7 @@ fi
|
||||
echo "$line" >> "$outfile"
|
||||
# Avoid that configure complains that this script ignores @datarootdir@
|
||||
echo "@datarootdir@" >/dev/null
|
||||
-outfile="@datadir@/snmp/snmpd.conf"
|
||||
+outfile="/etc/snmp/snmpd.conf"
|
||||
line="$token $user"
|
||||
echo "adding the following line to $outfile:"
|
||||
echo " $line"
|
187
net-snmp-5.9.1-subagent-set-response.patch
Normal file
187
net-snmp-5.9.1-subagent-set-response.patch
Normal 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"));
|
@ -1,3 +1,35 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 30 15:32:41 UTC 2022 - Alexander Bergmann <abergmann@suse.com>
|
||||
|
||||
- Decouple snmp-mibs from net-snmp version to allow major version
|
||||
upgrade (bsc#1196955).
|
||||
- Fix LFH violation during v3 user creation (bsc#1181591).
|
||||
Add net-snmp-5.9.1-fix-create-v3-user-outfile.patch
|
||||
- Fix subagent crash at save_set_var() (bsc#1178021).
|
||||
Add net-snmp-5.9.1-subagent-set-response.patch
|
||||
- Fix missing sysconfig files creation (bsc#1108471).
|
||||
- Rename patches to version number 5.9.1:
|
||||
delete:
|
||||
* net-snmp-5.8-socket-path.patch
|
||||
* net-snmp-5.8-testing-empty-arptable.patch
|
||||
* net-snmp-5.8-pie.patch
|
||||
* net-snmp-5.8-net-snmp-config-headercheck.patch
|
||||
* net-snmp-5.8-perl-tk-warning.patch
|
||||
* net-snmp-5.8-velocity-mib.patch
|
||||
* net-snmp-5.8-snmpstatus-suppress-output.patch
|
||||
* net-snmp-5.8-fix-Makefile.PL.patch
|
||||
* net-snmp-5.8-modern-rpm-api.patch
|
||||
add:
|
||||
* net-snmp-5.9.1-socket-path.patch
|
||||
* net-snmp-5.9.1-testing-empty-arptable.patch
|
||||
* net-snmp-5.9.1-pie.patch
|
||||
* net-snmp-5.9.1-net-snmp-config-headercheck.patch
|
||||
* net-snmp-5.9.1-perl-tk-warning.patch
|
||||
* net-snmp-5.9.1-velocity-mib.patch
|
||||
* net-snmp-5.9.1-snmpstatus-suppress-output.patch
|
||||
* net-snmp-5.9.1-fix-Makefile.PL.patch
|
||||
* net-snmp-5.9.1-modern-rpm-api.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 24 21:02:46 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -48,19 +48,21 @@ Source11: snmptrapd.sysconfig
|
||||
Source20: net-snmp-tmpfs.conf
|
||||
Source98: net-snmp-rpmlintrc
|
||||
Source99: baselibs.conf
|
||||
Patch1: net-snmp-5.8-socket-path.patch
|
||||
Patch2: net-snmp-5.8-testing-empty-arptable.patch
|
||||
Patch3: net-snmp-5.8-pie.patch
|
||||
Patch4: net-snmp-5.8-net-snmp-config-headercheck.patch
|
||||
Patch5: net-snmp-5.8-perl-tk-warning.patch
|
||||
Patch6: net-snmp-5.8-velocity-mib.patch
|
||||
Patch7: net-snmp-5.8-snmpstatus-suppress-output.patch
|
||||
Patch8: net-snmp-5.8-fix-Makefile.PL.patch
|
||||
Patch9: net-snmp-5.8-modern-rpm-api.patch
|
||||
Patch1: net-snmp-5.9.1-socket-path.patch
|
||||
Patch2: net-snmp-5.9.1-testing-empty-arptable.patch
|
||||
Patch3: net-snmp-5.9.1-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.1-fix-create-v3-user-outfile.patch
|
||||
Patch15: net-snmp-5.9.1-subagent-set-response.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: autoconf
|
||||
@ -113,7 +115,7 @@ Summary: Shared Libraries from net-snmp
|
||||
License: BSD-3-Clause AND MIT
|
||||
Group: System/Libraries
|
||||
Requires: perl-base = %{perl_version}
|
||||
Requires: snmp-mibs = %{version}
|
||||
Requires: snmp-mibs >= %{version}
|
||||
|
||||
%description -n %{libname}
|
||||
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
|
||||
@ -313,8 +315,8 @@ find %{buildroot} -type f -name "*.la" -delete -print
|
||||
%service_add_pre snmpd.service snmptrapd.service
|
||||
|
||||
%post
|
||||
%fillup_only snmpd
|
||||
%fillup_only snmptrapd
|
||||
%fillup_only -n snmpd
|
||||
%fillup_only -n snmptrapd
|
||||
%tmpfiles_create %{_tmpfilesdir}/net-snmp.conf
|
||||
%service_add_post snmpd.service snmptrapd.service
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user