Merge branch 'feature/AddLists_#22' into develop Closes #22

pull/32/head
Geoffrey Merck 4 years ago
commit 5a2a38bedb

10
.vscode/tasks.json vendored

@ -26,7 +26,10 @@
"USE_GPSD=1", "USE_GPSD=1",
"DStarGateway/dstargateway" "DStarGateway/dstargateway"
], ],
"group": "build", "group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [] "problemMatcher": []
}, },
{ {
@ -78,10 +81,7 @@
"USE_GPSD=1", "USE_GPSD=1",
"DGWVoiceTransmit/dgwvoicetransmit" "DGWVoiceTransmit/dgwvoicetransmit"
], ],
"group": { "group": "build",
"kind": "build",
"isDefault": true
},
"problemMatcher": [] "problemMatcher": []
}, },
{ {

@ -212,6 +212,34 @@ bool CDStarGatewayApp::createThread()
} }
} }
// Setup access control
TAccessControl accessControl;
m_config->getAccessControl(accessControl);
CCallsignList * whiteList = new CCallsignList(accessControl.whiteList);
if(whiteList->load() && whiteList->getCount() > 0U) {
m_thread->setWhiteList(whiteList);
}
else {
delete whiteList;
}
CCallsignList * blackList = new CCallsignList(accessControl.blackList);
if(blackList->load() && blackList->getCount() > 0U) {
m_thread->setBlackList(blackList);
}
else {
delete blackList;
}
CCallsignList * restrictList = new CCallsignList(accessControl.restrictList);
if(restrictList->load() && restrictList->getCount() > 0U) {
m_thread->setRestrictList(restrictList);
}
else {
delete restrictList;
}
// Setup the repeaters // Setup the repeaters
bool ddEnabled = false; bool ddEnabled = false;
bool atLeastOneRepeater = false; bool atLeastOneRepeater = false;

