mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Change access control to call validateAccess
This commit is contained in:
151
DMRSlot.cpp
151
DMRSlot.cpp
@@ -140,24 +140,9 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int id = lc->getSrcId();
|
unsigned int id = lc->getSrcId();
|
||||||
if (!DMRAccessControl::validateSrcId(id)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", m_slotNo, id);
|
|
||||||
delete lc;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = lc->getDstId();
|
unsigned int did = lc->getDstId();
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
delete lc;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,false)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -273,21 +258,8 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
unsigned int srcId = dataHeader.getSrcId();
|
unsigned int srcId = dataHeader.getSrcId();
|
||||||
unsigned int dstId = dataHeader.getDstId();
|
unsigned int dstId = dataHeader.getDstId();
|
||||||
|
|
||||||
if (!DMRAccessControl::validateSrcId(srcId)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
if (!DMRAccessControl::validateAccess(srcId,dstId,m_slotNo,false)) {
|
||||||
// - G7RZU
|
|
||||||
if (DMRAccessControl::DstIdBlacklist(dstId, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
|
||||||
if (!DMRAccessControl::DstIdWhitelist(dstId, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,21 +316,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
unsigned int srcId = csbk.getSrcId();
|
unsigned int srcId = csbk.getSrcId();
|
||||||
unsigned int dstId = csbk.getDstId();
|
unsigned int dstId = csbk.getDstId();
|
||||||
|
|
||||||
if (!DMRAccessControl::validateSrcId(srcId)) {
|
if (!DMRAccessControl::validateAccess(srcId,dstId,m_slotNo,false)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
if (DMRAccessControl::DstIdBlacklist(dstId, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
|
||||||
if (!DMRAccessControl::DstIdWhitelist(dstId, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,25 +468,11 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
|
|
||||||
CDMRLC* lc = m_rfEmbeddedLC.addData(data + 2U, emb.getLCSS());
|
CDMRLC* lc = m_rfEmbeddedLC.addData(data + 2U, emb.getLCSS());
|
||||||
if (lc != NULL) {
|
if (lc != NULL) {
|
||||||
|
|
||||||
unsigned int id = lc->getSrcId();
|
unsigned int id = lc->getSrcId();
|
||||||
if (!DMRAccessControl::validateSrcId(id)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, id);
|
|
||||||
delete lc;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = lc->getDstId();
|
unsigned int did = lc->getDstId();
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
delete lc;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,false)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -805,17 +749,10 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
unsigned int id = m_netLC->getSrcId();
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,true)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,17 +814,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
if (m_netState != RS_NET_AUDIO)
|
if (m_netState != RS_NET_AUDIO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
unsigned int did = m_netLC->getDstId();
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
unsigned int id = m_netLC->getSrcId();
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,19 +849,10 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
if (m_netState != RS_NET_AUDIO)
|
if (m_netState != RS_NET_AUDIO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
unsigned int id = m_netLC->getSrcId();
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
writeEndNet();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,true)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
writeEndNet();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,19 +907,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
unsigned int srcId = dataHeader.getSrcId();
|
unsigned int srcId = dataHeader.getSrcId();
|
||||||
unsigned int dstId = dataHeader.getDstId();
|
unsigned int dstId = dataHeader.getDstId();
|
||||||
|
|
||||||
m_netLC = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
if (!DMRAccessControl::validateAccess(srcId,dstId,m_slotNo,true)) {
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = dataHeader.getDstId();
|
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,17 +951,10 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
if (m_netState == RS_NET_IDLE) {
|
if (m_netState == RS_NET_IDLE) {
|
||||||
m_netLC = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId());
|
m_netLC = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId());
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = dmrData.getDstId();
|
unsigned int did = dmrData.getDstId();
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
unsigned int id = dmrData.getSrcId();
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,true)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,17 +1051,10 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
if (m_netState != RS_NET_AUDIO)
|
if (m_netState != RS_NET_AUDIO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
unsigned int id = m_netLC->getSrcId();
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(id,did,m_slotNo,true)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1219,17 +1115,8 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
unsigned int srcId = csbk.getSrcId();
|
unsigned int srcId = csbk.getSrcId();
|
||||||
unsigned int dstId = csbk.getDstId();
|
unsigned int dstId = csbk.getDstId();
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
// - G7RZU
|
|
||||||
unsigned int did = dstId;
|
|
||||||
if (DMRAccessControl::DstIdBlacklist(did, m_slotNo)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted)", m_slotNo, did);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
if (!DMRAccessControl::validateAccess(srcId,dstId,m_slotNo,true)) {
|
||||||
if (!DMRAccessControl::DstIdWhitelist(did, m_slotNo, true)) {
|
|
||||||
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist)", m_slotNo, did);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user