]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SNMP changes/fixes
authorwessels <>
Tue, 17 Mar 1998 12:12:30 +0000 (12:12 +0000)
committerwessels <>
Tue, 17 Mar 1998 12:12:30 +0000 (12:12 +0000)
- changed some snmplib debugging messages
- simplifed and fixed snmplib_debug_hook interface.  It
  wasn't properly passing all the 'varargs' args.  Now
  it just vsnprintf's to a buf and passes that.
- struct _snmpconf was never used.
- made 'snmp_agent_conf' a stringlist type
- moved 'snmp_agent_conf' processing to snmpInit().
- moved snmpInit() call to before 'ready to serve requests'
  message.

ChangeLog
snmplib/mib.c
snmplib/parse.c
snmplib/snmplib_debug.c
src/cache_cf.cc
src/cf.data.pre
src/main.cc
src/structs.h
src/typedefs.h

index 5d74273697f6a2eb223238a37771bd0b8b40854f..96bf6df17ecfed96ea29a112d586ac6eef2110a1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
        - Extended String object to use memory pools.  Most fixed size char
          array fields will be replaced using string pools. Same for most
          malloc()-ed buffers.
+       - Changed icon handling to use the hostname and port of the squid
+         server, instead of the special hostname "internal.squid".
+       - All icons are now configured in mime.conf. No hardcoded icons,
+         including gohper icons.
        - Fixed ICP bug when we send queries, but expect zero
          replies.
        - Fixed alignment/casting bugs for ICP messages.
          Code is still beta and interoperability with browsers etc has
          not been tested.
        - Put #ifdefs around 'source_ping' code.
+       - Added missing typedef for _arp_ip_data (Wesha).
+       - Added regular-expression-based ACLs for client and server
+         domain names (Henrik Nordstrom).
+       - Fixed ident-related coredumps from incorrect callback data.
+       - Fixed parse_rfc1123() "space" bug.
+       - Fixed xrealloc() XMALLOC_DEBUG bug (not calling check_free())..
+       - Fixed some src/asn.c end-of-reply bugs and memory leaks.
+       - Fixed some peer->options flag-setting bugs.
+       - Fixed single-parent feature to work again
+       - Removed 'single_parent_bypass' configuration option; instead
+         just use 'no-query'.
+       - Surrounded 'source_ping' code with #ifdefs.
+       - Changed 'deny_info URL' to use a custom Error page.
+       - Modified src/client.c for testing POST requests.
 
 Changes to squid-1.2.beta16 (Mar 4, 1998):
 
index 31ee53b6c10a9f1191790935b091e825676f44b1..f686d3b1ff82d5d94682177d12a87e61eb83bdd9 100644 (file)
@@ -697,7 +697,7 @@ int read_objid(input, output, out_len)
     }
 
     if (root == NULL){
-       snmplib_debug(0, "Mib not initialized.  Exiting.\n");
+       snmplib_debug(0, "Mib not initialized.\n");
        return 0;
     }
     if ((*out_len = parse_subtree(root, input, output, out_len)) == 0)
index c4a66597646fd9cf43d211dc327de1343e9b4274..a4e2620dea7fd2c678789e845361736ef87ea163 100644 (file)
@@ -1083,8 +1083,7 @@ parse(fp)
 }
 
 struct snmp_mib_tree *