@ -56,6 +56,7 @@ bool CDStarGatewayConfig::load()
ret = loadGPSD(cfg) && ret; ret = loadGPSD(cfg) && ret;
#endif #endif
ret = loadDaemon(cfg) && ret; ret = loadDaemon(cfg) && ret;
ret = loadAccessControl(cfg) && ret;
} }
if(ret) { if(ret) {
@ -350,6 +351,15 @@ bool CDStarGatewayConfig::loadGPSD(const CConfig & cfg)
} }
#endif #endif
bool CDStarGatewayConfig::loadAccessControl(const CConfig & cfg)
{
bool ret = cfg.getValue("AccessControl", "whiteList", m_accessControl.whiteList, 0U, 2048U, "");
ret = cfg.getValue("AccessControl", "blackList", m_accessControl.blackList, 0U, 2048U, "") && ret;
ret = cfg.getValue("AccessControl", "restrictList", m_accessControl.restrictList, 0U, 2048U, "") && ret;
return ret;
}
bool CDStarGatewayConfig::open(CConfig & cfg) bool CDStarGatewayConfig::open(CConfig & cfg)
{ {
try { try {
@ -450,4 +460,9 @@ void CDStarGatewayConfig::getGPSD(TGPSD & gpsd) const
void CDStarGatewayConfig::getDaemon(TDaemon & gen) const void CDStarGatewayConfig::getDaemon(TDaemon & gen) const
{ {
gen = m_daemon; gen = m_daemon;
}
void CDStarGatewayConfig::getAccessControl(TAccessControl & accessControl) const
{
accessControl = m_accessControl;
} }

@ -134,6 +134,12 @@ typedef struct {
} TGPSD; } TGPSD;
#endif #endif
typedef struct {
std::string whiteList;
std::string blackList;
std::string restrictList;
} TAccessControl;
class CDStarGatewayConfig { class CDStarGatewayConfig {
public: public:
CDStarGatewayConfig(const std::string &pathname); CDStarGatewayConfig(const std::string &pathname);
@ -157,6 +163,7 @@ public:
void getGPSD(TGPSD & gpsd) const; void getGPSD(TGPSD & gpsd) const;
#endif #endif
void getDaemon(TDaemon & gen) const; void getDaemon(TDaemon & gen) const;
void getAccessControl(TAccessControl & accessControl) const;
private: private:
bool open(CConfig & cfg); bool open(CConfig & cfg);
@ -175,6 +182,7 @@ private:
bool loadGPSD(const CConfig & cfg); bool loadGPSD(const CConfig & cfg);
#endif #endif
bool loadDaemon(const CConfig & cfg); bool loadDaemon(const CConfig & cfg);
bool loadAccessControl(const CConfig & cfg);
std::string m_fileName; std::string m_fileName;
TGateway m_gateway; TGateway m_gateway;
@ -190,6 +198,7 @@ private:
TGPSD m_gpsd; TGPSD m_gpsd;
#endif #endif
TDaemon m_daemon; TDaemon m_daemon;
TAccessControl m_accessControl;
std::vector<TRepeater *> m_repeaters; std::vector<TRepeater *> m_repeaters;
std::vector<TircDDB *> m_ircDDB; std::vector<TircDDB *> m_ircDDB;

@ -177,7 +177,13 @@ enabled=false
port=4242 port=4242
password=CHANGE_ME # If password is left blank, remote will be disabled regardless of the enabled field password=CHANGE_ME # If password is left blank, remote will be disabled regardless of the enabled field
# Provided install routines install the program as a systemd unit. SystemD does not recommand "old-school" forking daemons nor does systemd # Should only be used with respect to your local regulation! Many countries prohibit setting up private repeaters !
[AccessControl]
whiteList= # Only affects network
blackList= # Only affects network
restrictList= # Only affects RF, call signs present in this list are now allowed to change reflector or unlink the repeater
# The Provided install routines install the program as a systemd unit. SystemD does not recommand "old-school" forking daemons nor does systemd
# require a pid file. Moreover systemd handles the user under which the program is started. This is provided as convenience for people who might # require a pid file. Moreover systemd handles the user under which the program is started. This is provided as convenience for people who might
# run the program using sysv or any other old school init system. # run the program using sysv or any other old school init system.
[Daemon] [Daemon]

@ -79,8 +79,12 @@ VersionInfo/GitVersion.h: FORCE
clean: clean:
$(MAKE) -C Tests clean $(MAKE) -C Tests clean
$(MAKE) -C APRS clean $(MAKE) -C APRS clean
$(MAKE) -C Common clean
$(MAKE) -C BaseCommon clean $(MAKE) -C BaseCommon clean
$(MAKE) -C Common clean
$(MAKE) -C DGWRemoteControl clean
$(MAKE) -C DGWTextTransmit clean
$(MAKE) -C DGWTimeServer clean
$(MAKE) -C DGWVoiceTransmit clean
$(MAKE) -C DStarBase clean $(MAKE) -C DStarBase clean
$(MAKE) -C DStarGateway clean $(MAKE) -C DStarGateway clean
$(MAKE) -C IRCDDB clean $(MAKE) -C IRCDDB clean

@ -135,6 +135,8 @@ the testing framwework used is Google Test.
# 5. Version History # 5. Version History
## 5.1. Version 0.6 ## 5.1. Version 0.6
- [**Improvement**] Add call sign lists ([#22](https://github.com/F4FXL/DStarGateway/issues/22))
- [**Improvement**] Add a way to override Slow Data in VoiceTransmit ([#23](https://github.com/F4FXL/DStarGateway/issues/23))
- [**Improvement**] Add time server - [**Improvement**] Add time server
- [**Improvement**] Gracefully exit on SIGINT and SIGTERM ([#21](https://github.com/F4FXL/DStarGateway/issues/21)). DStarGateway can also be run as a "forking" daemon. This might be required for distros still using sysv. Systemd can live without it. - [**Improvement**] Gracefully exit on SIGINT and SIGTERM ([#21](https://github.com/F4FXL/DStarGateway/issues/21)). DStarGateway can also be run as a "forking" daemon. This might be required for distros still using sysv. Systemd can live without it.
- [**Improvement**] Add text transmit utility dgwtexttransmit ([#18](https://github.com/F4FXL/DStarGateway/issues/18)) - [**Improvement**] Add text transmit utility dgwtexttransmit ([#18](https://github.com/F4FXL/DStarGateway/issues/18))

Loading…
Cancel
Save

Powered by TurnKey Linux.