1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
$NetBSD: patch-em,v 1.2 2006/10/18 22:37:46 seb Exp $
This contains local (pkgsrc) LP64 patches as well as
http://net-snmp.cvs.sourceforge.net/net-snmp/net-snmp/perl/SNMP/SNMP.xs?r1=5.50.2.6&r2=5.50.2.7&view=patch&pathrev=V5-3-patches
--- perl/SNMP/SNMP.xs.orig 2006-05-26 16:59:15.000000000 +0000
+++ perl/SNMP/SNMP.xs
@@ -117,15 +117,15 @@ static int __snprint_value _((char *, si
netsnmp_variable_list*, struct tree *,
int, int));
static int __sprint_num_objid _((char *, oid *, int));
-static int __scan_num_objid _((char *, oid *, int *));
+static int __scan_num_objid _((char *, oid *, size_t *));
static int __get_type_str _((int, char *));
static int __get_label_iid _((char *, char **, char **, int));
static int __oid_cmp _((oid *, int, oid *, int));
static int __tp_sprint_num_objid _((char*,SnmpMibNode *));
static SnmpMibNode * __get_next_mib_node _((SnmpMibNode *));
static struct tree * __oid2tp _((oid*, int, struct tree *, int*));
-static struct tree * __tag2oid _((char *, char *, oid *, int *, int *, int));
-static int __concat_oid_str _((oid *, int *, char *));
+static struct tree * __tag2oid _((char *, char *, oid *, size_t *, int *, int));
+static int __concat_oid_str _((oid *, size_t *, char *));
static int __add_var_val_str _((netsnmp_pdu *, oid *, int, char *,
int, int));
static int __send_sync_pdu _((netsnmp_session *, netsnmp_pdu *,
@@ -583,7 +583,7 @@ static int
__scan_num_objid (buf, objid, len)
char *buf;
oid *objid;
-int *len;
+size_t *len;
{
char *cp;
*len = 0;
@@ -874,14 +874,14 @@ __tag2oid(tag, iid, oid_arr, oid_arr_len
char * tag;
char * iid;
oid * oid_arr;
-int * oid_arr_len;
+size_t * oid_arr_len;
int * type;
int best_guess;
{
struct tree *tp = NULL;
struct tree *rtp = NULL;
oid newname[MAX_OID_LEN], *op;
- int newname_len = 0;
+ size_t newname_len = 0;
const char *cp = NULL;
char *module = NULL;
@@ -1022,7 +1022,7 @@ found:
static int
__concat_oid_str(doid_arr, doid_arr_len, soid_str)
oid *doid_arr;
-int *doid_arr_len;
+size_t *doid_arr_len;
char * soid_str;
{
char soid_buf[STR_BUF_SIZE];
@@ -1911,7 +1911,7 @@ _bulkwalk_send_pdu(walk_context *context
** we sent in this request. Note that this is not a valid SNMP PDU,
** but that's because a response has not yet been received.
*/
- return (netsnmp_pdu *)reqid;
+ return (netsnmp_pdu *)(long)reqid;
}
/* This code is for synchronous mode support.
@@ -2320,6 +2320,8 @@ _bulkwalk_finish(walk_context *context,
SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
dSP;
+ dMARK;
+ dITEMS;
async = SvTRUE(context->perl_cb);
@@ -2328,6 +2330,8 @@ _bulkwalk_finish(walk_context *context,
** items pushed onto the stack. For async, create a new array and push
** the references onto it. The array is then passed to the Perl callback.
*/
+ if(!async)
+ SP -= items;
DBPRT(1, (DBOUT "Bulwalk %s (saved %d/%d), ", okay ? "completed" : "had error",
context->oid_saved, context->oid_total));
@@ -3006,7 +3010,7 @@ snmp_set(sess_ref, varlist_ref, perl_cal
netsnmp_pdu *pdu, *response;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
char *tag_pv;
snmp_xs_cb_data *xs_cb_data;
SV **sess_ptr_sv;
@@ -3207,7 +3211,7 @@ snmp_get(sess_ref, retry_nosuch, varlist
struct tree *tp;
int len;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV *tmp_sv;
int type;
char tmp_type_str[MAX_TYPE_NAME_LEN];
@@ -3425,7 +3429,7 @@ snmp_getnext(sess_ref, varlist_ref, perl
struct tree *tp;
int len;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV *tmp_sv;
int type;
char tmp_type_str[MAX_TYPE_NAME_LEN];
@@ -3669,7 +3673,7 @@ snmp_getbulk(sess_ref, nonrepeaters, max
struct tree *tp;
int len;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV *tmp_sv;
int type;
char tmp_type_str[MAX_TYPE_NAME_LEN];
@@ -3897,7 +3901,7 @@ snmp_bulkwalk(sess_ref, nonrepeaters, ma
netsnmp_session *ss;
netsnmp_pdu *pdu = NULL;
oid oid_arr[MAX_OID_LEN];
- int oid_arr_len;
+ size_t oid_arr_len;
SV **sess_ptr_sv;
SV **err_str_svp;
SV **err_num_svp;
@@ -4115,7 +4119,7 @@ snmp_bulkwalk(sess_ref, nonrepeaters, ma
/* Sent okay... Return the request ID in 'pdu' as an SvIV. */
DBPRT(1,(DBOUT "Okay, request id is %d\n", (intptr_t) pdu));
/* XSRETURN_IV((intptr_t)pdu); */
- XPUSHs(sv_2mortal(newSViv(pdu)));
+ XPUSHs(sv_2mortal(newSViv((intptr_t)pdu)));
XSRETURN(1);
}
@@ -4208,7 +4212,7 @@ snmp_trapV1(sess_ref,enterprise,agent,ge
netsnmp_pdu *pdu = NULL;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV **sess_ptr_sv;
SV **err_str_svp;
SV **err_num_svp;
@@ -4347,7 +4351,7 @@ snmp_trapV2(sess_ref,uptime,trap_oid,var
netsnmp_pdu *pdu = NULL;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
SV **sess_ptr_sv;
SV **err_str_svp;
SV **err_num_svp;
@@ -4484,7 +4488,7 @@ snmp_inform(sess_ref,uptime,trap_oid,var
netsnmp_pdu *response;
struct tree *tp;
oid *oid_arr;
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
snmp_xs_cb_data *xs_cb_data;
SV **sess_ptr_sv;
SV **err_str_svp;
@@ -4715,7 +4719,7 @@ snmp_translate_obj(var,mode,use_long,aut
char str_buf[STR_BUF_SIZE];
char str_buf_temp[STR_BUF_SIZE];
oid oid_arr[MAX_OID_LEN];
- int oid_arr_len = MAX_OID_LEN;
+ size_t oid_arr_len = MAX_OID_LEN;
char * label;
char * iid;
int status = FAILURE;
|