-read_mib(filename)
-    char *filename;
+read_mib(char *filename)
 {
     FILE *fp;
     struct node *nodes;
@@ -1094,7 +1093,7 @@ read_mib(filename)
 
     fp = fopen(filename, "r");
     if (fp == NULL) {
-       snmplib_debug(0, "failed to open MIB file: '%s'\n", filename);
+       snmplib_debug(1, "init_mib: %s: %s\n", filename, xstrerror());
        return(NULL);
     }
 
index a300070022c9cff7e76a932a8b673a6e025aa876..52e629db10d76577cb0e33dd512152338a1fd7e1 100644 (file)
@@ -8,6 +8,10 @@
 #include <varargs.h>
 #endif
 
+#if !HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
 #ifdef __STDC__
 void (*snmplib_debug_hook) (int,char *,...) = NULL;
 #else
@@ -16,25 +20,29 @@ void (*snmplib_debug_hook) (va_alist) = NULL;
 
 extern void
 #ifdef __STDC__
-snmplib_debug(int lvl,char *fmt,...)
+snmplib_debug(int lvl, char *fmt,...)
 {
-       va_list args;
-       va_start(args, fmt);
+    char buf[BUFSIZ];
+    va_list args;
+    va_start(args, fmt);
 #else
 snmplib_debug(va_alist)
-       va_dcl
+     va_dcl
 {
-       va_list args;
-       int lvl;
-       char char *fmt;
-       va_start(args);
-       lvl = va_arg(args, int);
-       fmt = va_arg(args, char *);
+    va_list args;
+    int lvl;
+    char char *fmt;
+    char buf[BUFSIZ];
+    va_start(args);
+    lvl = va_arg(args, int);
+    fmt = va_arg(args, char *);
 #endif
-       if (snmplib_debug_hook != NULL)
-               snmplib_debug_hook(lvl, fmt, args);
-       else
-               vfprintf(stderr, fmt, args);
-       va_end(args);
+    if (snmplib_debug_hook != NULL) {
+       vsnprintf(buf, BUFSIZ, fmt, args);
+       snmplib_debug_hook(lvl, buf);
+    } else {
+       vfprintf(stderr, fmt, args);
+    }
+    va_end(args);
 }
 
index f7b4f98e471d3127592984f6d226560fba562848..4f6431544deca1ef3cfb723a373eb8a80d745a24 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.258 1998/03/16 21:45:00 wessels Exp $
+ * $Id: cache_cf.cc,v 1.259 1998/03/17 05:12:34 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -57,14 +57,12 @@ static void self_destruct(void);
 static void wordlistAdd(wordlist **, const char *);
 
 static void configDoConfigure(void);
-#if SQUID_SNMP
-static void parse_snmp_conf(snmpconf **);
-#endif
 static void parse_refreshpattern(refresh_t **);
 static int parseTimeUnits(const char *unit);
 static void parseTimeLine(time_t * tptr, const char *units);
 static void parse_string(char **);
 static void parse_wordlist(wordlist **);
+static void parse_stringlist(wordlist **);
 static void default_all(void);
 static void defaults_if_none(void);
 static int parse_line(char *);
@@ -380,53 +378,6 @@ dump_acl(StoreEntry * entry, const char *name, acl * acl)
     }
 }
 
