From: kostas <> Date: Fri, 27 Feb 1998 06:18:13 +0000 (+0000) Subject: Added mib version check and ignore -DEFINITIONS so that we don't need to X-Git-Tag: SQUID_3_0_PRE1~3967 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f658b0cc91b8a917398dbc845c094ed8385611ad;p=thirdparty%2Fsquid.git Added mib version check and ignore -DEFINITIONS so that we don't need to have this stuff commented in mib.txt --- diff --git a/include/version.h b/include/version.h index 01baa8e2ae..d82c5c2532 100644 --- a/include/version.h +++ b/include/version.h @@ -1,11 +1,14 @@ /* - * $Id: version.h,v 1.101 1998/02/21 00:56:37 rousskov Exp $ + * $Id: version.h,v 1.102 1998/02/26 23:18:13 kostas Exp $ * * SQUID_VERSION - String for version id of this distribution */ #ifndef SQUID_VERSION #define SQUID_VERSION "1.2.beta15" #endif +#ifndef CURRENT_MIB_VERSION +#define CURRENT_MIB_VERSION "-- $Id: version.h,v 1.102 1998/02/26 23:18:13 kostas Exp $" +#endif #ifndef SQUID_RELEASE_TIME #define SQUID_RELEASE_TIME squid_curtime diff --git a/snmplib/parse.c b/snmplib/parse.c index da7aab8d01..47a5c25bb2 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c @@ -200,6 +200,7 @@ struct tok tokens[] = { { "DESCRIPTION", sizeof ("DESCRIPTION")-1, DESCRIPTION }, { "INDEX", sizeof ("INDEX")-1, INDEX }, { "\"", sizeof ("\"")-1, QUOTE }, + { "END", sizeof("END")-1, ENDOFFILE }, /* Hacks for easier MIBFILE coercing */ { "read-create", sizeof ("read-create")-1, READWRITE }, { NULL } @@ -1088,10 +1089,25 @@ read_mib(filename) FILE *fp; struct node *nodes; struct snmp_mib_tree *tree; + char mbuf[256]; + char *p; fp = fopen(filename, "r"); if (fp == NULL) return(NULL); + + mbuf[0]='\0'; + while ( (p=fgets(mbuf, 256, fp)) && strncmp(mbuf, CURRENT_MIB_VERSION, + strlen(CURRENT_MIB_VERSION))); + if (!p) { + snmplib_debug(0, "Bad MIB version or tag missing,install original!\n"); + exit(1); + } + + if (!strcmp(mbuf, CURRENT_MIB_VERSION)) { + snmplib_debug(0, "You need to update your MIB!\n"); + exit(1); + } nodes = parse(fp); if (!nodes){ snmplib_debug(0, "Mib table is bad. Exiting\n");