]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added mib version check and ignore -DEFINITIONS so that we don't need to
authorkostas <>
Fri, 27 Feb 1998 06:18:13 +0000 (06:18 +0000)
committerkostas <>
Fri, 27 Feb 1998 06:18:13 +0000 (06:18 +0000)
have this stuff commented in mib.txt

include/version.h
snmplib/parse.c

index 01baa8e2ae04c4a0c39e8cc441285c5777975bf0..d82c5c2532bea98eccb53728d5aeeca0808770ab 100644 (file)
@@ -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
index da7aab8d01273583962c5122976e7f404a9b0c01..47a5c25bb245aa0c38a7f55f60b1194a2a3de40d 100644 (file)
@@ -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");