projects
/
fms.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
version 0.3.2
[fms.git]
/
src
/
ipaddressacl.cpp
diff --git
a/src/ipaddressacl.cpp
b/src/ipaddressacl.cpp
index
0516c1d
..
64ca979
100644
(file)
--- a/
src/ipaddressacl.cpp
+++ b/
src/ipaddressacl.cpp
@@
-64,9
+64,11
@@
const bool IPAddressACL::Add(const std::string &aclentry)
const std::string IPAddressACL::CreateMask(const int maskbits)
\r
{
\r
int bitsleft=maskbits;
\r
const std::string IPAddressACL::CreateMask(const int maskbits)
\r
{
\r
int bitsleft=maskbits;
\r
- int parts[4]={255,255,255,255};
\r
+ //int parts[4]={255,255,255,255};
\r
+ int parts[4]={0,0,0,0};
\r
std::ostringstream ipstr;
\r
\r
std::ostringstream ipstr;
\r
\r
+ /*
\r
for(int i=3; i>=0; i--)
\r
{
\r
for(int b=0; b<8 && bitsleft>0; b++)
\r
for(int i=3; i>=0; i--)
\r
{
\r
for(int b=0; b<8 && bitsleft>0; b++)
\r
@@
-75,6
+77,15
@@
const std::string IPAddressACL::CreateMask(const int maskbits)
bitsleft--;
\r
}
\r
}
\r
bitsleft--;
\r
}
\r
}
\r
+ */
\r
+ for(int i=0; i<4; i++)
\r
+ {
\r
+ for(int b=7; b>=0 && bitsleft>0; b--)
\r
+ {
\r
+ parts[i]+=pow((float)2,b);
\r
+ bitsleft--;
\r
+ }
\r
+ }
\r
\r
ipstr << parts[0] << "." << parts[1] << "." << parts[2] << "." << parts[3];
\r
\r
\r
ipstr << parts[0] << "." << parts[1] << "." << parts[2] << "." << parts[3];
\r
\r
@@
-86,7
+97,7
@@
const bool IPAddressACL::IsAllowed(const Poco::Net::IPAddress &addr)
bool found=false;
\r
bool rval=m_allowbydefault;
\r
\r
bool found=false;
\r
bool rval=m_allowbydefault;
\r
\r
- for(std::vector<entry>::
iterator i=m_entries.begin(); i!=m_entries.
end() && found==false; i++)
\r
+ for(std::vector<entry>::
reverse_iterator i=m_entries.rbegin(); i!=m_entries.r
end() && found==false; i++)
\r
{
\r
Poco::Net::IPAddress ip1=addr;
\r
Poco::Net::IPAddress ip2=(*i).m_addr;
\r
{
\r
Poco::Net::IPAddress ip1=addr;
\r
Poco::Net::IPAddress ip2=(*i).m_addr;
\r