summaryrefslogtreecommitdiff
path: root/node/CertificateOfOwnership.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-23 12:34:17 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-23 12:34:17 -0800
commit72653e54f951b2a47686d420186f59f533542940 (patch)
treed404273e2a6a5cf5f29a403a0e9ebaeb4e18137e /node/CertificateOfOwnership.cpp
parent10185e92faa77a4b032a27a7c01b4186727b91b9 (diff)
downloadinfinitytier-72653e54f951b2a47686d420186f59f533542940.tar.gz
infinitytier-72653e54f951b2a47686d420186f59f533542940.zip
Finish wiring up ipauth and macauth to Network filter.
Diffstat (limited to 'node/CertificateOfOwnership.cpp')
-rw-r--r--node/CertificateOfOwnership.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/node/CertificateOfOwnership.cpp b/node/CertificateOfOwnership.cpp
index 8305c489..6fc59ad1 100644
--- a/node/CertificateOfOwnership.cpp
+++ b/node/CertificateOfOwnership.cpp
@@ -43,4 +43,21 @@ int CertificateOfOwnership::verify(const RuntimeEnvironment *RR) const
}
}
+bool CertificateOfOwnership::_owns(const CertificateOfOwnership::Thing &t,const void *v,unsigned int l) const
+{
+ for(unsigned int i=0,j=_thingCount;i<j;++i) {
+ if (_thingTypes[i] == (uint8_t)t) {
+ unsigned int k = 0;
+ while (k < l) {
+ if (reinterpret_cast<const uint8_t *>(v)[k] != _thingValues[i][k])
+ break;
+ ++k;
+ }
+ if (k == l)
+ return true;
+ }
+ }
+ return false;
+}
+
} // namespace ZeroTier