From: wessels <> Date: Fri, 21 Nov 1997 12:55:51 +0000 (+0000) Subject: Continuing SNMP debugging. X-Git-Tag: SQUID_3_0_PRE1~4493 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3265e68dfa57c4a6dd17c27d30e8a32b33103c71;p=thirdparty%2Fsquid.git Continuing SNMP debugging. - snmpHandleUdp needed to set 'outlen' before calling snmp_agent_parse()! --- diff --git a/include/snmp_impl.h b/include/snmp_impl.h index 22205dbc0a..abab343e75 100644 --- a/include/snmp_impl.h +++ b/include/snmp_impl.h @@ -98,7 +98,7 @@ SOFTWARE. #define UINTEGER (ASN_APPLICATION | 7) #define DEBUG #ifdef DEBUG -#define ERROR(string) fprintf(stderr,"%s(%d): %s\n",__FILE__, __LINE__, string); +#define ERROR(string) fprintf(stderr,"%s(%d): ERROR %s\n",__FILE__, __LINE__, string); #else #define ERROR(string) #endif diff --git a/snmplib/Makefile.in b/snmplib/Makefile.in index 4c51492548..3cabbd8cc7 100644 --- a/snmplib/Makefile.in +++ b/snmplib/Makefile.in @@ -20,7 +20,7 @@ OBJS= snmp_client.o snmp.o snmp_auth.o asn1.o mib.o parse.o snmp_api.o \ md5.o usec.o snmpdump.o CC= @CC@ -FLAGS= +FLAGS= -g DEFS= -DBSD4_3 -DSQUID_SNMP=1 INCLUDE= -I../include -I./../include -I../src -I./../src MIBDEFS= -DMIBFILEPATH=\"$(prefix)/lib\" diff --git a/snmplib/asn1.c b/snmplib/asn1.c index cb520f104f..7e37022700 100644 --- a/snmplib/asn1.c +++ b/snmplib/asn1.c @@ -48,6 +48,8 @@ SOFTWARE. #include "asn1.h" +#include + #ifndef NULL #define NULL 0 #endif @@ -464,6 +466,7 @@ asn_build_sequence(data, datalength, type, length) u_char type; /* IN - ASN type of object */ int length; /* IN - length of object */ { + assert (*datalength >= 0); *datalength -= 4; if (*datalength < 0) { *datalength += 4; /* fix up before punting */ diff --git a/src/main.cc b/src/main.cc index d7ffd815a2..4045671169 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.194 1997/11/21 01:59:16 wessels Exp $ + * $Id: main.cc,v 1.195 1997/11/21 05:55:53 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -130,10 +130,6 @@ static void mainParseOptions(int, char **); static void sendSignal(void); static void serverConnectionsOpen(void); static void watch_child(char **); -#ifdef SQUID_SNMP -extern void init_snmp(); -extern void initSquidSnmp(); -#endif static void usage(void) { @@ -404,7 +400,7 @@ serverConnectionsOpen(void) } } #ifdef SQUID_SNMP - initSquidSnmp(); + snmpConnectionOpen(); #endif clientdbInit(); @@ -570,9 +566,8 @@ mainInitialize(void) statAvgInit(); } configured_once = 1; - #ifdef SQUID_SNMP - init_snmp(); + snmpInit(); #endif } diff --git a/src/protos.h b/src/protos.h index 3ee2d679c7..60188cf5e3 100644 --- a/src/protos.h +++ b/src/protos.h @@ -239,8 +239,9 @@ extern PF icpHandleUdp; extern PF httpAccept; extern DEFER httpAcceptDefer; #ifdef SQUID_SNMP -/*extern PF snmpHandleUdp; */ -/*extern void initSquidSnmp(); */ +extern PF snmpHandleUdp; +extern void snmpInit(void); +extern void snmpConnectionOpen(void); #endif /* SQUID_SNMP */ extern void icpSendERROR(int fd,