number info. Error pages are reloaded on SIGHUP. Minor snmp cleanup.
/*
- * $Id: acl.cc,v 1.122 1997/12/05 21:02:06 wessels Exp $
+ * $Id: acl.cc,v 1.123 1997/12/27 18:15:08 kostas Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
static void aclCheck(aclCheck_t * checklist);
static void aclCheckCallback(aclCheck_t * checklist, allow_t answer);
static IPH aclLookupDstIPDone;
+static IPH aclLookupDstIPforASNDone;
static FQDNH aclLookupSrcFQDNDone;
static FQDNH aclLookupDstFQDNDone;
static int aclReadProxyAuth(struct _acl_proxy_auth *p);
}
/* NOTREACHED */
case ACL_SRC_ASN:
- return asnMatchIp(&acl->data, checklist->src_addr);
+ return asnMatchIp(acl->data, checklist->src_addr);
case ACL_DST_ASN:
- assert(0);
+ ia = ipcache_gethostbyname(r->host, IP_LOOKUP_IF_MISS);
+ if (ia) {
+ for (k = 0; k < (int) ia->count; k++) {
+ if (asnMatchIp(acl->data, ia->in_addrs[k]))
+ return 1;
+ }
+ return 0;
+ } else if (checklist->state[ACL_DST_ASN] == ACL_LOOKUP_NONE) {
+ debug(28, 3) ("asnMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
+ acl->name, r->host);
+ checklist->state[ACL_DST_ASN] = ACL_LOOKUP_NEEDED;
+ } else {
+ return asnMatchIp(&acl->data, no_addr);
+ }
return 0;
#if USE_ARP_ACL
case ACL_SRC_ARP:
debug(28, 3) ("aclCheck: checking '%s'\n", A->cfgline);
allow = A->allow;
match = aclMatchAclList(A->acl_list, checklist);
+
if (checklist->state[ACL_DST_IP] == ACL_LOOKUP_NEEDED) {
checklist->state[ACL_DST_IP] = ACL_LOOKUP_PENDING;
ipcache_nbgethostbyname(checklist->request->host,
aclLookupDstIPDone,
checklist);
return;
+ } else if (checklist->state[ACL_DST_ASN] == ACL_LOOKUP_NEEDED) {
+ checklist->state[ACL_DST_ASN] = ACL_LOOKUP_PENDING;
+ ipcache_nbgethostbyname(checklist->request->host,
+ aclLookupDstIPforASNDone,
+ checklist);
+ return;
} else if (checklist->state[ACL_SRC_DOMAIN] == ACL_LOOKUP_NEEDED) {
checklist->state[ACL_SRC_DOMAIN] = ACL_LOOKUP_PENDING;
fqdncache_nbgethostbyaddr(checklist->src_addr,
checklist->state[ACL_DST_IP] = ACL_LOOKUP_DONE;
aclCheck(checklist);
}
+static void
+aclLookupDstIPforASNDone(const ipcache_addrs * ia, void *data)
+{
+ aclCheck_t *checklist = data;
+ checklist->state[ACL_DST_ASN] = ACL_LOOKUP_DONE;
+ aclCheck(checklist);
+}
static void
aclLookupSrcFQDNDone(const char *fqdn, void *data)
char *user_agent,
char *ident)
{
+ int i;
aclCheck_t *checklist = xcalloc(1, sizeof(aclCheck_t));;
cbdataAdd(checklist);
checklist->access_list = A;
checklist->request = requestLink(request);
checklist->src_addr = src_addr;
+ for (i = 0; i < ACL_ENUM_MAX; i++)
+ checklist->state[i] = ACL_LOOKUP_NONE;
if (user_agent)
xstrncpy(checklist->browser, user_agent, BROWSERNAMELEN);
if (ident)
xstrncpy(checklist->ident, ident, ICP_IDENT_SZ);
+ debug(28, 6) ("aclChecklistCreate: %x\n", checklist);
return checklist;
}
checklist->callback = callback;
checklist->callback_data = callback_data;
cbdataLock(callback_data);
+ debug(28, 5) ("aclNBCheck: calling aclCheck with %x\n", checklist);
aclCheck(checklist);
}
{
int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
if (sscanf(asc, "%x:%x:%x:%x:%x:%x", &a1, &a2, &a3, &a4, &a5, &a6) != 6) {
- debug(28, 0)("decode_eth: Invalid ethernet address '%s'\n", asc);
+ debug(28, 0) ("decode_eth: Invalid ethernet address '%s'\n", asc);
return 0; /* This is not valid address */
}
eth[0] = (u_char) a1;
{
LOCAL_ARRAY(char, eth, 256); /* addr1 ---> eth */
struct _acl_arp_data *q = xcalloc(1, sizeof(struct _acl_arp_data));
- debug(28, 5)( "aclParseArpData: %s\n", t);
+ debug(28, 5) ("aclParseArpData: %s\n", t);
if (sscanf(t, "%[0-9a-f:]", eth) != 1) {
- debug(28, 0)( "aclParseArpData: Bad ethernet address: '%s'\n", t);
+ debug(28, 0) ("aclParseArpData: Bad ethernet address: '%s'\n", t);
safe_free(q);
return NULL;
}
if (!decode_eth(eth, q->eth)) {
- debug(28, 0)( "%s line %d: %s\n",
+ debug(28, 0) ("%s line %d: %s\n",
cfg_filename, config_lineno, config_input_line);
- debug(28, 0)( "aclParseArpData: Ignoring invalid ARP acl entry: can't parse '%s'\n", q);
+ debug(28, 0) ("aclParseArpData: Ignoring invalid ARP acl entry: can't parse '%s'\n", q);
safe_free(q);
return NULL;
}
{
splayNode **Top = dataptr;
*Top = splay_splay(ð, *Top, aclArpNetworkCompare);
- debug(28, 3)( "aclMatchArp: '%s' %s\n",
+ debug(28, 3) ("aclMatchArp: '%s' %s\n",
inet_ntoa(c), splayLastResult ? "NOT found" : "found");
return !splayLastResult;
}
{
tree **data = dataptr;
if (tree_srch(data, bintreeArpNetworkCompare, &c)) {
- debug(28, 3)( "aclMatchArp: '%s' found\n", inet_ntoa(c));
+ debug(28, 3) ("aclMatchArp: '%s' found\n", inet_ntoa(c));
return 1;
}
- debug(28, 3)( "aclMatchArp: '%s' NOT found\n", inet_ntoa(c));
+ debug(28, 3) ("aclMatchArp: '%s' NOT found\n", inet_ntoa(c));
return 0;
}
#else
first = data; /* remember first element, will never be moved */
prev = NULL; /* previous element in the list */
while (data) {
- debug(28, 3)( "aclMatchArp: ip = %s\n", inet_ntoa(c));
- debug(28, 3)( "aclMatchArp: arp = %x:%x:%x:%x:%x:%x\n",
+ debug(28, 3) ("aclMatchArp: ip = %s\n", inet_ntoa(c));
+ debug(28, 3) ("aclMatchArp: arp = %x:%x:%x:%x:%x:%x\n",
data->eth[0], data->eth[1], data->eth[2], data->eth[3],
data->eth[4], data->eth[5]);
if (checkARP(c.s_addr, data->eth)) {
- debug(28, 3)( "aclMatchArp: returning 1\n");
+ debug(28, 3) ("aclMatchArp: returning 1\n");
if (prev != NULL) {
/* shift the element just found to the second position
* in the list */
prev = data;
data = data->next;
}
- debug(28, 3)( "aclMatchArp: returning 0\n");
+ debug(28, 3) ("aclMatchArp: returning 0\n");
return 0;
}
#endif /* USE_SPLAY_TREE */
struct sockaddr_inarp *sin;
struct sockaddr_dl *sdl;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) {
- debug(28, 0)( "Can't estimate ARP table size!");
+ debug(28, 0) ("Can't estimate ARP table size!");
return 0;
}
if ((buf = malloc(needed)) == NULL) {
- debug(28, 0)( "Can't allocate temporary ARP table!");
+ debug(28, 0) ("Can't allocate temporary ARP table!");
return 0;
}
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
- debug(28, 0)( "Can't retrieve ARP table!");
+ debug(28, 0) ("Can't retrieve ARP table!");
return 0;
}
lim = buf + needed;
/* END of definitions for radix tree entries */
-static int asndbAddNet(char *, int);
-static void asnLoadStart(int as);
-static PF asnLoadClose;
-static CNCB asnLoadConnected;
-static PF asnLoadRead;
-extern struct radix_node *rn_lookup(void *, void *, void *);
/* Head for ip to asn radix tree */
struct radix_node_head *AS_tree_head;
+#ifdef ASN_DIRECT
/* passed to asnLoadStart when reading configuration options */
struct _asnLoadData {
int as;
off_t offset;
};
+#endif
+
+struct _whoisState {
+ char *buf;
+ StoreEntry *entry;
+ request_t *request;
+ size_t bufsz;
+ off_t offset;
+};
/* structure for as number information. it could be simply
* an intlist but it's coded as a structure for future
intlist *as_number;
int expires;
};
+
+struct _ASState {
+ StoreEntry *entry;
+ StoreEntry *asres_e;
+ request_t *request;
+ int flags;
+ int as_number;
+};
+
+typedef struct _ASState ASState;
typedef struct _as_info as_info;
+typedef struct _whoisState whoisState;
/* entry into the radix tree */
struct _rtentry {
typedef struct _rtentry rtentry;
+static int asndbAddNet(char *, int);
+#ifdef ASN_DIRECT
+static CNCB asnLoadConnected;
+static PF asnLoadRead;
+static void asnLoadStart(int as);
+static PF asnLoadClose;
+#endif
+static void asnCacheStart(int as);
+static PF whoisClose;
+static CNCB whoisConnectDone;
+static PF whoisReadReply;
+static STCB asHandleReply;
+
+static void destroyRadixNodeInfo(as_info *);
+
+/*static int destroyRadixNode(struct radix_node *,caddr_t); */
+extern struct radix_node *rn_lookup(void *, void *, void *);
/* PUBLIC */
if (a->type != ACL_DST_ASN && a->type != ACL_SRC_ASN)
continue;
for (i = a->data; i; i = i->next) {
+#ifdef ASN_DIRECT
asnLoadStart(i->i);
+#else
+ asnCacheStart(i->i);
+#endif
}
}
}
/* PRIVATE */
+static void
+asnCacheStart(int as)
+{
+ LOCAL_ARRAY(char, asres, 4096);
+ const cache_key *k;
+ StoreEntry *asres_e;
+ ASState *asState;
+ request_t *asres_r;
+ snprintf(asres, 4096, "whois://%s/!gAS%d", Config.as_whois_server, as);
+ k = storeKeyPublic(asres, METHOD_GET);
+ asState = xcalloc(1, sizeof(asState));
+ cbdataAdd(asState);
+ asres_r = urlParse(METHOD_GET, asres);
+ asState->as_number = as;
+ asState->request = asres_r;
+
+ if ((asres_e = storeGet(k)) == NULL) {
+ asres_e = storeCreateEntry(asres, asres, 0, METHOD_GET);
+ asState->asres_e = asres_e;
+ storeClientListAdd(asres_e, asState);
+ protoDispatch(0, asres_e, asres_r);
+ } else {
+ storeLockObject(asres_e);
+ asState->asres_e = asres_e;
+ storeClientListAdd(asres_e, asState);
+ }
+ storeClientCopy(asres_e,
+ 0,
+ 0,
+ 4096,
+ get_free_4k_page(),
+ asHandleReply,
+ asState);
+}
+
+static void
+asHandleReply(void *data, char *buf, ssize_t size)
+{
+
+ ASState *asState = data;
+ StoreEntry *asres_e = asState->asres_e;
+ char *s, *t;
+
+ debug(50, 3) ("asHandleReply: Called with size=%d.\n", size);
+ if (asres_e->store_status == STORE_ABORTED) {
+ put_free_4k_page(buf);
+ return;
+ }
+ if (size == 0) {
+ put_free_4k_page(buf);
+ return;
+ } else if (size < 0) {
+ put_free_4k_page(buf);
+ return;
+ }
+ if (asres_e->store_status == STORE_PENDING) {
+ storeClientCopy(asres_e,
+ size,
+ 0,
+ SM_PAGE_SIZE,
+ buf,
+ asHandleReply,
+ asState);
+ return;
+ }
+/* XXX do the processing here */
+ s = buf;
+ while (*s) {
+ for (t = s; *t; t++) {
+ if (isspace(*t))
+ break;
+ }
+ if (*t == '\0') {
+ /* oof, word should continue on next block */
+ break;
+ }
+ *t = '\0';
+ debug(53, 4) ("asHandleReply: AS# %s (%d) '\n", s, asState->as_number);
+ asndbAddNet(s, asState->as_number);
+ s = t + 1;
+ while (*s && isspace(*s))
+ s++;
+ }
+
+ assert(asres_e->mem_obj->reply);
+ storeUnregister(asres_e, asState);
+ storeUnlockObject(asres_e);
+ requestUnlink(asState->request);
+/* XXX this dumps core, don't know why */
+#if 0
+ cbdataFree(asState);
+#endif
+}
+
+
+#ifdef ASN_DIRECT
+
/* connects to whois server to find out networks belonging to
* a certain AS */
int fd;
struct _asnLoadData *p = xcalloc(1, sizeof(struct _asnLoadData));
cbdataAdd(p);
- debug(53, 1) ("asnLoad: AS# %d\n", as);
+ debug(53, 1) ("asnLoadStart: AS# %d\n", as);
p->as = as;
fd = comm_open(SOCK_STREAM, 0, any_addr, 0, COMM_NONBLOCKING, "asnLoad");
if (fd == COMM_ERROR) {
- debug(53, 0) ("asnLoad: failed to open a socket\n");
+ debug(53, 0) ("asnLoadStart: failed to open a socket\n");
return;
}
comm_add_close_handler(fd, asnLoadClose, p);
- commConnectStart(fd, "whois.ra.net", WHOIS_PORT, asnLoadConnected, p);
+ commConnectStart(fd, Config.as_whois_server, WHOIS_PORT, asnLoadConnected, p);
}
asnLoadClose(int fdnotused, void *data)
{
struct _asnLoadData *p = data;
- debug(53, 6) ("asnLoadClose called\n");
+ debug(53, 6) ("asnLoadClose: called\n");
cbdataFree(p);
}
commSetSelect(fd, COMM_SELECT_READ, asnLoadRead, p, Config.Timeout.read);
}
+#endif
/* initialize the radix tree structure */
t = index(as_string, '/');
if (t == NULL) {
- debug(53, 3) ("asndbAddNet: failed, no network.\n");
+ debug(53, 3) ("asndbAddNet: failed, invalid response from whois server.\n");
return 0;
}
*t = '\0';
store_m_int(mask, e->e_mask);
rn = rn_lookup(e->e_addr, e->e_mask, AS_tree_head);
if (rn != 0) {
- debug(53, 3) ("Oops. Found a network with multiple AS numbers!\n");
+ debug(53, 3) ("asndbAddNet: warning: Found a network with multiple AS numbers!\n");
info = ((rtentry *) rn)->e_info;
for (Tail = &(info->as_number); *Tail; Tail = &((*Tail)->next));
q = xcalloc(1, sizeof(intlist));
}
if (rn == 0) {
xfree(e);
- debug(53, 3) ("Could not add entry.\n");
+ debug(53, 3) ("asndbAddNet: Could not add entry.\n");
return 0;
}
e->e_info = info;
- debug(53, 3) ("added successfully.\n");
+ debug(53, 3) ("asndbAddNet: added successfully.\n");
+ return 1;
+}
+
+static int
+destroyRadixNode(struct radix_node *rn, void *w)
+{
+ struct radix_node_head *rnh = (struct radix_node_head *) w;
+
+ if (rn && !(rn->rn_flags & RNF_ROOT)) {
+ rtentry *e = (rtentry *) rn;
+ rn = rn_delete(rn->rn_key, rn->rn_mask, rnh);
+ if (rn == 0)
+ debug(53, 3) ("destroyRadixNode: internal screwup\n");
+ destroyRadixNodeInfo(e->e_info);
+ xfree(rn);
+ }
return 1;
}
+
+void
+asnCleanup()
+{
+ rn_walktree(AS_tree_head, destroyRadixNode, AS_tree_head);
+ destroyRadixNode((struct radix_node *) 0, (void *) AS_tree_head);
+}
+
+static void
+destroyRadixNodeInfo(as_info * e_info)
+{
+ intlist *first, *prev;
+ intlist *data = e_info->as_number;
+ first = data;
+ prev = NULL;
+ while (data) {
+ prev = data;
+ data = data->next;
+ xfree(prev);
+ }
+ xfree(data);
+}
+
+
+void
+whoisStart(request_t * request, StoreEntry * entry)
+{
+ int fd;
+ whoisState *p = xcalloc(1, sizeof(whoisState));
+ p->request = request;
+ p->entry = entry;
+ cbdataAdd(p);
+
+ fd = comm_open(SOCK_STREAM, 0, any_addr, 0, COMM_NONBLOCKING, "whois");
+ if (fd == COMM_ERROR) {
+ debug(53, 0) ("whoisStart: failed to open a socket\n");
+ return;
+ }
+ comm_add_close_handler(fd, whoisClose, p);
+ commConnectStart(fd, request->host, request->port, whoisConnectDone, p);
+}
+
+static void
+whoisConnectDone(int fd, int status, void *data)
+{
+ whoisState *p = data;
+ char buf[128];
+ if (status != COMM_OK) {
+ debug(53, 0) ("whoisConnectDone: connection failed\n");
+ comm_close(fd);
+ return;
+ }
+ snprintf(buf, 128, "%s\r\n", p->request->urlpath + 1);
+ p->offset = 0;
+ p->bufsz = 4096;
+ p->buf = get_free_4k_page();
+ debug(53, 1) ("whoisConnectDone: FD %d, '%s'\n", fd, p->request->urlpath + 1);
+ comm_write(fd, xstrdup(buf), strlen(buf), NULL, p, xfree);
+ commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read);
+}
+
+static void
+whoisReadReply(int fd, void *data)
+{
+ whoisState *p = data;
+ StoreEntry *entry = p->entry;
+ char *s;
+ size_t readsz;
+ int len;
+
+ readsz = p->bufsz - p->offset;
+ readsz--;
+ debug(53, 6) ("whoisReadReply: offset = %d\n", p->offset);
+ s = p->buf + p->offset;
+ len = read(fd, s, readsz);
+ debug(53, 6) ("whoisReadReply: read %d bytes\n", len);
+ if (len <= 0) {
+ debug(53, 5) ("whoisReadReply: got EOF (%s)\n", p->buf);
+ comm_close(fd);
+ return;
+ }
+ storeAppend(entry, s, len);
+ fd_bytes(fd, len, FD_READ);
+ p->offset += len;
+ *(s + len) = '\0';
+ if (*s) {
+ /* expect more */
+ debug(53, 6) ("whoisReadReply: expecting more\n");
+ xstrncpy(p->buf, s, p->bufsz);
+ p->offset = strlen(p->buf);
+ debug(53, 6) ("whoisReadReply: p->buf = '%s'\n", p->buf);
+ } else {
+ p->offset = 0;
+ }
+ commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read);
+}
+
+static void
+whoisClose(int fdnotused, void *data)
+{
+ whoisState *p = data;
+ StoreEntry *entry = p->entry;
+ debug(53, 6) ("whoisClose called\n");
+ storeComplete(entry);
+ /* XXX free up whoisState */
+ cbdataFree(p);
+}
/*
- * $Id: cache_cf.cc,v 1.238 1997/12/03 01:29:56 wessels Exp $
+ * $Id: cache_cf.cc,v 1.239 1997/12/27 18:15:07 kostas Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
return swap.swapDirs == NULL;
}
+static int
+check_null_string(char *s)
+{
+ return s == NULL;
+}
+
static void
parse_cachedir(struct _cacheSwap *swap)
{
{
char *host = NULL;
char *aclname = NULL;
+
if (!(host = strtok(NULL, w_space)))
self_destruct();
while ((aclname = strtok(NULL, list_sep))) {
snmp_agent_conf community readwrite all all
DOC_END
+NAME: as_whois_server
+TYPE: string
+LOC: Config.as_whois_server
+DEFAULT: whois.ra.net
+DEFAULT_IF_NONE: whois.ra.net
+DOC_START
+ WHOIS server to query for AS numbers.
+DOC_END
+
EOF
PROTO_CACHEOBJ,
PROTO_ICP,
PROTO_URN,
+ PROTO_WHOIS,
PROTO_MAX
} protocol_t;
/*
- * $Id: errorpage.cc,v 1.112 1997/12/08 15:14:37 wessels Exp $
+ * $Id: errorpage.cc,v 1.113 1997/12/27 18:15:05 kostas Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
}
}
+void
+errorFree(void)
+{
+ int i;
+ for (i = ERR_NONE + 1; i < ERR_MAX; i++)
+ safe_free(error_text[i]);
+}
+
/*
* Function: errorCon
*
break;
case 'E':
if (err->xerrno)
- snprintf(buf, CVT_BUF_SZ, "(%d) %s", err->xerrno, strerror(err->xerrno));
+ snprintf(buf, CVT_BUF_SZ, "(%d) %s", err->xerrno, strerror(err->xerrno));
else
snprintf(buf, CVT_BUF_SZ, "[No Error]");
break;
/*
- * $Id: main.cc,v 1.197 1997/11/24 18:27:17 wessels Exp $
+ * $Id: main.cc,v 1.198 1997/12/27 18:15:04 kostas Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
clientdbInit();
icmpOpen();
netdbInit();
+ asndbInit();
peerSelectInit();
}
theOutIcpConnection = -1;
}
dnsShutdownServers();
+ asnCleanup();
redirectShutdownServers();
storeDirCloseSwapLogs();
+ errorFree();
parseConfigFile(ConfigFile);
_db_init(Config.Log.log, Config.debugOptions);
+ asnAclInitialize(Config.aclList); /* reload network->AS database */
ipcache_restart(); /* clear stuck entries */
fqdncache_restart(); /* sigh, fqdncache too */
+ errorInitialize(); /* reload error pages */
dnsOpenServers();
redirectOpenServers();
serverConnectionsOpen();
useragentOpenLog();
errorInitialize();
accessLogInit();
- asnAclInitialize(Config.aclList);
#if MALLOC_DBG
malloc_debug(0, malloc_debug_level);
stat_init(&ICPCacheInfo, NULL);
objcacheInit();
storeInit();
-
+ asnAclInitialize(Config.aclList);
if (Config.effectiveUser) {
/* we were probably started as root, so cd to a swap
* directory in case we dump core */
-- definitions included for standalone agent/managers
--
-mgmt OBJECT IDENTIFIER ::= { iso org(3) dod(6) internet(1) 2 }
-mib OBJECT IDENTIFIER ::= { mgmt 1 }
-directory OBJECT IDENTIFIER ::= { internet 1 }
-experimental OBJECT IDENTIFIER ::= { internet 3 }
-private OBJECT IDENTIFIER ::= { internet 4 }
-enterprises OBJECT IDENTIFIER ::= { private 1 }
-nsfnet OBJECT IDENTIFIER ::= { experimental 25 }
-squid OBJECT IDENTIFIER ::= { nsfnet 17 }
+--mgmt OBJECT IDENTIFIER ::= { iso org(3) dod(6) internet(1) 2 }
+--mib OBJECT IDENTIFIER ::= { mgmt 1 }
+--directory OBJECT IDENTIFIER ::= { internet 1 }
+--experimental OBJECT IDENTIFIER ::= { internet 3 }
+--private OBJECT IDENTIFIER ::= { internet 4 }
+--enterprises OBJECT IDENTIFIER ::= { private 1 }
+--nsfnet OBJECT IDENTIFIER ::= { experimental 25 }
+squid OBJECT IDENTIFIER ::= { iso org(3) dod(6) internet(1) experimental(3) nsfnet(25) 17 }
+-- squid OBJECT IDENTIFIER ::= { nsfnet 17 }
+
--
-- Major MIB groups
-#if SQUID_SNMP
+#ifdef SQUID_SNMP
/*
* Simple Network Management Protocol (RFC 1067).
*
create_toobig(out_auth, *out_length, reqid, pi);
break;
} /* else FALLTHRU */
-#endif
+#lendif
case SNMP_ERR_NOACCESS:
case SNMP_ERR_WRONGTYPE:
case SNMP_ERR_WRONGLENGTH:
return 1;
}
-#ifdef KINETICS
-struct pbuf *
-definitelyGetBuf()
-{
- struct pbuf *p;
-
- K_PGET(PT_DATA, p);
- while (p == 0) {
-#ifdef notdef
- if (pq->pq_head != NULL) {
- K_PDEQ(SPLIMP, pq, p);
- if (p)
- K_PFREE(p);
- } else if (sendq->pq_head != NULL) {
- K_PDEQ(SPLIMP, sendq, p);
- if (p)
- K_PFREE(p);
- }
-#endif
- K_PGET(PT_DATA, p);
- }
- return p;
-}
-#endif
-
static int
check_auth(session, sn_data, length, pp, plen, ueret)
struct snmp_session *session;
*index = 0;
return SNMP_ERR_NOERROR;
}
-
#endif
+
struct _acl_ip_data {
struct in_addr addr1; /* if addr2 non-zero then its a range */
struct in_addr addr2;
#if USE_ARP_ACL
struct _acl_arp_data {
- unsigned char eth[6];
+ unsigned char eth[6];
#ifndef USE_SPLAY_TREE
- struct _acl_arp_data *next;
+ struct _acl_arp_data *next;
#endif
};
+
#endif
#if SQUID_SNMP
communityEntry *communities;
} Snmp;
#endif
+ char *as_whois_server;
struct {
char *log;
char *access;
struct _acl_access *miss;
struct _acl_access *NeverDirect;
struct _acl_access *AlwaysDirect;
+ struct _acl_access *ASlists;
} accessList;
struct _acl_deny_info_list *denyInfoList;
struct {
/*
- * $Id: tools.cc,v 1.134 1997/12/06 05:17:03 wessels Exp $
+ * $Id: tools.cc,v 1.135 1997/12/27 18:15:00 kostas Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
netdbFreeMemory();
ipcacheFreeMemory();
fqdncacheFreeMemory();
+ asndbFreeMemory();
#endif
file_close(0);
file_close(1);
/*
- * $Id: url.cc,v 1.71 1997/12/06 19:25:42 wessels Exp $
+ * $Id: url.cc,v 1.72 1997/12/27 18:14:59 kostas Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
"cache_object",
"icp",
"urn",
+ "whois",
"TOTAL"
};
static int url_acceptable[256];
static const char *const hex = "0123456789abcdef";
-static request_t * urnParse(method_t method, char *urn);
+static request_t *urnParse(method_t method, char *urn);
/* convert %xx in url string to a character
* Allocate a new string and return a pointer to converted string */
url_acceptable[i] = 0;
for (; *good; good++)
url_acceptable[(unsigned int) *good] = 1;
- assert(sizeof(ProtocolStr) == (PROTO_MAX + 1) * sizeof(char *));
+ assert(sizeof(ProtocolStr) == (PROTO_MAX + 1) * sizeof(char *));
}
return PROTO_CACHEOBJ;
if (strncasecmp(s, "urn", 3) == 0)
return PROTO_URN;
+ if (strncasecmp(s, "whois", 5) == 0)
+ return PROTO_WHOIS;
return PROTO_NONE;
}
return 210;
case PROTO_CACHEOBJ:
return CACHE_HTTP_PORT;
+ case PROTO_WHOIS:
+ return 43;
default:
return 0;
}
urnParse(method_t method, char *urn)
{
request_t *request = NULL;
- debug(50,5)("urnParse: %s\n", urn);
+ debug(50, 5) ("urnParse: %s\n", urn);
request = get_free_request_t();
request->method = method;
request->protocol = PROTO_URN;
buf = urlbuf;
if (request->protocol == PROTO_URN) {
snprintf(buf, MAX_URL, "urn:%s", request->urlpath);
- } else switch (request->method) {
- case METHOD_CONNECT:
- snprintf(buf, MAX_URL, "%s:%d", request->host, request->port);
- break;
- default:
- portbuf[0] = '\0';
- if (request->port != urlDefaultPort(request->protocol))
- snprintf(portbuf, 32, ":%d", request->port);
- snprintf(buf, MAX_URL, "%s://%s%s%s%s%s",
- ProtocolStr[request->protocol],
- request->login,
- *request->login ? "@" : null_string,
- request->host,
- portbuf,
- request->urlpath);
- break;
- }
+ } else
+ switch (request->method) {
+ case METHOD_CONNECT:
+ snprintf(buf, MAX_URL, "%s:%d", request->host, request->port);
+ break;
+ default:
+ portbuf[0] = '\0';
+ if (request->port != urlDefaultPort(request->protocol))
+ snprintf(portbuf, 32, ":%d", request->port);
+ snprintf(buf, MAX_URL, "%s://%s%s%s%s%s",
+ ProtocolStr[request->protocol],
+ request->login,
+ *request->login ? "@" : null_string,
+ request->host,
+ portbuf,
+ request->urlpath);
+ break;
+ }
return buf;
}
char *t;
if (request->protocol == PROTO_URN) {
snprintf(buf, MAX_URL, "urn:%s", request->urlpath);
- } else switch (request->method) {
- case METHOD_CONNECT:
- snprintf(buf, MAX_URL, "%s:%d", request->host, request->port);
- break;
- default:
- portbuf[0] = '\0';
- if (request->port != urlDefaultPort(request->protocol))
- snprintf(portbuf, 32, ":%d", request->port);
- loginbuf[0] = '\0';
- if (strlen(request->login) > 0) {
- strcpy(loginbuf, request->login);
- if ((t = strchr(loginbuf, ':')))
+ } else
+ switch (request->method) {
+ case METHOD_CONNECT:
+ snprintf(buf, MAX_URL, "%s:%d", request->host, request->port);
+ break;
+ default:
+ portbuf[0] = '\0';
+ if (request->port != urlDefaultPort(request->protocol))
+ snprintf(portbuf, 32, ":%d", request->port);
+ loginbuf[0] = '\0';
+ if (strlen(request->login) > 0) {
+ strcpy(loginbuf, request->login);
+ if ((t = strchr(loginbuf, ':')))
+ *t = '\0';
+ strcat(loginbuf, "@");
+ }
+ snprintf(buf, MAX_URL, "%s://%s%s%s%s",
+ ProtocolStr[request->protocol],
+ loginbuf,
+ request->host,
+ portbuf,
+ request->urlpath);
+ if ((t = strchr(buf, '?')))
*t = '\0';
- strcat(loginbuf, "@");
+ break;
}
- snprintf(buf, MAX_URL, "%s://%s%s%s%s",
- ProtocolStr[request->protocol],
- loginbuf,
- request->host,
- portbuf,
- request->urlpath);
- if ((t = strchr(buf, '?')))
- *t = '\0';
- break;
- }
return buf;
}