/*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
}
static void
-snmpPortOpened(const Comm::ConnectionPointer &conn, int errNo)
+snmpPortOpened(const Comm::ConnectionPointer &conn, int)
{
if (!Comm::IsConnOpen(conn))
fatalf("Cannot open SNMP %s Port",(conn->fd == snmpIncomingConn->fd?"receiving":"sending"));
* Accept the UDP packet
*/
void
-snmpHandleUdp(int sock, void *not_used)
+snmpHandleUdp(int sock, void *)
{
static char buf[SNMP_REQUEST_SIZE];
Ip::Address from;
xfree(snmp_rq->outbuf);
xfree(snmp_rq);
} else {
- debugs(49, DBG_IMPORTANT, "snmpHandleUdp: FD " << sock << " recvfrom: " << xstrerror());
+ int xerrno = errno;
+ debugs(49, DBG_IMPORTANT, "snmpHandleUdp: FD " << sock << " recvfrom: " << xstrerr(xerrno));
}
}
u_char *Community;
u_char *buf = rq->buf;
int len = rq->len;
- allow_t allow = ACCESS_DENIED;
if (!Config.accessList.snmp) {
debugs(49, DBG_IMPORTANT, "WARNING: snmp_access not configured. agent query DENIED from : " << rq->from);
ACLFilledChecklist checklist(Config.accessList.snmp, NULL, NULL);
checklist.src_addr = rq->from;
checklist.snmp_community = (char *) Community;
- allow = checklist.fastCheck();
- if (allow == ACCESS_ALLOWED && (snmp_coexist_V2toV1(PDU))) {
+ if (checklist.fastCheck().allowed() && (snmp_coexist_V2toV1(PDU))) {
rq->community = Community;
rq->PDU = PDU;
debugs(49, 5, "snmpAgentParse: reqid=[" << PDU->reqid << "]");
int no = name[current->len] ;
int i;
// Note: This works because the Config.peers keeps its index according to its position.
- for ( i=0 ; peers && (i < no) ; peers = peers->next , ++i ) ;
+ for ( i=0 ; peers && (i < no) ; peers = peers->next, ++i ) ;
if (peers) {
debugs(49, 6, "snmp peer_Inst: Encode peer #" << i);
addr = i6addr;
}
-/* SNMP checklists */
-#include "acl/Strategised.h"
-#include "acl/Strategy.h"
-#include "acl/StringData.h"
-
-class ACLSNMPCommunityStrategy : public ACLStrategy<char const *>
-{
-
-public:
- virtual int match (ACLData<MatchType> * &, ACLFilledChecklist *, ACLFlags &);
- static ACLSNMPCommunityStrategy *Instance();
- /* Not implemented to prevent copies of the instance. */
- /* Not private to prevent brain dead g++ warnings about
- * private constructors with no friends */
- ACLSNMPCommunityStrategy(ACLSNMPCommunityStrategy const &);
-
-private:
- static ACLSNMPCommunityStrategy Instance_;
- ACLSNMPCommunityStrategy() {}
-
- ACLSNMPCommunityStrategy&operator=(ACLSNMPCommunityStrategy const &);
-};
-
-class ACLSNMPCommunity
-{
-
-private:
- static ACL::Prototype RegistryProtoype;
- static ACLStrategised<char const *> RegistryEntry_;
-};
-
-ACL::Prototype ACLSNMPCommunity::RegistryProtoype(&ACLSNMPCommunity::RegistryEntry_, "snmp_community");
-ACLStrategised<char const *> ACLSNMPCommunity::RegistryEntry_(new ACLStringData, ACLSNMPCommunityStrategy::Instance(), "snmp_community");
-
int
-ACLSNMPCommunityStrategy::match (ACLData<MatchType> * &data, ACLFilledChecklist *checklist, ACLFlags &)
+ACLSNMPCommunityStrategy::match (ACLData<MatchType> * &data, ACLFilledChecklist *checklist)
{
return data->match (checklist->snmp_community);
}
-ACLSNMPCommunityStrategy *
-ACLSNMPCommunityStrategy::Instance()
-{
- return &Instance_;
-}
-
-ACLSNMPCommunityStrategy ACLSNMPCommunityStrategy::Instance_;