-#if SQUID_SNMP
-static void
-parse_snmp_conf(snmpconf ** s)
-{
-    static char buff[256];
-    static char *tokens[10], *p;
-
-    if (Mib == NULL) {
-       if (Config.Snmp.mibPath)
-           init_mib(Config.Snmp.mibPath);
-       else
-           fatal("snmp_mib_path should be defined before any snmp_agent_conf\n");
-    }
-    p = strtok(NULL, null_string);
-    xstrncpy(buff, p, 256);
-    tokenize(buff, tokens, 10);
-    if (!strcmp("view", tokens[0])) {
-       if (create_view(tokens) < 0)
-           debug(49, 5) ("snmp: parse_snmpconf(): error\n");
-    } else if (!strcmp("user", tokens[0])) {
-       if (create_user(tokens) < 0)
-           debug(49, 5) ("snmp: parse_snmpconf(): error\n");
-    } else if (!strcmp("community", tokens[0])) {
-       if (create_community(tokens) < 0)
-           debug(49, 5) ("snmp: parse_snmpconf(): error\n");
-    } else
-       debug(49, 5) ("snmp: unknown directive %s\n", tokens[0]);
-}
-
-static void
-dump_snmp_conf(StoreEntry * entry, const char *name, snmpconf * head)
-{
-    storeAppendPrintf(entry, "%s -- UNIMPLEMENTED\n", name);
-}
-
-static void
-free_snmp_conf(snmpconf ** head)
-{
-    snmpconf *t;
-    while ((t = *head) != NULL) {
-       *head = t->next;
-       safe_free(t->line);
-       safe_free(t);
-    }
-}
-#endif
-
 static void
 parse_acl(acl ** acl)
 {
@@ -1296,11 +1247,20 @@ static void
 parse_wordlist(wordlist ** list)
 {
     char *token;
-
     while ((token = strtok(NULL, w_space)))
        wordlistAdd(list, token);
 }
 
+static void
+parse_stringlist(wordlist ** list)
+{
+    char *token;
+    while ((token = strtok(NULL, null_string)))
+       wordlistAdd(list, token);
+}
+#define free_stringlist free_wordlist
+#define dump_stringlist dump_wordlist
+
 #define free_wordlist wordlistDestroy
 
 #include "cf_parser.c"
index 4b94cb5ed5002267bf00487c35680ff7a23dd4fb..0672b6e16adcdc0dd93306258b49dbb116bd61a0 100644 (file)
@@ -2075,7 +2075,7 @@ snmp_enable_authen_traps off
 DOC_END
 
 NAME: snmp_agent_conf
-TYPE: snmp_conf
+TYPE: stringlist
 LOC: Config.Snmp.snmpconf
 DEFAULT: none
 IFDEF: SQUID_SNMP
index a35225a0d370094a8d39a5adc9bfa55a887edeaf..2d92e090d80a71ce4843f4ff96e7d04f86b8d1a0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.236 1998/03/13 05:41:37 wessels Exp $
+ * $Id: main.cc,v 1.237 1998/03/17 05:12:36 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -453,6 +453,9 @@ mainInitialize(void)
     httpHeaderInitModule();    /* must go before any header processing (e.g. the one in errorInitialize) */
     errorInitialize();
     accessLogInit();
+#ifdef SQUID_SNMP
+    snmpInit();
+#endif
 
 #if MALLOC_DBG
     malloc_debug(0, malloc_debug_level);
@@ -507,9 +510,6 @@ mainInitialize(void)
        eventAdd("fqdncache_purgelru", fqdncache_purgelru, NULL, 15);
     }
     configured_once = 1;
-#ifdef SQUID_SNMP
-    snmpInit();
-#endif
 }
 
 int
index bded2f3796f8c1a84a44d9daf7bb9b454ce908f0..1c074d2dc10cac16b148dd368f79f65546d1be21 100644 (file)
@@ -43,7 +43,6 @@ struct _acl_arp_data {
     acl_arp_data *next;
 #endif
 };
-
 #endif
 
 struct _String {
@@ -54,12 +53,6 @@ struct _String {
 };
 
 #if SQUID_SNMP
-struct _snmpconf {
-    char *line;
-    int type;
-    snmpconf *next;
-};
-
 struct _snmp_request_t {
     u_char *buf;
     u_char *outbuf;
@@ -102,7 +95,6 @@ typedef struct _usecEntry {
     int authWriteView;
     struct _usecEntry *next;
 } usecEntry;
-
 #endif
 
 struct _acl {
@@ -216,7 +208,7 @@ struct _SquidConfig {
        u_short localPort;
        int do_queueing;
        int conf_authtraps;
-       struct _snmpconf *snmpconf;
+       wordlist *snmpconf;
        viewEntry *views;
        usecEntry *users;
        communityEntry *communities;
index d66953c4b442522b6c004ce15c254fac1b0965e0..15271990e8d6ffa1e2758a8e9c004ded6e47e884 100644 (file)
@@ -27,7 +27,6 @@ typedef struct _acl_deny_info_list acl_deny_info_list;
 typedef struct _acl_proxy_auth acl_proxy_auth;
 typedef struct _acl_arp_data acl_arp_data;
 typedef struct _acl acl;
-typedef struct _snmpconf snmpconf;
 typedef struct _snmp_request_t snmp_request_t;
 typedef struct _acl_list acl_list;
 typedef struct _acl_access acl_access;