Resolves: #1531020 - new upstream release 5.8
This commit is contained in:
parent
996278ef68
commit
3278a0ee02
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ net-snmp-5.5.tar.gz
|
||||
/net-snmp-5.7.1.tar.gz
|
||||
/net-snmp-5.7.2.tar.gz
|
||||
/net-snmp-5.7.3.tar.gz
|
||||
/net-snmp-5.8.tar.gz
|
||||
|
@ -1,270 +0,0 @@
|
||||
955511 - net-snmpd crash on time out
|
||||
969061 - net-snmpd crash on time out
|
||||
1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out
|
||||
|
||||
Based on usptream commit 793d596838ff7cb48a73b675d62897c56c9e62df,
|
||||
heavily backported to net-snmp-5.5
|
||||
|
||||
diff -up net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c.disconnect-crash net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c
|
||||
--- net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c.disconnect-crash 2013-07-03 15:26:35.884813210 +0200
|
||||
+++ net-snmp-5.7.2/agent/mibgroup/agentx/master_admin.c 2013-07-03 15:26:35.908813135 +0200
|
||||
@@ -158,6 +158,7 @@ close_agentx_session(netsnmp_session * s
|
||||
for (sp = session->subsession; sp != NULL; sp = sp->next) {
|
||||
|
||||
if (sp->sessid == sessid) {
|
||||
+ netsnmp_remove_delegated_requests_for_session(sp);
|
||||
unregister_mibs_by_session(sp);
|
||||
unregister_index_by_session(sp);
|
||||
unregister_sysORTable_by_session(sp);
|
||||
diff -up net-snmp-5.7.2/agent/mibgroup/agentx/master.c.disconnect-crash net-snmp-5.7.2/agent/mibgroup/agentx/master.c
|
||||
--- net-snmp-5.7.2/agent/mibgroup/agentx/master.c.disconnect-crash 2013-07-03 15:26:35.000000000 +0200
|
||||
+++ net-snmp-5.7.2/agent/mibgroup/agentx/master.c 2013-07-03 15:29:00.644362208 +0200
|
||||
@@ -222,7 +222,7 @@ agentx_got_response(int operation,
|
||||
/* response is too late, free the cache */
|
||||
if (magic)
|
||||
netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
|
||||
- return 0;
|
||||
+ return 1;
|
||||
}
|
||||
requests = cache->requests;
|
||||
|
||||
diff -up net-snmp-5.7.2/agent/snmp_agent.c.disconnect-crash net-snmp-5.7.2/agent/snmp_agent.c
|
||||
--- net-snmp-5.7.2/agent/snmp_agent.c.disconnect-crash 2013-07-03 15:26:35.893813182 +0200
|
||||
+++ net-snmp-5.7.2/agent/snmp_agent.c 2013-07-03 15:28:28.979460861 +0200
|
||||
@@ -1446,6 +1446,7 @@ free_agent_snmp_session(netsnmp_agent_se
|
||||
netsnmp_free_cachemap(asp->cache_store);
|
||||
asp->cache_store = NULL;
|
||||
}
|
||||
+ agent_snmp_session_release_cancelled(asp);
|
||||
SNMP_FREE(asp);
|
||||
}
|
||||
|
||||
@@ -1457,6 +1458,11 @@ netsnmp_check_for_delegated(netsnmp_agen
|
||||
|
||||
if (NULL == asp->treecache)
|
||||
return 0;
|
||||
+
|
||||
+ if (agent_snmp_session_is_cancelled(asp)) {
|
||||
+ printf("request %p cancelled\n", asp);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
for (i = 0; i <= asp->treecache_num; i++) {
|
||||
for (request = asp->treecache[i].requests_begin; request;
|
||||
@@ -1535,39 +1541,48 @@ int
|
||||
netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
|
||||
{
|
||||
netsnmp_agent_session *asp;
|
||||
- int count = 0;
|
||||
+ int total_count = 0;
|
||||
|
||||
for (asp = agent_delegated_list; asp; asp = asp->next) {
|
||||
/*
|
||||
* check each request
|
||||
*/
|
||||
+ int i;
|
||||
+ int count = 0;
|
||||
netsnmp_request_info *request;
|
||||
- for(request = asp->requests; request; request = request->next) {
|
||||
- /*
|
||||
- * check session
|
||||
- */
|
||||
- netsnmp_assert(NULL!=request->subtree);
|
||||
- if(request->subtree->session != sess)
|
||||
- continue;
|
||||
+ for (i = 0; i <= asp->treecache_num; i++) {
|
||||
+ for (request = asp->treecache[i].requests_begin; request;
|
||||
+ request = request->next) {
|
||||
+ /*
|
||||
+ * check session
|
||||
+ */
|
||||
+ netsnmp_assert(NULL!=request->subtree);
|
||||
+ if(request->subtree->session != sess)
|
||||
+ continue;
|
||||
|
||||
- /*
|
||||
- * matched! mark request as done
|
||||
- */
|
||||
- netsnmp_request_set_error(request, SNMP_ERR_GENERR);
|
||||
- ++count;
|
||||
+ /*
|
||||
+ * matched! mark request as done
|
||||
+ */
|
||||
+ netsnmp_request_set_error(request, SNMP_ERR_GENERR);
|
||||
+ ++count;
|
||||
+ }
|
||||
+ }
|
||||
+ if (count) {
|
||||
+ agent_snmp_session_mark_cancelled(asp);
|
||||
+ total_count += count;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if we found any, that request may be finished now
|
||||
*/
|
||||
- if(count) {
|
||||
+ if(total_count) {
|
||||
DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
|
||||
- "%8p\n", count, sess));
|
||||
- netsnmp_check_outstanding_agent_requests();
|
||||
+ "%8p\n", total_count, sess));
|
||||
+ netsnmp_check_delegated_requests();
|
||||
}
|
||||
|
||||
- return count;
|
||||
+ return total_count;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -2739,19 +2754,11 @@ handle_var_requests(netsnmp_agent_sessio
|
||||
return final_status;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * loop through our sessions known delegated sessions and check to see
|
||||
- * if they've completed yet. If there are no more delegated sessions,
|
||||
- * check for and process any queued requests
|
||||
- */
|
||||
void
|
||||
-netsnmp_check_outstanding_agent_requests(void)
|
||||
+netsnmp_check_delegated_requests(void)
|
||||
{
|
||||
netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL;
|
||||
|
||||
- /*
|
||||
- * deal with delegated requests
|
||||
- */
|
||||
for (asp = agent_delegated_list; asp; asp = next_asp) {
|
||||
next_asp = asp->next; /* save in case we clean up asp */
|
||||
if (!netsnmp_check_for_delegated(asp)) {
|
||||
@@ -2790,6 +2797,22 @@ netsnmp_check_outstanding_agent_requests
|
||||
prev_asp = asp;
|
||||
}
|
||||
}
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * loop through our sessions known delegated sessions and check to see
|
||||
+ * if they've completed yet. If there are no more delegated sessions,
|
||||
+ * check for and process any queued requests
|
||||
+ */
|
||||
+void
|
||||
+netsnmp_check_outstanding_agent_requests(void)
|
||||
+{
|
||||
+ netsnmp_agent_session *asp;
|
||||
+
|
||||
+ /*
|
||||
+ * deal with delegated requests
|
||||
+ */
|
||||
+ netsnmp_check_delegated_requests();
|
||||
|
||||
/*
|
||||
* if we are processing a set and there are more delegated
|
||||
@@ -2819,7 +2842,8 @@ netsnmp_check_outstanding_agent_requests
|
||||
|
||||
netsnmp_processing_set = netsnmp_agent_queued_list;
|
||||
DEBUGMSGTL(("snmp_agent", "SET request remains queued while "
|
||||
- "delegated requests finish, asp = %8p\n", asp));
|
||||
+ "delegated requests finish, asp = %8p\n",
|
||||
+ agent_delegated_list));
|
||||
break;
|
||||
}
|
||||
#endif /* NETSNMP_NO_WRITE_SUPPORT */
|
||||
@@ -2880,6 +2904,11 @@ check_delayed_request(netsnmp_agent_sess
|
||||
case SNMP_MSG_GETBULK:
|
||||
case SNMP_MSG_GETNEXT:
|
||||
netsnmp_check_all_requests_status(asp, 0);
|
||||
+ if (agent_snmp_session_is_cancelled(asp)) {
|
||||
+ printf("request %p is cancelled\n", asp);
|
||||
+ DEBUGMSGTL(("snmp_agent","canceling next walk for asp %p\n", asp));
|
||||
+ break;
|
||||
+ }
|
||||
handle_getnext_loop(asp);
|
||||
if (netsnmp_check_for_delegated(asp) &&
|
||||
netsnmp_check_transaction_id(asp->pdu->transid) !=
|
||||
@@ -3838,4 +3867,73 @@ netsnmp_set_all_requests_error(netsnmp_a
|
||||
return error_value;
|
||||
}
|
||||
#endif /* NETSNMP_FEATURE_REMOVE_SET_ALL_REQUESTS_ERROR */
|
||||
+
|
||||
+/*
|
||||
+ * Ugly hack to fix bug #950602 and preserve ABI
|
||||
+ * (the official patch adds netsnmp_agent_session->flags).
|
||||
+ * We must create parallel database of netsnmp_agent_sessions
|
||||
+ * and put cancelled requests there instead of marking
|
||||
+ * netsnmp_agent_session->flags.
|
||||
+ */
|
||||
+static netsnmp_agent_session **cancelled_agent_snmp_sessions;
|
||||
+static int cancelled_agent_snmp_sessions_count;
|
||||
+static int cancelled_agent_snmp_sessions_max;
|
||||
+
|
||||
+int
|
||||
+agent_snmp_session_mark_cancelled(netsnmp_agent_session *session)
|
||||
+{
|
||||
+ DEBUGMSGTL(("agent:cancelled", "Cancelling session %p\n", session));
|
||||
+ if (!session)
|
||||
+ return 0;
|
||||
+ if (cancelled_agent_snmp_sessions_count + 1 > cancelled_agent_snmp_sessions_max) {
|
||||
+ netsnmp_agent_session **aux;
|
||||
+ int max = cancelled_agent_snmp_sessions_max + 10;
|
||||
+ aux = realloc(cancelled_agent_snmp_sessions, sizeof(netsnmp_agent_session*) * max);
|
||||
+ if (!aux)
|
||||
+ return SNMP_ERR_GENERR;
|
||||
+ cancelled_agent_snmp_sessions = aux;
|
||||
+ cancelled_agent_snmp_sessions_max = max;
|
||||
+ }
|
||||
+ cancelled_agent_snmp_sessions[cancelled_agent_snmp_sessions_count] = session;
|
||||
+ cancelled_agent_snmp_sessions_count++;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+agent_snmp_session_is_cancelled(netsnmp_agent_session *session)
|
||||
+{
|
||||
+ int i;
|
||||
+ for (i=0; i<cancelled_agent_snmp_sessions_count; i++)
|
||||
+ if (cancelled_agent_snmp_sessions[i] == session) {
|
||||
+ DEBUGMSGTL(("agent:cancelled", "session %p is cancelled\n", session));
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+agent_snmp_session_release_cancelled(netsnmp_agent_session *session)
|
||||
+{
|
||||
+ int i, j;
|
||||
+
|
||||
+ if (!session)
|
||||
+ return 0;
|
||||
+
|
||||
+ DEBUGMSGTL(("agent:cancelled", "Removing session %p\n", session));
|
||||
+
|
||||
+ /* delete the session from cancelled_agent_snmp_sessions */
|
||||
+ for (i=0, j=0; j<cancelled_agent_snmp_sessions_count; i++, j++)
|
||||
+ if (cancelled_agent_snmp_sessions[j] == session)
|
||||
+ i--; /* don't increase i in this loop iteration */
|
||||
+ else
|
||||
+ cancelled_agent_snmp_sessions[i] = cancelled_agent_snmp_sessions[j];
|
||||
+
|
||||
+ cancelled_agent_snmp_sessions_count = i;
|
||||
+
|
||||
+ for (; i< cancelled_agent_snmp_sessions_max; i++)
|
||||
+ cancelled_agent_snmp_sessions[i] = NULL;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/** @} */
|
||||
+
|
||||
diff -up net-snmp-5.7.2/include/net-snmp/agent/snmp_agent.h.disconnect-crash net-snmp-5.7.2/include/net-snmp/agent/snmp_agent.h
|
||||
--- net-snmp-5.7.2/include/net-snmp/agent/snmp_agent.h.disconnect-crash 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/include/net-snmp/agent/snmp_agent.h 2013-07-03 15:26:35.909813132 +0200
|
||||
@@ -240,6 +240,7 @@ extern "C" {
|
||||
int init_master_agent(void);
|
||||
void shutdown_master_agent(void);
|
||||
int agent_check_and_process(int block);
|
||||
+ void netsnmp_check_delegated_requests(void);
|
||||
void netsnmp_check_outstanding_agent_requests(void);
|
||||
|
||||
int netsnmp_request_set_error(netsnmp_request_info *request,
|
@ -1,354 +0,0 @@
|
||||
Add APSL 2.0 license to the COPYING file.
|
||||
|
||||
There is only one file covered by this license:
|
||||
net-snmp-5.5/agent/mibgroup/host/data_access/swrun_darwin.c
|
||||
|
||||
This file is not used on Linux at all, it's only present in source
|
||||
tarball and net-snmp.src.rpm.
|
||||
|
||||
In addition, it's licensed under APSL 1.1, but it allows to relicense
|
||||
the code to 'any subsequent version of this License published by Apple'.
|
||||
According to http://fedoraproject.org/wiki/Licensing, APSL ver. 2.0 is
|
||||
better for us.
|
||||
|
||||
diff -up net-snmp-5.7.3/COPYING.skiFvk net-snmp-5.7.3/COPYING
|
||||
--- net-snmp-5.7.3/COPYING.skiFvk 2015-02-17 13:33:15.963257594 +0100
|
||||
+++ net-snmp-5.7.3/COPYING 2015-02-17 13:33:37.931241818 +0100
|
||||
@@ -325,3 +325,337 @@ PROFITS; OR BUSINESS INTERRUPTION) HOWEV
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+
|
||||
+---- Part 11: APPLE PUBLIC SOURCE LICENSE (APSL 2.0) ----
|
||||
+
|
||||
+Version 2.0 - August 6, 2003
|
||||
+
|
||||
+Please read this License carefully before downloading this software. By
|
||||
+downloading or using this software, you are agreeing to be bound by the terms
|
||||
+of this License. If you do not or cannot agree to the terms of this License,
|
||||
+please do not download or use the software.
|
||||
+
|
||||
+Apple Note: In January 2007, Apple changed its corporate name from "Apple
|
||||
+Computer, Inc." to "Apple Inc." This change has been reflected below and
|
||||
+copyright years updated, but no other changes have been made to the APSL 2.0.
|
||||
+
|
||||
+1. General; Definitions. This License applies to any program or other
|
||||
+work which Apple Inc. ("Apple") makes publicly available and which contains a
|
||||
+notice placed by Apple identifying such program or work as "Original Code" and
|
||||
+stating that it is subject to the terms of this Apple Public Source License
|
||||
+version 2.0 ("License"). As used in this License:
|
||||
+
|
||||
+1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is the
|
||||
+grantor of rights, (i) claims of patents that are now or hereafter acquired,
|
||||
+owned by or assigned to Apple and (ii) that cover subject matter contained in
|
||||
+the Original Code, but only to the extent necessary to use, reproduce and/or
|
||||
+distribute the Original Code without infringement; and (b) in the case where
|
||||
+You are the grantor of rights, (i) claims of patents that are now or hereafter
|
||||
+acquired, owned by or assigned to You and (ii) that cover subject matter in
|
||||
+Your Modifications, taken alone or in combination with Original Code.
|
||||
+
|
||||
+1.2 "Contributor" means any person or entity that creates or contributes to
|
||||
+the creation of Modifications.
|
||||
+
|
||||
+1.3 "Covered Code" means the Original Code, Modifications, the combination
|
||||
+of Original Code and any Modifications, and/or any respective portions thereof.
|
||||
+
|
||||
+1.4 "Externally Deploy" means: (a) to sublicense, distribute or otherwise
|
||||
+make Covered Code available, directly or indirectly, to anyone other than You;
|
||||
+and/or (b) to use Covered Code, alone or as part of a Larger Work, in any way
|
||||
+to provide a service, including but not limited to delivery of content, through
|
||||
+electronic communication with a client other than You.
|
||||
+
|
||||
+1.5 "Larger Work" means a work which combines Covered Code or portions
|
||||
+thereof with code not governed by the terms of this License.
|
||||
+
|
||||
+1.6 "Modifications" mean any addition to, deletion from, and/or change to,
|
||||
+the substance and/or structure of the Original Code, any previous
|
||||
+Modifications, the combination of Original Code and any previous Modifications,
|
||||
+and/or any respective portions thereof. When code is released as a series of
|
||||
+files, a Modification is: (a) any addition to or deletion from the contents of
|
||||
+a file containing Covered Code; and/or (b) any new file or other representation
|
||||
+of computer program statements that contains any part of Covered Code.
|
||||
+
|
||||
+1.7 "Original Code" means (a) the Source Code of a program or other work as
|
||||
+originally made available by Apple under this License, including the Source
|
||||
+Code of any updates or upgrades to such programs or works made available by
|
||||
+Apple under this License, and that has been expressly identified by Apple as
|
||||
+such in the header file(s) of such work; and (b) the object code compiled from
|
||||
+such Source Code and originally made available by Apple under this License
|
||||
+
|
||||
+1.8 "Source Code" means the human readable form of a program or other work
|
||||
+that is suitable for making modifications to it, including all modules it
|
||||
+contains, plus any associated interface definition files, scripts used to
|
||||
+control compilation and installation of an executable (object code).
|
||||
+
|
||||
+1.9 "You" or "Your" means an individual or a legal entity exercising rights
|
||||
+under this License. For legal entities, "You" or "Your" includes any entity
|
||||
+which controls, is controlled by, or is under common control with, You, where
|
||||
+"control" means (a) the power, direct or indirect, to cause the direction or
|
||||
+management of such entity, whether by contract or otherwise, or (b) ownership
|
||||
+of fifty percent (50%) or more of the outstanding shares or beneficial
|
||||
+ownership of such entity.
|
||||
+
|
||||
+2. Permitted Uses; Conditions & Restrictions. Subject to the terms and
|
||||
+conditions of this License, Apple hereby grants You, effective on the date You
|
||||
+accept this License and download the Original Code, a world-wide, royalty-free,
|
||||
+non-exclusive license, to the extent of Apple's Applicable Patent Rights and
|
||||
+copyrights covering the Original Code, to do the following:
|
||||
+
|
||||
+2.1 Unmodified Code. You may use, reproduce, display, perform, internally
|
||||
+distribute within Your organization, and Externally Deploy verbatim, unmodified
|
||||
+copies of the Original Code, for commercial or non-commercial purposes,
|
||||
+provided that in each instance:
|
||||
+
|
||||
+(a) You must retain and reproduce in all copies of Original Code the
|
||||
+copyright and other proprietary notices and disclaimers of Apple as they appear
|
||||
+in the Original Code, and keep intact all notices in the Original Code that
|
||||
+refer to this License; and
|
||||
+
|
||||
+(b) You must include a copy of this License with every copy of Source Code
|
||||
+of Covered Code and documentation You distribute or Externally Deploy, and You
|
||||
+may not offer or impose any terms on such Source Code that alter or restrict
|
||||
+this License or the recipients' rights hereunder, except as permitted under
|
||||
+Section 6.
|
||||
+
|
||||
+2.2 Modified Code. You may modify Covered Code and use, reproduce,
|
||||
+display, perform, internally distribute within Your organization, and
|
||||
+Externally Deploy Your Modifications and Covered Code, for commercial or
|
||||
+non-commercial purposes, provided that in each instance You also meet all of
|
||||
+these conditions:
|
||||
+
|
||||
+(a) You must satisfy all the conditions of Section 2.1 with respect to the
|
||||
+Source Code of the Covered Code;
|
||||
+
|
||||
+(b) You must duplicate, to the extent it does not already exist, the notice
|
||||
+in Exhibit A in each file of the Source Code of all Your Modifications, and
|
||||
+cause the modified files to carry prominent notices stating that You changed
|
||||
+the files and the date of any change; and
|
||||
+
|
||||
+(c) If You Externally Deploy Your Modifications, You must make Source Code
|
||||
+of all Your Externally Deployed Modifications either available to those to whom
|
||||
+You have Externally Deployed Your Modifications, or publicly available. Source
|
||||
+Code of Your Externally Deployed Modifications must be released under the terms
|
||||
+set forth in this License, including the license grants set forth in Section 3
|
||||
+below, for as long as you Externally Deploy the Covered Code or twelve (12)
|
||||
+months from the date of initial External Deployment, whichever is longer. You
|
||||
+should preferably distribute the Source Code of Your Externally Deployed
|
||||
+Modifications electronically (e.g. download from a web site).
|
||||
+
|
||||
+2.3 Distribution of Executable Versions. In addition, if You Externally
|
||||
+Deploy Covered Code (Original Code and/or Modifications) in object code,
|
||||
+executable form only, You must include a prominent notice, in the code itself
|
||||
+as well as in related documentation, stating that Source Code of the Covered
|
||||
+Code is available under the terms of this License with information on how and
|
||||
+where to obtain such Source Code.
|
||||
+
|
||||
+2.4 Third Party Rights. You expressly acknowledge and agree that although
|
||||
+Apple and each Contributor grants the licenses to their respective portions of
|
||||
+the Covered Code set forth herein, no assurances are provided by Apple or any
|
||||
+Contributor that the Covered Code does not infringe the patent or other
|
||||
+intellectual property rights of any other entity. Apple and each Contributor
|
||||
+disclaim any liability to You for claims brought by any other entity based on
|
||||
+infringement of intellectual property rights or otherwise. As a condition to
|
||||
+exercising the rights and licenses granted hereunder, You hereby assume sole
|
||||
+responsibility to secure any other intellectual property rights needed, if any.
|
||||
+For example, if a third party patent license is required to allow You to
|
||||
+distribute the Covered Code, it is Your responsibility to acquire that license
|
||||
+before distributing the Covered Code.
|
||||
+
|
||||
+3. Your Grants. In consideration of, and as a condition to, the licenses
|
||||
+granted to You under this License, You hereby grant to any person or entity
|
||||
+receiving or distributing Covered Code under this License a non-exclusive,
|
||||
+royalty-free, perpetual, irrevocable license, under Your Applicable Patent
|
||||
+Rights and other intellectual property rights (other than patent) owned or
|
||||
+controlled by You, to use, reproduce, display, perform, modify, sublicense,
|
||||
+distribute and Externally Deploy Your Modifications of the same scope and
|
||||
+extent as Apple's licenses under Sections 2.1 and 2.2 above.
|
||||
+
|
||||
+4. Larger Works. You may create a Larger Work by combining Covered Code
|
||||
+with other code not governed by the terms of this License and distribute the
|
||||
+Larger Work as a single product. In each such instance, You must make sure the
|
||||
+requirements of this License are fulfilled for the Covered Code or any portion
|
||||
+thereof.
|
||||
+
|
||||
+5. Limitations on Patent License. Except as expressly stated in Section
|
||||
+2, no other patent rights, express or implied, are granted by Apple herein.
|
||||
+Modifications and/or Larger Works may require additional patent licenses from
|
||||
+Apple which Apple may grant in its sole discretion.
|
||||
+
|
||||
+6. Additional Terms. You may choose to offer, and to charge a fee for,
|
||||
+warranty, support, indemnity or liability obligations and/or other rights
|
||||
+consistent with the scope of the license granted herein ("Additional Terms") to
|
||||
+one or more recipients of Covered Code. However, You may do so only on Your own
|
||||
+behalf and as Your sole responsibility, and not on behalf of Apple or any
|
||||
+Contributor. You must obtain the recipient's agreement that any such Additional
|
||||
+Terms are offered by You alone, and You hereby agree to indemnify, defend and
|
||||
+hold Apple and every Contributor harmless for any liability incurred by or
|
||||
+claims asserted against Apple or such Contributor by reason of any such
|
||||
+Additional Terms.
|
||||
+
|
||||
+7. Versions of the License. Apple may publish revised and/or new versions
|
||||
+of this License from time to time. Each version will be given a distinguishing
|
||||
+version number. Once Original Code has been published under a particular
|
||||
+version of this License, You may continue to use it under the terms of that
|
||||
+version. You may also choose to use such Original Code under the terms of any
|
||||
+subsequent version of this License published by Apple. No one other than Apple
|
||||
+has the right to modify the terms applicable to Covered Code created under this
|
||||
+License.
|
||||
+
|
||||
+8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in
|
||||
+part pre-release, untested, or not fully tested works. The Covered Code may
|
||||
+contain errors that could cause failures or loss of data, and may be incomplete
|
||||
+or contain inaccuracies. You expressly acknowledge and agree that use of the
|
||||
+Covered Code, or any portion thereof, is at Your sole and entire risk. THE
|
||||
+COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF
|
||||
+ANY KIND AND APPLE AND APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE"
|
||||
+FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
|
||||
+ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
|
||||
+LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF
|
||||
+SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF
|
||||
+QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. APPLE AND EACH
|
||||
+CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE
|
||||
+COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR
|
||||
+REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
|
||||
+ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR
|
||||
+WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE AUTHORIZED
|
||||
+REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You acknowledge
|
||||
+that the Covered Code is not intended for use in the operation of nuclear
|
||||
+facilities, aircraft navigation, communication systems, or air traffic control
|
||||
+machines in which case the failure of the Covered Code could lead to death,
|
||||
+personal injury, or severe physical or environmental damage.
|
||||
+
|
||||
+9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
|
||||
+EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
|
||||
+INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR
|
||||
+YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER
|
||||
+UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCTS
|
||||
+LIABILITY OR OTHERWISE, EVEN IF APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF
|
||||
+THE POSSIBILITY OF SUCH DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL
|
||||
+PURPOSE OF ANY REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF
|
||||
+LIABILITY OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT
|
||||
+APPLY TO YOU. In no event shall Apple's total liability to You for all damages
|
||||
+(other than as may be required by applicable law) under this License exceed the
|
||||
+amount of fifty dollars ($50.00).
|
||||
+
|
||||
+10. Trademarks. This License does not grant any rights to use the
|
||||
+trademarks or trade names "Apple", "Mac", "Mac OS", "QuickTime", "QuickTime
|
||||
+Streaming Server" or any other trademarks, service marks, logos or trade names
|
||||
+belonging to Apple (collectively "Apple Marks") or to any trademark, service
|
||||
+mark, logo or trade name belonging to any Contributor. You agree not to use
|
||||
+any Apple Marks in or as part of the name of products derived from the Original
|
||||
+Code or to endorse or promote products derived from the Original Code other
|
||||
+than as expressly permitted by and in strict compliance at all times with
|
||||
+Apple's third party trademark usage guidelines which are posted at
|
||||
+http://www.apple.com/legal/guidelinesfor3rdparties.html.
|
||||
+
|
||||
+11. Ownership. Subject to the licenses granted under this License, each
|
||||
+Contributor retains all rights, title and interest in and to any Modifications
|
||||
+made by such Contributor. Apple retains all rights, title and interest in and
|
||||
+to the Original Code and any Modifications made by or on behalf of Apple
|
||||
+("Apple Modifications"), and such Apple Modifications will not be automatically
|
||||
+subject to this License. Apple may, at its sole discretion, choose to license
|
||||
+such Apple Modifications under this License, or on different terms from those
|
||||
+contained in this License or may choose not to license them at all.
|
||||
+
|
||||
+12. Termination.
|
||||
+
|
||||
+12.1 Termination. This License and the rights granted hereunder will
|
||||
+terminate:
|
||||
+
|
||||
+(a) automatically without notice from Apple if You fail to comply with any
|
||||
+term(s) of this License and fail to cure such breach within 30 days of becoming
|
||||
+aware of such breach; (b) immediately in the event of the circumstances
|
||||
+described in Section 13.5(b); or (c) automatically without notice from Apple
|
||||
+if You, at any time during the term of this License, commence an action for
|
||||
+patent infringement against Apple; provided that Apple did not first commence
|
||||
+an action for patent infringement against You in that instance.
|
||||
+
|
||||
+12.2 Effect of Termination. Upon termination, You agree to immediately stop
|
||||
+any further use, reproduction, modification, sublicensing and distribution of
|
||||
+the Covered Code. All sublicenses to the Covered Code which have been properly
|
||||
+granted prior to termination shall survive any termination of this License.
|
||||
+Provisions which, by their nature, should remain in effect beyond the
|
||||
+termination of this License shall survive, including but not limited to
|
||||
+Sections 3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other
|
||||
+for compensation, indemnity or damages of any sort solely as a result of
|
||||
+terminating this License in accordance with its terms, and termination of this
|
||||
+License will be without prejudice to any other right or remedy of any party.
|
||||
+
|
||||
+13. Miscellaneous.
|
||||
+
|
||||
+13.1 Government End Users. The Covered Code is a "commercial item" as
|
||||
+defined in FAR 2.101. Government software and technical data rights in the
|
||||
+Covered Code include only those rights customarily provided to the public as
|
||||
+defined in this License. This customary commercial license in technical data
|
||||
+and software is provided in accordance with FAR 12.211 (Technical Data) and
|
||||
+12.212 (Computer Software) and, for Department of Defense purchases, DFAR
|
||||
+252.227-7015 (Technical Data -- Commercial Items) and 227.7202-3 (Rights in
|
||||
+Commercial Computer Software or Computer Software Documentation). Accordingly,
|
||||
+all U.S. Government End Users acquire Covered Code with only those rights set
|
||||
+forth herein.
|
||||
+
|
||||
+13.2 Relationship of Parties. This License will not be construed as
|
||||
+creating an agency, partnership, joint venture or any other form of legal
|
||||
+association between or among You, Apple or any Contributor, and You will not
|
||||
+represent to the contrary, whether expressly, by implication, appearance or
|
||||
+otherwise.
|
||||
+
|
||||
+13.3 Independent Development. Nothing in this License will impair Apple's
|
||||
+right to acquire, license, develop, have others develop for it, market and/or
|
||||
+distribute technology or products that perform the same or similar functions
|
||||
+as, or otherwise compete with, Modifications, Larger Works, technology or
|
||||
+products that You may develop, produce, market or distribute.
|
||||
+
|
||||
+13.4 Waiver; Construction. Failure by Apple or any Contributor to enforce
|
||||
+any provision of this License will not be deemed a waiver of future enforcement
|
||||
+of that or any other provision. Any law or regulation which provides that the
|
||||
+language of a contract shall be construed against the drafter will not apply to
|
||||
+this License.
|
||||
+
|
||||
+13.5 Severability. (a) If for any reason a court of competent jurisdiction
|
||||
+finds any provision of this License, or portion thereof, to be unenforceable,
|
||||
+that provision of the License will be enforced to the maximum extent
|
||||
+permissible so as to effect the economic benefits and intent of the parties,
|
||||
+and the remainder of this License will continue in full force and effect. (b)
|
||||
+Notwithstanding the foregoing, if applicable law prohibits or restricts You
|
||||
+from fully and/or specifically complying with Sections 2 and/or 3 or prevents
|
||||
+the enforceability of either of those Sections, this License will immediately
|
||||
+terminate and You must immediately discontinue any use of the Covered Code and
|
||||
+destroy all copies of it that are in your possession or control.
|
||||
+
|
||||
+13.6 Dispute Resolution. Any litigation or other dispute resolution between
|
||||
+You and Apple relating to this License shall take place in the Northern
|
||||
+District of California, and You and Apple hereby consent to the personal
|
||||
+jurisdiction of, and venue in, the state and federal courts within that
|
||||
+District with respect to this License. The application of the United Nations
|
||||
+Convention on Contracts for the International Sale of Goods is expressly
|
||||
+excluded.
|
||||
+
|
||||
+13.7 Entire Agreement; Governing Law. This License constitutes the entire
|
||||
+agreement between the parties with respect to the subject matter hereof. This
|
||||
+License shall be governed by the laws of the United States and the State of
|
||||
+California, except that body of California law concerning conflicts of law.
|
||||
+
|
||||
+Where You are located in the province of Quebec, Canada, the following clause
|
||||
+applies: The parties hereby confirm that they have requested that this License
|
||||
+and all related documents be drafted in English. Les parties ont exige que le
|
||||
+present contrat et tous les documents connexes soient rediges en anglais.
|
||||
+
|
||||
+EXHIBIT A.
|
||||
+
|
||||
+"Portions Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
|
||||
+
|
||||
+This file contains Original Code and/or Modifications of Original Code as
|
||||
+defined in and that are subject to the Apple Public Source License Version 2.0
|
||||
+(the 'License'). You may not use this file except in compliance with the
|
||||
+License. Please obtain a copy of the License at
|
||||
+http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
+
|
||||
+The Original Code and all software distributed under the License are
|
||||
+distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
|
||||
+OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
|
||||
+LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
+PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
|
||||
+specific language governing rights and limitations under the License."
|
@ -1,14 +0,0 @@
|
||||
Let net-snmp-create-v3-user save settings into /etc/ instead of /usr/
|
||||
|
||||
diff -up net-snmp-5.5/net-snmp-create-v3-user.in.orig net-snmp-5.5/net-snmp-create-v3-user.in
|
||||
--- net-snmp-5.5/net-snmp-create-v3-user.in.orig 2008-07-22 16:33:25.000000000 +0200
|
||||
+++ net-snmp-5.5/net-snmp-create-v3-user.in 2009-09-29 16:30:36.000000000 +0200
|
||||
@@ -158,7 +158,7 @@ if test ! -d $outfile ; then
|
||||
touch $outfile
|
||||
fi
|
||||
echo $line >> $outfile
|
||||
-outfile="@datadir@/snmp/snmpd.conf"
|
||||
+outfile="/etc/snmp/snmpd.conf"
|
||||
line="$token $user"
|
||||
echo "adding the following line to $outfile:"
|
||||
echo " " $line
|
@ -1,29 +0,0 @@
|
||||
Don't check tests which depend on DNS - it's disabled in Koji
|
||||
|
||||
diff -up net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple.debug net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple
|
||||
--- net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple.debug 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/testing/fulltests/default/T070com2sec_simple 2012-10-18 10:16:39.276416510 +0200
|
||||
@@ -134,6 +134,10 @@ SAVECHECKAGENT '<"c406a", 255.255.255.25
|
||||
SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies
|
||||
SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies
|
||||
|
||||
+FINISHED
|
||||
+
|
||||
+# don't test the later, it depends on DNS, which is not available in Koji
|
||||
+
|
||||
CHECKAGENT '<"c408a"'
|
||||
if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||
CHECKAGENT 'line 32: Error:'
|
||||
diff -up net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple.debug net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple
|
||||
--- net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple.debug 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/testing/fulltests/default/T071com2sec6_simple 2012-10-18 10:16:39.276416510 +0200
|
||||
@@ -132,6 +132,9 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff
|
||||
SAVECHECKAGENT 'line 27: Error:'
|
||||
SAVECHECKAGENT 'line 28: Error:'
|
||||
|
||||
+FINISHED
|
||||
+
|
||||
+# don't test the later, it depends on DNS, which is not available in Koji
|
||||
# 608
|
||||
CHECKAGENT '<"c608a"'
|
||||
if [ "$snmp_last_test_result" -eq 0 ] ; then
|
@ -1,57 +0,0 @@
|
||||
729738 - net-snmp dumps core in netsnmp_oid_find_prefix
|
||||
1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out
|
||||
|
||||
commit f9304c83f76202db0e684269ca1af32e43cd9db4
|
||||
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
||||
Date: Tue Feb 7 14:53:44 2012 +0100
|
||||
|
||||
CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent disconnect in the middle of processing of a request.
|
||||
|
||||
I fixed also the memory leak reported in the tracker comments.
|
||||
|
||||
diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
|
||||
index c42a42a..baeebaf 100644
|
||||
--- a/agent/mibgroup/agentx/master.c
|
||||
+++ b/agent/mibgroup/agentx/master.c
|
||||
@@ -219,6 +219,9 @@ agentx_got_response(int operation,
|
||||
if (!cache) {
|
||||
DEBUGMSGTL(("agentx/master", "response too late on session %8p\n",
|
||||
session));
|
||||
+ /* response is too late, free the cache */
|
||||
+ if (magic)
|
||||
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
|
||||
return 0;
|
||||
}
|
||||
requests = cache->requests;
|
||||
@@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handler *handler,
|
||||
result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
|
||||
if (result == 0) {
|
||||
snmp_free_pdu(pdu);
|
||||
+ if (cb_data)
|
||||
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data);
|
||||
}
|
||||
|
||||
return SNMP_ERR_NOERROR;
|
||||
diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
|
||||
index f16f392..b84b85e 100644
|
||||
--- a/agent/mibgroup/agentx/master_admin.c
|
||||
+++ b/agent/mibgroup/agentx/master_admin.c
|
||||
@@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * session, int sessid)
|
||||
* requests, so that the delegated request will be completed and
|
||||
* further requests can be processed
|
||||
*/
|
||||
- netsnmp_remove_delegated_requests_for_session(session);
|
||||
+ while (netsnmp_remove_delegated_requests_for_session(session)) {
|
||||
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n"));
|
||||
+ }
|
||||
+
|
||||
if (session->subsession != NULL) {
|
||||
netsnmp_session *subsession = session->subsession;
|
||||
for(; subsession; subsession = subsession->next) {
|
||||
- netsnmp_remove_delegated_requests_for_session(subsession);
|
||||
+ while (netsnmp_remove_delegated_requests_for_session(subsession)) {
|
||||
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n"));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
Make net-snmp-create-v3-user multilib-clean
|
||||
|
||||
The file had different NSC_AGENTLIBS on different architectures.
|
||||
|
||||
Source: upstream
|
||||
|
||||
commit 68300a9fb43568c5d833c48a2fef3ff16c2923c3
|
||||
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
||||
Date: Thu Feb 7 10:14:33 2013 +0100
|
||||
|
||||
Remove unused variables.
|
||||
|
||||
diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||
index 5288f3b..efa19c3 100644
|
||||
--- a/net-snmp-create-v3-user.in
|
||||
+++ b/net-snmp-create-v3-user.in
|
||||
@@ -10,23 +10,6 @@ exec_prefix=@exec_prefix@
|
||||
includedir=@includedir@
|
||||
libdir=@libdir@
|
||||
datarootdir=@datarootdir@
|
||||
-NSC_LDFLAGS="@LDFLAGS@"
|
||||
-NSC_INCLUDEDIR=${includedir}
|
||||
-NSC_LIBDIR=-L${libdir}
|
||||
-NSC_LIBS="@LIBS@"
|
||||
-NSC_AGENTLIBS="@AGENTLIBS@ @PERLLDOPTS_FOR_APPS@"
|
||||
-NSC_PREFIX=$prefix
|
||||
-NSC_EXEC_PREFIX=$exec_prefix
|
||||
-NSC_SRCDIR=@srcdir@
|
||||
-NSC_INCDIR=${NSC_PREFIX}/include
|
||||
-NSC_BASE_SUBAGENT_LIBS="-lnetsnmpagent -lnetsnmp"
|
||||
-NSC_BASE_AGENT_LIBS="-lnetsnmpagent -lnetsnmpmibs -lnetsnmp"
|
||||
-NSC_SRC_LIBDIRS="agent/.libs snmplib/.libs"
|
||||
-NSC_SRC_LIBDEPS="agent/.libs/libnetsnmpmibs.a agent/.libs/libnetsnmpagent.a snmplib/.libs/libnetsnmp.a"
|
||||
-
|
||||
-if test "x$NSC_SRCDIR" = "x." ; then
|
||||
- NSC_SRCDIR="NET-SNMP-SOURCE-DIR"
|
||||
-fi
|
||||
|
||||
if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then
|
||||
echo "Apparently at least one snmpd demon is already running."
|
File diff suppressed because it is too large
Load Diff
@ -1,200 +0,0 @@
|
||||
diff -urNp old/snmplib/snmp_api.c new/snmplib/snmp_api.c
|
||||
--- old/snmplib/snmp_api.c 2018-03-08 09:08:50.675762351 +0100
|
||||
+++ new/snmplib/snmp_api.c 2018-03-08 09:27:13.289076553 +0100
|
||||
@@ -4350,12 +4350,10 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
u_char type;
|
||||
u_char msg_type;
|
||||
u_char *var_val;
|
||||
- int badtype = 0;
|
||||
size_t len;
|
||||
size_t four;
|
||||
- netsnmp_variable_list *vp = NULL;
|
||||
+ netsnmp_variable_list *vp = NULL, *vplast = NULL;
|
||||
oid objid[MAX_OID_LEN];
|
||||
- u_char *p;
|
||||
|
||||
/*
|
||||
* Get the PDU type
|
||||
@@ -4493,38 +4491,24 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
(ASN_SEQUENCE | ASN_CONSTRUCTOR),
|
||||
"varbinds");
|
||||
if (data == NULL)
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
|
||||
/*
|
||||
* get each varBind sequence
|
||||
*/
|
||||
while ((int) *length > 0) {
|
||||
- netsnmp_variable_list *vptemp;
|
||||
- vptemp = (netsnmp_variable_list *) malloc(sizeof(*vptemp));
|
||||
- if (NULL == vptemp) {
|
||||
- return -1;
|
||||
- }
|
||||
- if (NULL == vp) {
|
||||
- pdu->variables = vptemp;
|
||||
- } else {
|
||||
- vp->next_variable = vptemp;
|
||||
- }
|
||||
- vp = vptemp;
|
||||
+ vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
|
||||
+ if (NULL == vp)
|
||||
+ goto fail;
|
||||
|
||||
- vp->next_variable = NULL;
|
||||
- vp->val.string = NULL;
|
||||
vp->name_length = MAX_OID_LEN;
|
||||
- vp->name = NULL;
|
||||
- vp->index = 0;
|
||||
- vp->data = NULL;
|
||||
- vp->dataFreeHook = NULL;
|
||||
DEBUGDUMPSECTION("recv", "VarBind");
|
||||
data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
|
||||
&vp->val_len, &var_val, length);
|
||||
if (data == NULL)
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
if (snmp_set_var_objid(vp, objid, vp->name_length))
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
|
||||
len = MAX_PACKET_LENGTH;
|
||||
DEBUGDUMPHEADER("recv", "Value");
|
||||
@@ -4532,11 +4516,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
case ASN_INTEGER:
|
||||
vp->val.integer = (long *) vp->buf;
|
||||
vp->val_len = sizeof(long);
|
||||
- p = asn_parse_int(var_val, &len, &vp->type,
|
||||
+ asn_parse_int(var_val, &len, &vp->type,
|
||||
(long *) vp->val.integer,
|
||||
sizeof(*vp->val.integer));
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
case ASN_COUNTER:
|
||||
case ASN_GAUGE:
|
||||
@@ -4544,11 +4526,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
case ASN_UINTEGER:
|
||||
vp->val.integer = (long *) vp->buf;
|
||||
vp->val_len = sizeof(u_long);
|
||||
- p = asn_parse_unsigned_int(var_val, &len, &vp->type,
|
||||
+ asn_parse_unsigned_int(var_val, &len, &vp->type,
|
||||
(u_long *) vp->val.integer,
|
||||
vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
|
||||
case ASN_OPAQUE_COUNTER64:
|
||||
@@ -4557,38 +4537,30 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
case ASN_COUNTER64:
|
||||
vp->val.counter64 = (struct counter64 *) vp->buf;
|
||||
vp->val_len = sizeof(struct counter64);
|
||||
- p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
|
||||
+ asn_parse_unsigned_int64(var_val, &len, &vp->type,
|
||||
(struct counter64 *) vp->val.
|
||||
counter64, vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
|
||||
case ASN_OPAQUE_FLOAT:
|
||||
vp->val.floatVal = (float *) vp->buf;
|
||||
vp->val_len = sizeof(float);
|
||||
- p = asn_parse_float(var_val, &len, &vp->type,
|
||||
+ asn_parse_float(var_val, &len, &vp->type,
|
||||
vp->val.floatVal, vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
case ASN_OPAQUE_DOUBLE:
|
||||
vp->val.doubleVal = (double *) vp->buf;
|
||||
vp->val_len = sizeof(double);
|
||||
- p = asn_parse_double(var_val, &len, &vp->type,
|
||||
+ asn_parse_double(var_val, &len, &vp->type,
|
||||
vp->val.doubleVal, vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
case ASN_OPAQUE_I64:
|
||||
vp->val.counter64 = (struct counter64 *) vp->buf;
|
||||
vp->val_len = sizeof(struct counter64);
|
||||
- p = asn_parse_signed_int64(var_val, &len, &vp->type,
|
||||
+ asn_parse_signed_int64(var_val, &len, &vp->type,
|
||||
(struct counter64 *) vp->val.counter64,
|
||||
sizeof(*vp->val.counter64));
|
||||
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
#endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
|
||||
case ASN_IPADDRESS:
|
||||
@@ -4604,22 +4576,18 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
vp->val.string = (u_char *) malloc(vp->val_len);
|
||||
}
|
||||
if (vp->val.string == NULL) {
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
}
|
||||
- p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
|
||||
+ asn_parse_string(var_val, &len, &vp->type, vp->val.string,
|
||||
&vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
case ASN_OBJECT_ID:
|
||||
vp->val_len = MAX_OID_LEN;
|
||||
- p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
+ asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
|
||||
vp->val_len *= sizeof(oid);
|
||||
vp->val.objid = (oid *) malloc(vp->val_len);
|
||||
if (vp->val.objid == NULL) {
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
}
|
||||
memmove(vp->val.objid, objid, vp->val_len);
|
||||
break;
|
||||
@@ -4631,21 +4599,34 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char
|
||||
case ASN_BIT_STR:
|
||||
vp->val.bitstring = (u_char *) malloc(vp->val_len);
|
||||
if (vp->val.bitstring == NULL) {
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
}
|
||||
- p = asn_parse_bitstring(var_val, &len, &vp->type,
|
||||
+ asn_parse_bitstring(var_val, &len, &vp->type,
|
||||
vp->val.bitstring, &vp->val_len);
|
||||
- if (!p)
|
||||
- return -1;
|
||||
break;
|
||||
default:
|
||||
snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
|
||||
- badtype = -1;
|
||||
+ goto fail;
|
||||
break;
|
||||
}
|
||||
DEBUGINDENTADD(-4);
|
||||
- }
|
||||
- return badtype;
|
||||
+ if (NULL == vplast) {
|
||||
+ pdu->variables = vp;
|
||||
+ } else {
|
||||
+ vplast->next_variable = vp;
|
||||
+ }
|
||||
+ vplast = vp;
|
||||
+ vp = NULL;
|
||||
+ }
|
||||
+ return 0;
|
||||
+
|
||||
+ fail:
|
||||
+ DEBUGMSGTL(("recv", "error while parsing VarBindList\n"));
|
||||
+ /** if we were parsing a var, remove it from the pdu and free it */
|
||||
+ if (vp)
|
||||
+ snmp_free_var(vp);
|
||||
+
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
/*
|
@ -1,22 +0,0 @@
|
||||
diff -up net-snmp-5.7.3/perl/ASN/Makefile.PL.orig net-snmp-5.7.3/perl/ASN/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/ASN/Makefile.PL.orig 2016-05-06 10:35:30.005905040 +0200
|
||||
+++ net-snmp-5.7.3/perl/ASN/Makefile.PL 2016-05-06 10:35:57.518776400 +0200
|
||||
@@ -3,6 +3,7 @@ require 5;
|
||||
use Config;
|
||||
use Getopt::Long;
|
||||
my $lib_version;
|
||||
+my %MakeParams = ();
|
||||
|
||||
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
||||
# the contents of the Makefile that is written.
|
||||
diff -up net-snmp-5.7.3/perl/Makefile.PL.orig net-snmp-5.7.3/perl/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/Makefile.PL.orig 2016-05-06 10:34:38.975143641 +0200
|
||||
+++ net-snmp-5.7.3/perl/Makefile.PL 2016-05-06 10:35:13.326983024 +0200
|
||||
@@ -2,6 +2,7 @@ use ExtUtils::MakeMaker;
|
||||
use Config;
|
||||
use Getopt::Long;
|
||||
require 5;
|
||||
+my %MakeParams = ();
|
||||
|
||||
%MakeParams = InitMakeParams();
|
||||
|
@ -1,69 +0,0 @@
|
||||
commit bec6243394ed78897c14e3fa46f934e0ea3d453e
|
||||
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
||||
Date: Fri Jun 26 13:30:07 2015 +0200
|
||||
|
||||
snmpstatus: CHANGES: Fixed crash when receiving non-standard compliant responses.
|
||||
|
||||
Some HW sends ifOperStatus as NULL instead of INTEGER type. We should not try to dereference this NULL.
|
||||
|
||||
diff --git a/apps/snmpstatus.c b/apps/snmpstatus.c
|
||||
index ae08369..6f31c42 100644
|
||||
--- a/apps/snmpstatus.c
|
||||
+++ b/apps/snmpstatus.c
|
||||
@@ -310,30 +310,38 @@ main(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
if (vars->name_length >= length_ifOperStatus
|
||||
- && !memcmp(objid_ifOperStatus, vars->name,
|
||||
- sizeof(objid_ifOperStatus))) {
|
||||
+ && !memcmp(objid_ifOperStatus, vars->name,
|
||||
+ sizeof(objid_ifOperStatus))
|
||||
+ && vars->type == ASN_INTEGER
|
||||
+ && vars->val.integer) {
|
||||
if (*vars->val.integer != MIB_IFSTATUS_UP)
|
||||
down_interfaces++;
|
||||
snmp_add_null_var(pdu, vars->name,
|
||||
vars->name_length);
|
||||
good_var++;
|
||||
- } else if (vars->name_length >= length_ifInUCastPkts &&
|
||||
- !memcmp(objid_ifInUCastPkts, vars->name,
|
||||
- sizeof(objid_ifInUCastPkts))) {
|
||||
+ } else if (vars->name_length >= length_ifInUCastPkts
|
||||
+ &&!memcmp(objid_ifInUCastPkts, vars->name,
|
||||
+ sizeof(objid_ifInUCastPkts))
|
||||
+ && vars->type == ASN_COUNTER
|
||||
+ && vars->val.integer) {
|
||||
ipackets += *vars->val.integer;
|
||||
snmp_add_null_var(pdu, vars->name,
|
||||
vars->name_length);
|
||||
good_var++;
|
||||
} else if (vars->name_length >= length_ifInNUCastPkts
|
||||
&& !memcmp(objid_ifInNUCastPkts, vars->name,
|
||||
- sizeof(objid_ifInNUCastPkts))) {
|
||||
+ sizeof(objid_ifInNUCastPkts))
|
||||
+ && vars->type == ASN_COUNTER
|
||||
+ && vars->val.integer) {
|
||||
ipackets += *vars->val.integer;
|
||||
snmp_add_null_var(pdu, vars->name,
|
||||
vars->name_length);
|
||||
good_var++;
|
||||
} else if (vars->name_length >= length_ifOutUCastPkts
|
||||
&& !memcmp(objid_ifOutUCastPkts, vars->name,
|
||||
- sizeof(objid_ifOutUCastPkts))) {
|
||||
+ sizeof(objid_ifOutUCastPkts))
|
||||
+ && vars->type == ASN_COUNTER
|
||||
+ && vars->val.integer) {
|
||||
opackets += *vars->val.integer;
|
||||
snmp_add_null_var(pdu, vars->name,
|
||||
vars->name_length);
|
||||
@@ -341,7 +349,9 @@ main(int argc, char *argv[])
|
||||
} else if (vars->name_length >= length_ifOutNUCastPkts
|
||||
&& !memcmp(objid_ifOutNUCastPkts,
|
||||
vars->name,
|
||||
- sizeof(objid_ifOutNUCastPkts))) {
|
||||
+ sizeof(objid_ifOutNUCastPkts))
|
||||
+ && vars->type == ASN_COUNTER
|
||||
+ && vars->val.integer) {
|
||||
opackets += *vars->val.integer;
|
||||
snmp_add_null_var(pdu, vars->name,
|
||||
vars->name_length);
|
@ -1,19 +0,0 @@
|
||||
diff -urNp net-snmp-5.7.3/snmplib/snmp_transport.c net-snmp-5.7.3.new/snmplib/snmp_transport.c
|
||||
--- net-snmp-5.7.3/snmplib/snmp_transport.c 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3.new/snmplib/snmp_transport.c 2016-08-12 13:04:35.438583586 +0200
|
||||
@@ -594,12 +594,13 @@ netsnmp_tdomain_transport_full(const cha
|
||||
int commas = 0;
|
||||
const char *cp = default_domain;
|
||||
char *dup = strdup(default_domain);
|
||||
+ char *ptr = NULL;
|
||||
|
||||
while (*++cp) if (*cp == ',') commas++;
|
||||
lspec = calloc(commas+2, sizeof(char *));
|
||||
commas = 1;
|
||||
- lspec[0] = strtok(dup, ",");
|
||||
- while ((lspec[commas++] = strtok(NULL, ",")))
|
||||
+ lspec[0] = strtok_r(dup, ",", &ptr);
|
||||
+ while ((lspec[commas++] = strtok_r(NULL, ",", &ptr)))
|
||||
;
|
||||
spec = (const char * const *)lspec;
|
||||
}
|
12
net-snmp-5.8-Remove-U64-typedef.patch
Normal file
12
net-snmp-5.8-Remove-U64-typedef.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/include/net-snmp/library/int64.h b/include/net-snmp/library/int64.h
|
||||
--- a/include/net-snmp/library/int64.h 2018-07-18 14:37:16.543348832 +0200
|
||||
+++ b/include/net-snmp/library/int64.h 2018-07-18 15:31:31.516999288 +0200
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
* Note: using the U64 typedef is deprecated because this typedef conflicts
|
||||
* with a typedef with the same name defined in the Perl header files.
|
||||
*/
|
||||
- typedef struct counter64 U64;
|
||||
+// typedef struct counter64 U64;
|
||||
#endif
|
||||
|
||||
#define I64CHARSZ 21
|
12
net-snmp-5.8-agentx-disconnect-crash.patch
Normal file
12
net-snmp-5.8-agentx-disconnect-crash.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
|
||||
--- a/agent/mibgroup/agentx/master.c 2018-07-18 12:13:49.953014652 +0200
|
||||
+++ b/agent/mibgroup/agentx/master.c 2018-07-18 12:20:23.537626773 +0200
|
||||
@@ -221,7 +221,7 @@ agentx_got_response(int operation,
|
||||
/* response is too late, free the cache */
|
||||
if (magic)
|
||||
netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
|
||||
- return 0;
|
||||
+ return 1;
|
||||
}
|
||||
requests = cache->requests;
|
||||
|
@ -1,6 +1,6 @@
|
||||
diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
--- oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2017-10-31 10:21:53.433280099 +0100
|
||||
diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntctl.c net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
--- b/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:12:20.674499629 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:15:46.782859398 +0200
|
||||
@@ -43,8 +43,9 @@ _fsys_type( int type)
|
||||
|
||||
case MNT_NFS:
|
||||
@ -12,7 +12,7 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/h
|
||||
|
||||
/*
|
||||
* The following code covers selected filesystems
|
||||
@@ -153,10 +154,12 @@ netsnmp_fsys_arch_load( void )
|
||||
@@ -156,10 +157,12 @@ netsnmp_fsys_arch_load( void )
|
||||
|
||||
/*
|
||||
* Optionally skip retrieving statistics for remote mounts
|
||||
@ -27,10 +27,10 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/h
|
||||
continue;
|
||||
|
||||
if ( statfs( entry->path, &stat_buf ) < 0 ) {
|
||||
diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntent.c nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
--- oold/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-30 14:50:41.784743150 +0100
|
||||
+++ nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-31 08:59:08.953114110 +0100
|
||||
@@ -145,6 +145,13 @@ _fsys_type( char *typename )
|
||||
diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntent.c net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
--- b/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:12:20.674499629 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:15:46.782859398 +0200
|
||||
@@ -150,6 +150,13 @@ _fsys_type( char *typename )
|
||||
!strcmp(typename, MNTTYPE_LOFS))
|
||||
return NETSNMP_FS_TYPE_OTHER;
|
||||
|
||||
@ -55,10 +55,10 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntent.c nnew/agent/mibgroup/h
|
||||
#ifdef irix6
|
||||
if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) < 0 )
|
||||
#else
|
||||
diff -urNp oold/agent/mibgroup/hardware/fsys/mnttypes.h nnew/agent/mibgroup/hardware/fsys/mnttypes.h
|
||||
--- oold/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-30 14:50:41.741743139 +0100
|
||||
+++ nnew/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-31 09:01:40.462427047 +0100
|
||||
@@ -159,6 +159,9 @@
|
||||
diff -urNp b/agent/mibgroup/hardware/fsys/mnttypes.h net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h
|
||||
--- b/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:12:20.674499629 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:15:46.782859398 +0200
|
||||
@@ -165,6 +165,9 @@
|
||||
#ifndef MNTTYPE_APP
|
||||
#define MNTTYPE_APP "app"
|
||||
#endif
|
||||
@ -68,10 +68,10 @@ diff -urNp oold/agent/mibgroup/hardware/fsys/mnttypes.h nnew/agent/mibgroup/hard
|
||||
#ifndef MNTTYPE_DEVPTS
|
||||
#define MNTTYPE_DEVPTS "devpts"
|
||||
#endif
|
||||
diff -urNp oold/agent/mibgroup/host/hr_filesys.c nnew/agent/mibgroup/host/hr_filesys.c
|
||||
--- oold/agent/mibgroup/host/hr_filesys.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hr_filesys.c 2017-10-31 09:28:46.926093897 +0100
|
||||
@@ -839,6 +839,27 @@ Check_HR_FileSys_NFS (void)
|
||||
diff -urNp b/agent/mibgroup/host/hr_filesys.c net-snmp-5.8/agent/mibgroup/host/hr_filesys.c
|
||||
--- b/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:12:20.668499652 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:15:46.783859399 +0200
|
||||
@@ -834,6 +834,27 @@ Check_HR_FileSys_NFS (void)
|
||||
return 0; /* no NFS file system */
|
||||
}
|
||||
|
||||
@ -99,9 +99,9 @@ diff -urNp oold/agent/mibgroup/host/hr_filesys.c nnew/agent/mibgroup/host/hr_fil
|
||||
void
|
||||
End_HR_FileSys(void)
|
||||
{
|
||||
diff -urNp oold/agent/mibgroup/host/hr_filesys.h nnew/agent/mibgroup/host/hr_filesys.h
|
||||
--- oold/agent/mibgroup/host/hr_filesys.h 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hr_filesys.h 2017-10-31 09:29:44.541837515 +0100
|
||||
diff -urNp b/agent/mibgroup/host/hr_filesys.h net-snmp-5.8/agent/mibgroup/host/hr_filesys.h
|
||||
--- b/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:12:20.669499648 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:15:46.784859400 +0200
|
||||
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
||||
extern FindVarMethod var_hrfilesys;
|
||||
extern int Get_Next_HR_FileSys(void);
|
||||
@ -110,10 +110,10 @@ diff -urNp oold/agent/mibgroup/host/hr_filesys.h nnew/agent/mibgroup/host/hr_fil
|
||||
|
||||
extern int Get_FSIndex(char *);
|
||||
extern long Get_FSSize(char *); /* Temporary */
|
||||
diff -urNp oold/agent/mibgroup/host/hrh_filesys.c nnew/agent/mibgroup/host/hrh_filesys.c
|
||||
--- oold/agent/mibgroup/host/hrh_filesys.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hrh_filesys.c 2017-10-31 09:37:36.787634605 +0100
|
||||
@@ -427,3 +427,9 @@ Check_HR_FileSys_NFS (void)
|
||||
diff -urNp b/agent/mibgroup/host/hrh_filesys.c net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c
|
||||
--- b/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:12:20.668499652 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:15:46.785859402 +0200
|
||||
@@ -429,3 +429,9 @@ Check_HR_FileSys_NFS (void)
|
||||
{
|
||||
return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0;
|
||||
}
|
||||
@ -123,9 +123,9 @@ diff -urNp oold/agent/mibgroup/host/hrh_filesys.c nnew/agent/mibgroup/host/hrh_f
|
||||
+{
|
||||
+ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0;
|
||||
+}
|
||||
diff -urNp oold/agent/mibgroup/host/hrh_filesys.h nnew/agent/mibgroup/host/hrh_filesys.h
|
||||
--- oold/agent/mibgroup/host/hrh_filesys.h 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hrh_filesys.h 2017-10-31 09:38:00.644616572 +0100
|
||||
diff -urNp b/agent/mibgroup/host/hrh_filesys.h net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h
|
||||
--- b/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:12:20.669499648 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:15:46.785859402 +0200
|
||||
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
||||
extern FindVarMethod var_hrhfilesys;
|
||||
extern int Get_Next_HR_FileSys(void);
|
||||
@ -134,10 +134,10 @@ diff -urNp oold/agent/mibgroup/host/hrh_filesys.h nnew/agent/mibgroup/host/hrh_f
|
||||
|
||||
extern int Get_FSIndex(char *);
|
||||
extern long Get_FSSize(char *); /* Temporary */
|
||||
diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_storage.c
|
||||
--- oold/agent/mibgroup/host/hrh_storage.c 2017-10-30 14:50:41.766743146 +0100
|
||||
+++ nnew/agent/mibgroup/host/hrh_storage.c 2017-10-31 10:08:25.482217951 +0100
|
||||
@@ -368,9 +368,10 @@ really_try_next:
|
||||
diff -urNp b/agent/mibgroup/host/hrh_storage.c net-snmp-5.8/agent/mibgroup/host/hrh_storage.c
|
||||
--- b/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:12:20.668499652 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:15:46.786859402 +0200
|
||||
@@ -367,9 +367,10 @@ really_try_next:
|
||||
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
||||
if (HRFS_entry &&
|
||||
store_idx > NETSNMP_MEM_TYPE_MAX &&
|
||||
@ -150,7 +150,7 @@ diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_s
|
||||
return NULL;
|
||||
if (store_idx <= NETSNMP_MEM_TYPE_MAX ) {
|
||||
mem = (netsnmp_memory_info*)ptr;
|
||||
@@ -509,7 +510,8 @@ Get_Next_HR_Store(void)
|
||||
@@ -508,7 +509,8 @@ Get_Next_HR_Store(void)
|
||||
if (HRS_index >= 0) {
|
||||
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||
@ -160,10 +160,10 @@ diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_s
|
||||
return HRS_index + NETSNMP_MEM_TYPE_MAX;
|
||||
}
|
||||
} else {
|
||||
diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_storage.c
|
||||
--- oold/agent/mibgroup/host/hr_storage.c 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/agent/mibgroup/host/hr_storage.c 2017-10-31 10:11:41.161064352 +0100
|
||||
@@ -545,9 +545,10 @@ really_try_next:
|
||||
diff -urNp b/agent/mibgroup/host/hr_storage.c net-snmp-5.8/agent/mibgroup/host/hr_storage.c
|
||||
--- b/agent/mibgroup/host/hr_storage.c 2018-07-18 16:12:20.670499644 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hr_storage.c 2018-07-18 16:15:46.786859402 +0200
|
||||
@@ -540,9 +540,10 @@ really_try_next:
|
||||
|
||||
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
||||
if (store_idx > NETSNMP_MEM_TYPE_MAX ) {
|
||||
@ -176,7 +176,7 @@ diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_sto
|
||||
return NULL; /* or goto try_next; */
|
||||
if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
|
||||
snmp_log_perror(HRFS_entry->HRFS_mount);
|
||||
@@ -688,7 +689,8 @@ Get_Next_HR_Store(void)
|
||||
@@ -683,7 +684,8 @@ Get_Next_HR_Store(void)
|
||||
if (HRS_index >= 0) {
|
||||
if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||
@ -186,14 +186,14 @@ diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_sto
|
||||
return HRS_index + NETSNMP_MEM_TYPE_MAX;
|
||||
}
|
||||
} else {
|
||||
diff -urNp oold/include/net-snmp/agent/hardware/fsys.h nnew/include/net-snmp/agent/hardware/fsys.h
|
||||
--- oold/include/net-snmp/agent/hardware/fsys.h 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ nnew/include/net-snmp/agent/hardware/fsys.h 2017-10-31 10:14:59.560581680 +0100
|
||||
diff -urNp b/include/net-snmp/agent/hardware/fsys.h net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h
|
||||
--- b/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:12:20.649499726 +0200
|
||||
+++ net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:19:33.994918912 +0200
|
||||
@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsn
|
||||
#define NETSNMP_FS_TYPE_SYSFS 4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
|
||||
#define NETSNMP_FS_TYPE_TMPFS 5 | _NETSNMP_FS_TYPE_LOCAL
|
||||
#define NETSNMP_FS_TYPE_USBFS 6 | _NETSNMP_FS_TYPE_LOCAL
|
||||
+#define NETSNMP_FS_TYPE_AUTOFS 7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
|
||||
#define NETSNMP_FS_TYPE_SYSFS (4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT)
|
||||
#define NETSNMP_FS_TYPE_TMPFS (5 | _NETSNMP_FS_TYPE_LOCAL)
|
||||
#define NETSNMP_FS_TYPE_USBFS (6 | _NETSNMP_FS_TYPE_LOCAL)
|
||||
+#define NETSNMP_FS_TYPE_AUTOFS (7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT)
|
||||
|
||||
#define NETSNMP_FS_FLAG_ACTIVE 0x01
|
||||
#define NETSNMP_FS_FLAG_REMOTE 0x02
|
@ -1,123 +1,7 @@
|
||||
1309080 - net-snmp-config specifies redhat-hardened-cc1 in cflags and causes gcc failure without redhat-rpm-config
|
||||
|
||||
Don't remove -Wall in perl Makefiles - it would remove -Wformat and gcc would fail with
|
||||
error: -Wformat-security ignored without -Wformat
|
||||
|
||||
+ there is one upstream patch below (to be removed on rebase)
|
||||
|
||||
diff -up net-snmp-5.7.3/perl/agent/default_store/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/default_store/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/agent/default_store/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/agent/default_store/Makefile.PL 2016-02-24 12:17:05.154209526 +0100
|
||||
@@ -79,7 +79,7 @@ sub InitMakeParams {
|
||||
$Params{'LIBS'} = "-L../../../snmplib/.libs -L../../../snmplib/ " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
diff -up net-snmp-5.7.3/perl/agent/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/agent/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/agent/Makefile.PL 2016-02-24 12:17:05.154209526 +0100
|
||||
@@ -92,7 +92,7 @@ sub InitMakeParams {
|
||||
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'};
|
||||
# $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
diff -up net-snmp-5.7.3/perl/agent/Support/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/Support/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/agent/Support/Makefile.PL.cflags 2016-02-24 12:17:16.291271579 +0100
|
||||
+++ net-snmp-5.7.3/perl/agent/Support/Makefile.PL 2016-02-24 12:17:22.413305687 +0100
|
||||
@@ -86,7 +86,7 @@ sub InitMakeParams {
|
||||
$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
diff -up net-snmp-5.7.3/perl/ASN/Makefile.PL.cflags net-snmp-5.7.3/perl/ASN/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/ASN/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/ASN/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
|
||||
@@ -86,7 +86,7 @@ sub InitMakeParams {
|
||||
$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
diff -up net-snmp-5.7.3/perl/default_store/Makefile.PL.cflags net-snmp-5.7.3/perl/default_store/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/default_store/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/default_store/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
|
||||
@@ -79,7 +79,7 @@ sub InitMakeParams {
|
||||
$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
diff -up net-snmp-5.7.3/perl/OID/Makefile.PL.cflags net-snmp-5.7.3/perl/OID/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/OID/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/OID/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
|
||||
@@ -86,7 +86,7 @@ sub InitMakeParams {
|
||||
# } else {
|
||||
# $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
diff -up net-snmp-5.7.3/perl/SNMP/Makefile.PL.cflags net-snmp-5.7.3/perl/SNMP/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/SNMP/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/SNMP/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
|
||||
@@ -98,7 +98,7 @@ sub InitMakeParams {
|
||||
# } else {
|
||||
# $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 };
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if (!$ENV{'NETSNMP_PREFIX'}) {
|
||||
$prefix = `$opts->{'nsconfig'} --prefix`;
|
||||
chomp($prefix);
|
||||
diff -up net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL.cflags net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL
|
||||
--- net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
|
||||
@@ -124,7 +124,7 @@ sub InitMakeParams {
|
||||
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}";
|
||||
}
|
||||
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
if ($Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
}
|
||||
|
||||
commit 127274f8f27fba264a4c0f91190fd6f8037cdf21
|
||||
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
||||
Date: Wed Feb 24 10:14:21 2016 +0100
|
||||
|
||||
Trim output of net-snmp-config --cflags.
|
||||
|
||||
We should report CFLAGS needed to import and use Net-SNMP headers, not
|
||||
CFLAGS used to compile actual Net-SNMP.
|
||||
|
||||
E.g. we should not report various distro fortify-source options.
|
||||
|
||||
diff --git a/net-snmp-config.in b/net-snmp-config.in
|
||||
index 7e34944..f3bffe9 100644
|
||||
--- a/net-snmp-config.in
|
||||
+++ b/net-snmp-config.in
|
||||
@@ -138,10 +138,10 @@ else
|
||||
diff -urNp a/net-snmp-config.in b/net-snmp-config.in
|
||||
--- a/net-snmp-config.in 2018-07-18 13:43:12.264426052 +0200
|
||||
+++ b/net-snmp-config.in 2018-07-18 13:52:06.917089518 +0200
|
||||
@@ -140,10 +140,10 @@ else
|
||||
;;
|
||||
#################################################### compile
|
||||
--base-cflags)
|
||||
@ -130,5 +14,99 @@ index 7e34944..f3bffe9 100644
|
||||
;;
|
||||
--srcdir)
|
||||
echo $NSC_SRCDIR
|
||||
diff -urNp a/perl/agent/default_store/Makefile.PL b/perl/agent/default_store/Makefile.PL
|
||||
--- a/perl/agent/default_store/Makefile.PL 2018-07-18 13:43:12.170426290 +0200
|
||||
+++ b/perl/agent/default_store/Makefile.PL 2018-07-18 13:51:31.812176486 +0200
|
||||
@@ -83,7 +83,7 @@ sub AgentDefaultStoreInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/agent/Makefile.PL b/perl/agent/Makefile.PL
|
||||
--- a/perl/agent/Makefile.PL 2018-07-18 13:43:12.169426292 +0200
|
||||
+++ b/perl/agent/Makefile.PL 2018-07-18 13:52:53.884973275 +0200
|
||||
@@ -98,7 +98,7 @@ sub AgentInitMakeParams {
|
||||
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'};
|
||||
# $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/agent/Support/Makefile.PL b/perl/agent/Support/Makefile.PL
|
||||
--- a/perl/agent/Support/Makefile.PL 2018-07-18 13:43:12.169426292 +0200
|
||||
+++ b/perl/agent/Support/Makefile.PL 2018-07-18 13:53:11.414929921 +0200
|
||||
@@ -90,7 +90,7 @@ sub SupportInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/ASN/Makefile.PL b/perl/ASN/Makefile.PL
|
||||
--- a/perl/ASN/Makefile.PL 2018-07-18 13:43:12.171426287 +0200
|
||||
+++ b/perl/ASN/Makefile.PL 2018-07-18 13:53:46.652842822 +0200
|
||||
@@ -93,7 +93,7 @@ sub AsnInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/default_store/Makefile.PL b/perl/default_store/Makefile.PL
|
||||
--- a/perl/default_store/Makefile.PL 2018-07-18 13:43:12.175426277 +0200
|
||||
+++ b/perl/default_store/Makefile.PL 2018-07-18 13:54:20.814758441 +0200
|
||||
@@ -83,7 +83,7 @@ sub DefaultStoreInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/OID/Makefile.PL b/perl/OID/Makefile.PL
|
||||
--- a/perl/OID/Makefile.PL 2018-07-18 13:43:12.175426277 +0200
|
||||
+++ b/perl/OID/Makefile.PL 2018-07-18 13:54:43.348702811 +0200
|
||||
@@ -90,7 +90,7 @@ sub OidInitMakeParams {
|
||||
# } else {
|
||||
# $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/SNMP/Makefile.PL b/perl/SNMP/Makefile.PL
|
||||
--- a/perl/SNMP/Makefile.PL 2018-07-18 13:43:12.173426282 +0200
|
||||
+++ b/perl/SNMP/Makefile.PL 2018-07-18 13:55:07.220643903 +0200
|
||||
@@ -103,7 +103,7 @@ sub SnmpInitMakeParams {
|
||||
# } else {
|
||||
# $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 };
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if (!$ENV{'NETSNMP_PREFIX'}) {
|
||||
$prefix = `$opts->{'nsconfig'} --prefix`;
|
||||
diff -urNp a/perl/TrapReceiver/Makefile.PL b/perl/TrapReceiver/Makefile.PL
|
||||
--- a/perl/TrapReceiver/Makefile.PL 2018-07-18 13:43:12.172426285 +0200
|
||||
+++ b/perl/TrapReceiver/Makefile.PL 2018-07-18 13:55:43.100647233 +0200
|
||||
@@ -132,7 +132,7 @@ sub TrapReceiverInitMakeParams {
|
||||
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}";
|
||||
}
|
||||
|
||||
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
12
net-snmp-5.8-dir-fix.patch
Normal file
12
net-snmp-5.8-dir-fix.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||
--- a/net-snmp-create-v3-user.in 2018-07-18 11:11:53.227015237 +0200
|
||||
+++ b/net-snmp-create-v3-user.in 2018-07-18 11:12:13.375010176 +0200
|
||||
@@ -137,7 +137,7 @@ fi
|
||||
echo $line >> $outfile
|
||||
prefix="@prefix@"
|
||||
datarootdir="@datarootdir@"
|
||||
-outfile="@datadir@/snmp/snmpd.conf"
|
||||
+outfile="/etc/snmp/snmpd.conf"
|
||||
line="$token $user"
|
||||
echo "adding the following line to $outfile:"
|
||||
echo " " $line
|
12
net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
12
net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/apps/Makefile.in b/apps/Makefile.in
|
||||
--- a/apps/Makefile.in 2018-07-18 15:39:28.069251000 +0200
|
||||
+++ b/apps/Makefile.in 2018-07-18 15:54:52.261943123 +0200
|
||||
@@ -230,7 +230,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX
|
||||
$(LINK) ${CFLAGS} -o $@ snmppcap.$(OSUFFIX) ${LDFLAGS} ${LIBS} -lpcap
|
||||
|
||||
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
|
||||
- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
|
||||
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIB)
|
||||
$(RANLIB) $@
|
||||
|
||||
snmpinforminstall:
|
83
net-snmp-5.8-modern-rpm-api.patch
Normal file
83
net-snmp-5.8-modern-rpm-api.patch
Normal file
@ -0,0 +1,83 @@
|
||||
diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||
--- a/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:12:19.583503903 +0200
|
||||
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:50:38.599703588 +0200
|
||||
@@ -102,7 +102,6 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
||||
rpmtd td_name, td_version, td_release, td_group, td_time;
|
||||
#else
|
||||
char *n, *v, *r, *g;
|
||||
- int32_t *t;
|
||||
#endif
|
||||
time_t install_time;
|
||||
size_t date_len;
|
||||
@@ -146,14 +145,13 @@ 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 -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
|
||||
--- a/agent/mibgroup/host/hr_swinst.c 2018-07-18 16:12:19.582503907 +0200
|
||||
+++ b/agent/mibgroup/host/hr_swinst.c 2018-07-18 17:09:29.716564197 +0200
|
||||
@@ -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;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
diff -up net-snmp-5.7.3/man/netsnmp_config_api.3.def.oSBcEB net-snmp-5.7.3/man/netsnmp_config_api.3.def
|
||||
--- net-snmp-5.7.3/man/netsnmp_config_api.3.def.oSBcEB 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/man/netsnmp_config_api.3.def 2015-02-17 13:32:38.903284207 +0100
|
||||
diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
||||
--- a/man/netsnmp_config_api.3.def 2018-07-18 11:18:06.196792766 +0200
|
||||
+++ b/man/netsnmp_config_api.3.def 2018-07-18 11:20:04.631679886 +0200
|
||||
@@ -295,7 +295,7 @@ for one particular machine.
|
||||
.PP
|
||||
The default list of directories to search is \fC SYSCONFDIR/snmp\fP,
|
||||
@ -10,18 +10,18 @@ diff -up net-snmp-5.7.3/man/netsnmp_config_api.3.def.oSBcEB net-snmp-5.7.3/man/n
|
||||
followed by \fC $HOME/.snmp\fP.
|
||||
This list can be changed by setting the environmental variable
|
||||
.I SNMPCONFPATH
|
||||
@@ -365,7 +365,7 @@ function that it should abort the operat
|
||||
SNMPCONFPATH
|
||||
A colon separated list of directories to search for configuration
|
||||
@@ -367,7 +367,7 @@ A colon separated list of directories to
|
||||
files in.
|
||||
-Default: SYSCONFDIR/snmp:DATADIR/snmp:LIBDIR/snmp:$HOME/.snmp
|
||||
+Default: SYSCONFDIR/snmp:DATADIR/snmp:/usr/lib(64)/snmp:$HOME/.snmp
|
||||
Default:
|
||||
.br
|
||||
-SYSCONFDIR/snmp:\:DATADIR/snmp:\:LIBDIR/snmp:\:$HOME/.snmp
|
||||
+SYSCONFDIR/snmp:\:DATADIR/snmp:\:/usr/lib(64)/snmp:\:$HOME/.snmp
|
||||
.SH "SEE ALSO"
|
||||
netsnmp_mib_api(3), snmp_api(3)
|
||||
.\" Local Variables:
|
||||
diff -up net-snmp-5.7.3/man/snmp_config.5.def.oSBcEB net-snmp-5.7.3/man/snmp_config.5.def
|
||||
--- net-snmp-5.7.3/man/snmp_config.5.def.oSBcEB 2015-02-17 13:32:04.251309092 +0100
|
||||
+++ net-snmp-5.7.3/man/snmp_config.5.def 2015-02-17 13:33:09.217262438 +0100
|
||||
diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def
|
||||
--- a/man/snmp_config.5.def 2018-07-18 11:18:06.194792767 +0200
|
||||
+++ b/man/snmp_config.5.def 2018-07-18 11:20:56.423626117 +0200
|
||||
@@ -10,7 +10,7 @@ First off, there are numerous places tha
|
||||
found and read from. By default, the applications look for
|
||||
configuration files in the following 4 directories, in order:
|
||||
@ -31,10 +31,10 @@ diff -up net-snmp-5.7.3/man/snmp_config.5.def.oSBcEB net-snmp-5.7.3/man/snmp_con
|
||||
directories, it looks for files snmp.conf, snmpd.conf and/or
|
||||
snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf
|
||||
and/or snmptrapd.local.conf. *.local.conf are always
|
||||
diff -up net-snmp-5.7.3/man/snmpd.conf.5.def.oSBcEB net-snmp-5.7.3/man/snmpd.conf.5.def
|
||||
--- net-snmp-5.7.3/man/snmpd.conf.5.def.oSBcEB 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ net-snmp-5.7.3/man/snmpd.conf.5.def 2015-02-17 13:32:04.251309092 +0100
|
||||
@@ -1502,7 +1502,7 @@ filename), and call the initialisation r
|
||||
diff -urNp a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def
|
||||
--- a/man/snmpd.conf.5.def 2018-07-18 11:18:06.196792766 +0200
|
||||
+++ b/man/snmpd.conf.5.def 2018-07-18 11:21:44.263574388 +0200
|
||||
@@ -1559,7 +1559,7 @@ filename), and call the initialisation r
|
||||
.RS
|
||||
.IP "Note:"
|
||||
If the specified PATH is not a fully qualified filename, it will
|
720
net-snmp-5.8-python3.patch
Normal file
720
net-snmp-5.8-python3.patch
Normal file
@ -0,0 +1,720 @@
|
||||
diff -urNp a/configure b/configure
|
||||
--- a/configure 2018-07-18 17:11:53.178147565 +0200
|
||||
+++ b/configure 2018-07-18 17:14:01.254774416 +0200
|
||||
@@ -7742,8 +7742,8 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
-# Extract the first word of "python", so it can be a program name with args.
|
||||
-set dummy python; ac_word=$2
|
||||
+# Extract the first word of "python3", so it can be a program name with args.
|
||||
+set dummy python3; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PYTHONPROG+:} false; then :
|
||||
diff -urNp a/configure.d/config_os_progs b/configure.d/config_os_progs
|
||||
--- a/configure.d/config_os_progs 2018-07-18 17:11:53.197147510 +0200
|
||||
+++ b/configure.d/config_os_progs 2018-07-18 17:14:29.963690646 +0200
|
||||
@@ -57,7 +57,7 @@ AC_PATH_PROG(AUTOCONF, autoconf, [:
|
||||
AC_PATH_PROG(AUTOHEADER, autoheader, [:])
|
||||
AC_PATH_PROG([PERLPROG], perl)
|
||||
AC_PATH_PROG([PSPROG], ps)
|
||||
-AC_PATH_PROG([PYTHONPROG],python)
|
||||
+AC_PATH_PROG([PYTHONPROG],python3)
|
||||
|
||||
AC_PATH_PROG([UNAMEPROG], uname)
|
||||
AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command])
|
||||
diff -urNp a/Makefile.in b/Makefile.in
|
||||
--- a/Makefile.in 2018-07-18 17:11:53.175147574 +0200
|
||||
+++ b/Makefile.in 2018-07-18 17:16:21.331365317 +0200
|
||||
@@ -226,7 +226,7 @@ perlcleanfeatures:
|
||||
|
||||
# python specific build rules
|
||||
#
|
||||
-PYMAKE=$(PYTHON) setup.py $(PYTHONARGS)
|
||||
+PYMAKE=/usr/bin/python3 setup.py $(PYTHONARGS)
|
||||
pythonmodules: subdirs
|
||||
@(dir=`pwd`; cd python; $(PYMAKE) build --basedir=$$dir) ; \
|
||||
if test $$? != 0 ; then \
|
||||
diff -urNp a/python/netsnmp/client_intf.c b/python/netsnmp/client_intf.c
|
||||
--- a/python/netsnmp/client_intf.c 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/netsnmp/client_intf.c 2018-07-18 17:33:16.495712833 +0200
|
||||
@@ -1,11 +1,5 @@
|
||||
#include <Python.h>
|
||||
|
||||
-#if PY_VERSION_HEX < 0x02050000
|
||||
-typedef int Py_ssize_t;
|
||||
-#define PY_SSIZE_T_MAX INT_MAX
|
||||
-#define PY_SSIZE_T_MIN INT_MIN
|
||||
-#endif
|
||||
-
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
#include <sys/types.h>
|
||||
@@ -852,8 +846,40 @@ py_netsnmp_attr_string(PyObject *obj, ch
|
||||
if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
if (attr) {
|
||||
+ *val = PyUnicode_AsUTF8AndSize(attr, len);
|
||||
+ Py_DECREF(attr);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+py_netsnmp_attr_set_bytes(PyObject *obj, char *attr_name,
|
||||
+ char *val, size_t len)
|
||||
+{
|
||||
+ int ret = -1;
|
||||
+ if (obj && attr_name) {
|
||||
+ PyObject* val_obj = (val ?
|
||||
+ PyBytes_FromStringAndSize(val, len) :
|
||||
+ Py_BuildValue(""));
|
||||
+ ret = PyObject_SetAttrString(obj, attr_name, val_obj);
|
||||
+ Py_DECREF(val_obj);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+py_netsnmp_attr_bytes(PyObject *obj, char * attr_name, char **val,
|
||||
+ Py_ssize_t *len)
|
||||
+{
|
||||
+ *val = NULL;
|
||||
+ if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
+ PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
+ if (attr) {
|
||||
int retval;
|
||||
- retval = PyString_AsStringAndSize(attr, val, len);
|
||||
+ retval = PyBytes_AsStringAndSize(attr, val, len);
|
||||
Py_DECREF(attr);
|
||||
return retval;
|
||||
}
|
||||
@@ -870,7 +896,7 @@ py_netsnmp_attr_long(PyObject *obj, char
|
||||
if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
if (attr) {
|
||||
- val = PyInt_AsLong(attr);
|
||||
+ val = PyLong_AsLong(attr);
|
||||
Py_DECREF(attr);
|
||||
}
|
||||
}
|
||||
@@ -955,13 +981,13 @@ __py_netsnmp_update_session_errors(PyObj
|
||||
|
||||
py_netsnmp_attr_set_string(session, "ErrorStr", err_str, STRLEN(err_str));
|
||||
|
||||
- tmp_for_conversion = PyInt_FromLong(err_num);
|
||||
+ tmp_for_conversion = PyLong_FromLong(err_num);
|
||||
if (!tmp_for_conversion)
|
||||
return; /* nothing better to do? */
|
||||
PyObject_SetAttrString(session, "ErrorNum", tmp_for_conversion);
|
||||
Py_DECREF(tmp_for_conversion);
|
||||
|
||||
- tmp_for_conversion = PyInt_FromLong(err_ind);
|
||||
+ tmp_for_conversion = PyLong_FromLong(err_ind);
|
||||
if (!tmp_for_conversion)
|
||||
return; /* nothing better to do? */
|
||||
PyObject_SetAttrString(session, "ErrorInd", tmp_for_conversion);
|
||||
@@ -1323,7 +1349,7 @@ netsnmp_get(PyObject *self, PyObject *ar
|
||||
|
||||
ss = (SnmpSession *)py_netsnmp_attr_void_ptr(session, "sess_ptr");
|
||||
|
||||
- if (py_netsnmp_attr_string(session, "ErrorStr", &tmpstr, &tmplen) < 0) {
|
||||
+ if (py_netsnmp_attr_bytes(session, "ErrorStr", &tmpstr, &tmplen) < 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2015,7 +2041,7 @@ netsnmp_walk(PyObject *self, PyObject *a
|
||||
vars, tp, type, sprintval_flag);
|
||||
str_buf[len] = '\0';
|
||||
|
||||
- py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf,
|
||||
+ py_netsnmp_attr_set_bytes(varbind, "val", (char *) str_buf,
|
||||
len);
|
||||
|
||||
/* push the varbind onto the return varbinds */
|
||||
@@ -2266,7 +2292,7 @@ netsnmp_getbulk(PyObject *self, PyObject
|
||||
|
||||
__get_type_str(type, type_str);
|
||||
|
||||
- py_netsnmp_attr_set_string(varbind, "type", type_str,
|
||||
+ py_netsnmp_attr_set_bytes(varbind, "type", type_str,
|
||||
strlen(type_str));
|
||||
|
||||
len = __snprint_value((char **)&str_buf, &str_buf_len,
|
||||
@@ -2409,7 +2435,7 @@ netsnmp_set(PyObject *self, PyObject *ar
|
||||
}
|
||||
}
|
||||
|
||||
- if (py_netsnmp_attr_string(varbind, "val", &val, &tmplen) < 0) {
|
||||
+ if (py_netsnmp_attr_bytes(varbind, "val", &val, &tmplen) < 0) {
|
||||
snmp_free_pdu(pdu);
|
||||
goto done;
|
||||
}
|
||||
@@ -2467,7 +2493,6 @@ netsnmp_set(PyObject *self, PyObject *ar
|
||||
return (ret ? ret : Py_BuildValue(""));
|
||||
}
|
||||
|
||||
-
|
||||
static PyMethodDef ClientMethods[] = {
|
||||
{"session", netsnmp_create_session, METH_VARARGS,
|
||||
"create a netsnmp session."},
|
||||
@@ -2490,10 +2515,23 @@ static PyMethodDef ClientMethods[] = {
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
+static struct PyModuleDef ModuleDefinition = {
|
||||
+ PyModuleDef_HEAD_INIT,
|
||||
+ "client_intf",
|
||||
+ NULL,
|
||||
+ -1,
|
||||
+ ClientMethods,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
PyMODINIT_FUNC
|
||||
-initclient_intf(void)
|
||||
+PyInit_client_intf(void)
|
||||
{
|
||||
- (void) Py_InitModule("client_intf", ClientMethods);
|
||||
+ PyObject *module = PyModule_Create(&ModuleDefinition);
|
||||
+ return module;
|
||||
}
|
||||
|
||||
|
||||
diff -urNp a/python/netsnmp/client.py b/python/netsnmp/client.py
|
||||
--- a/python/netsnmp/client.py 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/netsnmp/client.py 2018-07-18 17:37:10.489221397 +0200
|
||||
@@ -34,12 +34,12 @@ def _parse_session_args(kargs):
|
||||
'TheirHostname':'',
|
||||
'TrustCert':''
|
||||
}
|
||||
- keys = kargs.keys()
|
||||
+ keys = list(kargs.keys())
|
||||
for key in keys:
|
||||
- if sessArgs.has_key(key):
|
||||
+ if key in sessArgs:
|
||||
sessArgs[key] = kargs[key]
|
||||
else:
|
||||
- print >>stderr, "ERROR: unknown key", key
|
||||
+ print("ERROR: unknown key", key, file=stderr)
|
||||
return sessArgs
|
||||
|
||||
def STR(obj):
|
||||
@@ -55,7 +55,7 @@ class Varbind(object):
|
||||
def __init__(self, tag=None, iid=None, val=None, type_arg=None):
|
||||
self.tag = STR(tag)
|
||||
self.iid = STR(iid)
|
||||
- self.val = STR(val)
|
||||
+ self.val = val
|
||||
self.type = STR(type_arg)
|
||||
# parse iid out of tag if needed
|
||||
if iid is None and tag is not None:
|
||||
@@ -65,7 +65,10 @@ class Varbind(object):
|
||||
(self.tag, self.iid) = match.group(1, 2)
|
||||
|
||||
def __setattr__(self, name, val):
|
||||
- self.__dict__[name] = STR(val)
|
||||
+ if name == 'val':
|
||||
+ self.__dict__[name] = val
|
||||
+ else:
|
||||
+ self.__dict__[name] = STR(val)
|
||||
|
||||
def __str__(self):
|
||||
return obj_to_str(self)
|
||||
@@ -132,7 +135,7 @@ class Session(object):
|
||||
|
||||
sess_args = _parse_session_args(args)
|
||||
|
||||
- for k, v in sess_args.items():
|
||||
+ for k, v in list(sess_args.items()):
|
||||
self.__dict__[k] = v
|
||||
|
||||
|
||||
diff -urNp a/python/netsnmp/__init__.py b/python/netsnmp/__init__.py
|
||||
--- a/python/netsnmp/__init__.py 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/netsnmp/__init__.py 2018-07-18 17:37:32.553172525 +0200
|
||||
@@ -1 +1 @@
|
||||
-from client import *
|
||||
+from .client import *
|
||||
diff -urNp a/python/netsnmp/tests/test.py b/python/netsnmp/tests/test.py
|
||||
--- a/python/netsnmp/tests/test.py 2018-07-18 17:11:53.263147318 +0200
|
||||
+++ b/python/netsnmp/tests/test.py 2018-07-18 17:38:21.272063355 +0200
|
||||
@@ -12,7 +12,7 @@ def snmp_dest(**kwargs):
|
||||
'DestHost': 'localhost:' + os.environ.get("SNMP_SNMPD_PORT", 161),
|
||||
'Community': 'public',
|
||||
}
|
||||
- for key, value in kwargs.iteritems():
|
||||
+ for key, value in kwargs.items():
|
||||
dest[key] = value
|
||||
return dest
|
||||
|
||||
@@ -62,107 +62,107 @@ class BasicTests(unittest.TestCase):
|
||||
self.assertEqual(var.iid, '')
|
||||
|
||||
def test_v1_get(self):
|
||||
- print "\n"
|
||||
- print "---v1 GET tests -------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 GET tests -------------------------------------\n")
|
||||
var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0')
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
|
||||
- print "v1 snmpget result: ", res, "\n"
|
||||
+ print("v1 snmpget result: ", res, "\n")
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
- print "v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(var.tag, 'sysDescr')
|
||||
self.assertEqual(var.iid, '0')
|
||||
self.assertEqual(var.val, res[0])
|
||||
self.assertEqual(var.type, 'OCTETSTR')
|
||||
|
||||
def test_v1_getnext(self):
|
||||
- print "\n"
|
||||
- print "---v1 GETNEXT tests-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 GETNEXT tests-------------------------------------\n")
|
||||
var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0')
|
||||
res = netsnmp.snmpgetnext(var, **snmp_dest())
|
||||
|
||||
- print "v1 snmpgetnext result: ", res, "\n"
|
||||
+ print("v1 snmpgetnext result: ", res, "\n")
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
- print "v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertTrue(var.tag is not None)
|
||||
self.assertTrue(var.iid is not None)
|
||||
self.assertTrue(var.val is not None)
|
||||
self.assertTrue(var.type is not None)
|
||||
|
||||
def test_v1_set(self):
|
||||
- print "\n"
|
||||
- print "---v1 SET tests-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 SET tests-------------------------------------\n")
|
||||
var = netsnmp.Varbind('sysLocation', '0', 'my new location')
|
||||
res = netsnmp.snmpset(var, **snmp_dest())
|
||||
|
||||
- print "v1 snmpset result: ", res, "\n"
|
||||
+ print("v1 snmpset result: ", res, "\n")
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
- print "v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(var.tag, 'sysLocation')
|
||||
self.assertEqual(var.iid, '0')
|
||||
self.assertEqual(var.val, 'my new location')
|
||||
self.assertTrue(var.type is None)
|
||||
|
||||
def test_v1_walk(self):
|
||||
- print "\n"
|
||||
- print "---v1 walk tests-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 walk tests-------------------------------------\n")
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
- print "v1 varlist walk in: "
|
||||
+ print("v1 varlist walk in: ")
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
res = netsnmp.snmpwalk(varlist, **snmp_dest())
|
||||
- print "v1 snmpwalk result: ", res, "\n"
|
||||
+ print("v1 snmpwalk result: ", res, "\n")
|
||||
self.assertTrue(len(res) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v1_walk_2(self):
|
||||
- print "\n"
|
||||
- print "---v1 walk 2-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 walk 2-------------------------------------\n")
|
||||
|
||||
- print "v1 varbind walk in: "
|
||||
+ print("v1 varbind walk in: ")
|
||||
var = netsnmp.Varbind('system')
|
||||
self.assertEqual(var.tag, 'system')
|
||||
self.assertEqual(var.iid, '')
|
||||
self.assertEqual(var.val, None)
|
||||
self.assertEqual(var.type, None)
|
||||
res = netsnmp.snmpwalk(var, **snmp_dest())
|
||||
- print "v1 snmpwalk result (should be = orig): ", res, "\n"
|
||||
+ print("v1 snmpwalk result (should be = orig): ", res, "\n")
|
||||
self.assertTrue(len(res) > 0)
|
||||
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(var.tag, 'system')
|
||||
self.assertEqual(var.iid, '')
|
||||
self.assertEqual(var.val, None)
|
||||
self.assertEqual(var.type, None)
|
||||
|
||||
def test_v1_mv_get(self):
|
||||
- print "\n"
|
||||
- print "---v1 multi-varbind test-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 multi-varbind test-------------------------------------\n")
|
||||
sess = setup_v1()
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.get(varlist)
|
||||
- print "v1 sess.get result: ", vals, "\n"
|
||||
+ print("v1 sess.get result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
vals = sess.getnext(varlist)
|
||||
- print "v1 sess.getnext result: ", vals, "\n"
|
||||
+ print("v1 sess.getnext result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
||||
netsnmp.Varbind('sysORLastChange'),
|
||||
@@ -171,71 +171,71 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysORUpTime'))
|
||||
|
||||
vals = sess.getbulk(2, 8, varlist)
|
||||
- print "v1 sess.getbulk result: ", vals, "\n"
|
||||
+ print("v1 sess.getbulk result: ", vals, "\n")
|
||||
self.assertEqual(vals, None) # GetBulk is not supported for v1
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v1_set_2(self):
|
||||
- print "\n"
|
||||
- print "---v1 set2-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 set2-------------------------------------\n")
|
||||
|
||||
sess = setup_v1()
|
||||
varlist = netsnmp.VarList(
|
||||
netsnmp.Varbind('sysLocation', '0', 'my newer location'))
|
||||
res = sess.set(varlist)
|
||||
- print "v1 sess.set result: ", res, "\n"
|
||||
+ print("v1 sess.set result: ", res, "\n")
|
||||
|
||||
def test_v1_walk_3(self):
|
||||
- print "\n"
|
||||
- print "---v1 walk3-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 walk3-------------------------------------\n")
|
||||
|
||||
sess = setup_v1()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
vals = sess.walk(varlist)
|
||||
- print "v1 sess.walk result: ", vals, "\n"
|
||||
+ print("v1 sess.walk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v2c_get(self):
|
||||
- print "\n"
|
||||
- print "---v2c get-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c get-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.get(varlist)
|
||||
- print "v2 sess.get result: ", vals, "\n"
|
||||
+ print("v2 sess.get result: ", vals, "\n")
|
||||
self.assertEqual(len(vals), 3)
|
||||
|
||||
def test_v2c_getnext(self):
|
||||
- print "\n"
|
||||
- print "---v2c getnext-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c getnext-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
vals = sess.getnext(varlist)
|
||||
- print "v2 sess.getnext result: ", vals, "\n"
|
||||
+ print("v2 sess.getnext result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v2c_getbulk(self):
|
||||
- print "\n"
|
||||
- print "---v2c getbulk-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c getbulk-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
||||
@@ -245,16 +245,16 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysORUpTime'))
|
||||
|
||||
vals = sess.getbulk(2, 8, varlist)
|
||||
- print "v2 sess.getbulk result: ", vals, "\n"
|
||||
+ print("v2 sess.getbulk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v2c_set(self):
|
||||
- print "\n"
|
||||
- print "---v2c set-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c set-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
|
||||
@@ -262,54 +262,54 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysLocation', '0', 'my even newer location'))
|
||||
|
||||
res = sess.set(varlist)
|
||||
- print "v2 sess.set result: ", res, "\n"
|
||||
+ print("v2 sess.set result: ", res, "\n")
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
def test_v2c_walk(self):
|
||||
- print "\n"
|
||||
- print "---v2c walk-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c walk-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
vals = sess.walk(varlist)
|
||||
- print "v2 sess.walk result: ", vals, "\n"
|
||||
+ print("v2 sess.walk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v3_get(self):
|
||||
- print "\n"
|
||||
+ print("\n")
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
- print "---v3 get-------------------------------------\n"
|
||||
+ print("---v3 get-------------------------------------\n")
|
||||
vals = sess.get(varlist)
|
||||
- print "v3 sess.get result: ", vals, "\n"
|
||||
+ print("v3 sess.get result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v3_getnext(self):
|
||||
- print "\n"
|
||||
- print "---v3 getnext-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v3 getnext-------------------------------------\n")
|
||||
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.getnext(varlist)
|
||||
- print "v3 sess.getnext result: ", vals, "\n"
|
||||
+ print("v3 sess.getnext result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v3_getbulk(self):
|
||||
sess = setup_v3();
|
||||
@@ -320,47 +320,47 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysORUpTime'))
|
||||
|
||||
vals = sess.getbulk(2, 8, varlist)
|
||||
- print "v3 sess.getbulk result: ", vals, "\n"
|
||||
+ print("v3 sess.getbulk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v3_set(self):
|
||||
- print "\n"
|
||||
- print "---v3 set-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v3 set-------------------------------------\n")
|
||||
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(
|
||||
netsnmp.Varbind('sysLocation', '0', 'my final destination'))
|
||||
res = sess.set(varlist)
|
||||
- print "v3 sess.set result: ", res, "\n"
|
||||
+ print("v3 sess.set result: ", res, "\n")
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
def test_v3_walk(self):
|
||||
- print "\n"
|
||||
- print "---v3 walk-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v3 walk-------------------------------------\n")
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
vals = sess.walk(varlist)
|
||||
- print "v3 sess.walk result: ", vals, "\n"
|
||||
+ print("v3 sess.walk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
|
||||
class SetTests(unittest.TestCase):
|
||||
"""SNMP set tests for the Net-SNMP Python interface"""
|
||||
def testFuncs(self):
|
||||
"""Test code"""
|
||||
- print "\n-------------- SET Test Start ----------------------------\n"
|
||||
+ print("\n-------------- SET Test Start ----------------------------\n")
|
||||
|
||||
var = netsnmp.Varbind('sysUpTime', '0')
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
- print "uptime = ", res[0]
|
||||
+ print("uptime = ", res[0])
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
|
||||
@@ -370,19 +370,19 @@ class SetTests(unittest.TestCase):
|
||||
|
||||
var = netsnmp.Varbind('sysUpTime', '0')
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
- print "uptime = ", res[0]
|
||||
+ print("uptime = ", res[0])
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
var = netsnmp.Varbind('nsCacheEntry')
|
||||
res = netsnmp.snmpgetnext(var, **snmp_dest())
|
||||
- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
var.val = 65
|
||||
res = netsnmp.snmpset(var, **snmp_dest())
|
||||
self.assertEqual(res, 1)
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(len(res), 1)
|
||||
self.assertEqual(res[0], '65');
|
||||
|
||||
@@ -394,7 +394,7 @@ class SetTests(unittest.TestCase):
|
||||
netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 4))
|
||||
res = sess.set(varlist)
|
||||
|
||||
- print "res = ", res
|
||||
+ print("res = ", res)
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
||||
@@ -414,15 +414,15 @@ class SetTests(unittest.TestCase):
|
||||
self.assertEqual(varlist[2].val, '3')
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
varlist = netsnmp.VarList(
|
||||
netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 6))
|
||||
|
||||
res = sess.set(varlist)
|
||||
|
||||
- print "res = ", res
|
||||
+ print("res = ", res)
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
||||
@@ -436,10 +436,10 @@ class SetTests(unittest.TestCase):
|
||||
self.assertNotEqual(varlist[2].tag, 'snmpTargetAddrRowStatus')
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
- print "\n-------------- SET Test End ----------------------------\n"
|
||||
+ print("\n-------------- SET Test End ----------------------------\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
diff -urNp a/python/setup.py b/python/setup.py
|
||||
--- a/python/setup.py 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/setup.py 2018-07-18 17:40:36.922751382 +0200
|
||||
@@ -9,9 +9,9 @@ intree=0
|
||||
|
||||
args = sys.argv[:]
|
||||
for arg in args:
|
||||
- if string.find(arg,'--basedir=') == 0:
|
||||
- basedir = string.split(arg,'=')[1]
|
||||
- sys.argv.remove(arg)
|
||||
+ if arg.find('--basedir=') == 0:
|
||||
+ basedir = arg.split('=')[1]
|
||||
+ sys.argv.remove(arg) #tabs
|
||||
intree=1
|
||||
|
||||
if intree:
|
30
net-snmp-5.8-test-debug.patch
Normal file
30
net-snmp-5.8-test-debug.patch
Normal file
@ -0,0 +1,30 @@
|
||||
Don't check tests which depend on DNS - it's disabled in Koji
|
||||
|
||||
diff -urNp a/testing/fulltests/default/T070com2sec_simple b/testing/fulltests/default/T070com2sec_simple
|
||||
--- a/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:52:56.081185545 +0200
|
||||
+++ b/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:54:18.843968880 +0200
|
||||
@@ -134,6 +134,10 @@ SAVECHECKAGENT '<"c406a", 255.255.255.25
|
||||
SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies
|
||||
SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies
|
||||
|
||||
+FINISHED
|
||||
+
|
||||
+# don't test the rest, it depends on DNS, which is not available in Koji
|
||||
+
|
||||
CHECKAGENT '<"c408a"'
|
||||
if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||
CHECKAGENT 'line 32: Error:'
|
||||
diff -urNp a/testing/fulltests/default/T071com2sec6_simple b/testing/fulltests/default/T071com2sec6_simple
|
||||
--- a/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:52:56.080185548 +0200
|
||||
+++ b/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:55:17.779818732 +0200
|
||||
@@ -132,6 +132,10 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff
|
||||
SAVECHECKAGENT 'line 27: Error:'
|
||||
SAVECHECKAGENT 'line 28: Error:'
|
||||
|
||||
+FINISHED
|
||||
+
|
||||
+# don't test the rest, it depends on DNS, which is not available in Koji
|
||||
+
|
||||
# 608
|
||||
CHECKAGENT '<"c608a"'
|
||||
if [ "$snmp_last_test_result" -eq 0 ] ; then
|
102
net-snmp.spec
102
net-snmp.spec
@ -6,8 +6,8 @@
|
||||
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: 5.7.3
|
||||
Release: 40%{?dist}
|
||||
Version: 5.8
|
||||
Release: 1%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD
|
||||
@ -23,54 +23,25 @@ Source7: net-snmp-tmpfs.conf
|
||||
Source8: snmpd.service
|
||||
Source9: snmptrapd.service
|
||||
Source10: IETF-MIB-LICENSE.txt
|
||||
|
||||
Patch1: net-snmp-5.7.2-pie.patch
|
||||
Patch2: net-snmp-5.5-dir-fix.patch
|
||||
Patch3: net-snmp-5.6-multilib.patch
|
||||
Patch4: net-snmp-5.5-apsl-copying.patch
|
||||
Patch5: net-snmp-5.6-test-debug.patch
|
||||
Patch6: net-snmp-5.7.2-systemd.patch
|
||||
Patch7: net-snmp-5.7.2-create-user-multilib.patch
|
||||
Patch8: net-snmp-5.7.2-autoreconf.patch
|
||||
Patch9: net-snmp-5.7-agentx-crash.patch
|
||||
Patch10: net-snmp-5.5-agentx-disconnect-crash.patch
|
||||
Patch11: net-snmp-5.7.2-cert-path.patch
|
||||
Patch12: net-snmp-5.7.3-snmpstatus-null.patch
|
||||
Patch13: net-snmp-5.7.3-cflags.patch
|
||||
# Remove U64 typedef to build against Perl 5.24
|
||||
# Backported from upstream
|
||||
Patch14: net-snmp-5.7.3-Remove-U64-typedef.patch
|
||||
# Fixed Makefile.PL to build against Perl 5.24
|
||||
# For more info: https://rt.perl.org/Public/Bug/Display.html?id=125907
|
||||
Patch15: net-snmp-5.7.3-Fix-Makefile-PL.patch
|
||||
# Use strtok_r for strtok to avoid a race condition
|
||||
Patch16: net-snmp-5.7.3-strtok-r.patch
|
||||
# Fix build with MariaDB 10.2
|
||||
# https://sourceforge.net/p/net-snmp/bugs/2782/
|
||||
# Josef's patch from https://sourceforge.net/p/net-snmp/bugs/2782/#cbed
|
||||
# but with the config_os_libs2 portion removed
|
||||
Patch17: net-snmp-5.7.3-mariadb102.patch
|
||||
# Fix issue with undefined symbol my_progname when try to load
|
||||
# NetSNMP::TrapReceiver in perl script (#1470004)
|
||||
# https://sourceforge.net/p/net-snmp/bugs/2792/
|
||||
# https://sourceforge.net/p/net-snmp/bugs/2792/attachment/0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||
# (rebased on 5.7.3)
|
||||
Patch18: 0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||
|
||||
Patch19: net-snmp-5.7.3-mariadb-connector-c.patch
|
||||
Patch20: net-snmp-5.7.3-strstr.patch
|
||||
Patch21: net-snmp-5.7.3-iterator-fix.patch
|
||||
Patch22: net-snmp-5.7.3-autofs.patch
|
||||
Patch23: net-snmp-5.7.3-CVE-2018-1000116.patch
|
||||
|
||||
# This patch fix issue with new OpenSLL library in rawhide (f26+)
|
||||
# !!!WARNING!!! DO NOT USE IT FOR OLDER FEDORA RELEASES (>f26)
|
||||
Patch100: net-snmp-5.7.3-openssl.patch
|
||||
Patch2: net-snmp-5.8-dir-fix.patch
|
||||
Patch3: net-snmp-5.8-multilib.patch
|
||||
Patch4: net-snmp-5.8-test-debug.patch
|
||||
Patch5: net-snmp-5.7.2-autoreconf.patch
|
||||
Patch6: net-snmp-5.8-agentx-disconnect-crash.patch
|
||||
Patch7: net-snmp-5.7.2-cert-path.patch
|
||||
Patch8: net-snmp-5.8-cflags.patch
|
||||
Patch9: net-snmp-5.8-Remove-U64-typedef.patch
|
||||
Patch10: net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||
Patch11: net-snmp-5.7.3-iterator-fix.patch
|
||||
Patch12: net-snmp-5.8-autofs-skip.patch
|
||||
|
||||
# Modern RPM API means at least EL6
|
||||
Patch101: net-snmp-5.7.3-modern-rpm-api.patch
|
||||
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
||||
|
||||
#disable this patch due compatibility issues
|
||||
Patch102: net-snmp-5.7.3-python3.patch
|
||||
Patch102: net-snmp-5.8-python3.patch
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
@ -80,12 +51,11 @@ Requires: gcc
|
||||
# should fire just after this package is installed.
|
||||
%{?systemd_requires}
|
||||
BuildRequires: systemd
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
|
||||
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
|
||||
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps
|
||||
BuildRequires: python3-devel, python3-setuptools
|
||||
#BuildRequires: python2-devel, python2-setuptools
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: mariadb-connector-c-devel
|
||||
# for netstat, needed by 'make test'
|
||||
@ -225,27 +195,16 @@ cp %{SOURCE10} .
|
||||
|
||||
%patch2 -p1 -b .dir-fix
|
||||
%patch3 -p1 -b .multilib
|
||||
%patch4 -p1 -b .apsl
|
||||
%patch5 -p1
|
||||
%patch6 -p1 -b .systemd
|
||||
%patch7 -p1 -b .multilib
|
||||
%patch8 -p1 -b .autoreconf
|
||||
%patch9 -p1 -b .agentx-crash
|
||||
%patch10 -p1 -b .agentx-disconnect-crash
|
||||
%patch11 -p1 -b .cert-path
|
||||
%patch12 -p1 -b .snmpstatus-null
|
||||
%patch13 -p1 -b .cflags
|
||||
%patch14 -p1 -b .U64
|
||||
%patch15 -p1 -b .make
|
||||
%patch16 -p1 -b .strtok-r
|
||||
%patch17 -p1 -b .mariadb102
|
||||
%patch18 -p1 -b .perlfix
|
||||
%patch19 -p1 -b .mariadb-connector-c
|
||||
%patch20 -p1 -b .strstr
|
||||
%patch21 -p1 -b .iterator-fix
|
||||
%patch22 -p1 -b .autofs-skip
|
||||
%patch23 -p1 -b .CVE-2018-1000116
|
||||
%patch100 -p1 -b .openssl
|
||||
%patch4 -p1
|
||||
%patch5 -p1 -b .autoreconf
|
||||
%patch6 -p1 -b .agentx-disconnect-crash
|
||||
%patch7 -p1 -b .cert-path
|
||||
%patch8 -p1 -b .cflags
|
||||
%patch9 -p1 -b .u64-remove
|
||||
%patch10 -p1 -b .perlfix
|
||||
%patch11 -p1 -b .iterator-fix
|
||||
%patch12 -p1 -b .autofs-skip
|
||||
|
||||
%patch101 -p1 -b .modern-rpm-api
|
||||
%patch102 -p1
|
||||
|
||||
@ -474,6 +433,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%{_bindir}/mib2c
|
||||
%{_bindir}/snmp-bridge-mib
|
||||
%{_bindir}/net-snmp-cert
|
||||
%{_bindir}/checkbandwidth
|
||||
%dir %{_datadir}/snmp
|
||||
%{_datadir}/snmp/mib2c*
|
||||
%{_datadir}/snmp/*.pl
|
||||
@ -485,6 +445,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%{perl_vendorarch}/*SNMP*
|
||||
%{perl_vendorarch}/auto/*SNMP*
|
||||
%{perl_vendorarch}/auto/Bundle/*SNMP*
|
||||
%{perl_vendorarch}/Bundle/MakefileSubs.pm
|
||||
|
||||
%files -n python3-net-snmp
|
||||
%doc README
|
||||
@ -512,6 +473,11 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%{_libdir}/libnetsnmptrapd*.so.*
|
||||
|
||||
%changelog
|
||||
* Wed Jul 18 2018 Josef Ridky <jridky@redhat.com> - 1:5.8-1
|
||||
- New upstream release 5.8
|
||||
- remove APSL downstream patch due this copyright is already
|
||||
coveret by part 8 in COPYING file
|
||||
|
||||
* Wed Jun 27 2018 Jitka Plesnikova <jplesnik@redhat.com> - 1:5.7.3-40
|
||||
- Perl 5.28 rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user