better handling of ' F'

pull/14/head
Tom Early 6 years ago
parent 5399dce371
commit 87a3f778dc

@ -54,7 +54,7 @@
#include "QnetLink.h" #include "QnetLink.h"
#include "Utilities.h" #include "Utilities.h"
#define LINK_VERSION "QnetLink-422" #define LINK_VERSION "QnetLink-509"
#ifndef BIN_DIR #ifndef BIN_DIR
#define BIN_DIR "/usr/local/bin" #define BIN_DIR "/usr/local/bin"
#endif #endif
@ -889,6 +889,7 @@ void CQnetLink::Process()
} }
while (keep_running) { while (keep_running) {
static bool loadG = false;
time(&tnow); time(&tnow);
if (keep_running && (tnow - hb) > 0) { if (keep_running && (tnow - hb) > 0) {
/* send heartbeat to connected donglers */ /* send heartbeat to connected donglers */
@ -2733,12 +2734,9 @@ void CQnetLink::Process()
} }
else if (0==memcmp(dsvt.hdr.urcall, " ", 6) && dsvt.hdr.urcall[7]=='X') { // execute a script else if (0==memcmp(dsvt.hdr.urcall, " ", 6) && dsvt.hdr.urcall[7]=='X') { // execute a script
if (dsvt.hdr.urcall[6] != ' ') { // there has to be a char here if (dsvt.hdr.urcall[6] != ' ') { // there has to be a char here
bool user_ok = true;
if (admin.size()>0 && admin.end()==admin.find(call)) { // only admins (if defined) can execute scripts if (admin.size()>0 && admin.end()==admin.find(call)) { // only admins (if defined) can execute scripts
printf("%s not found in the link_admin list!\n", call); printf("%s not found in admin list, ignoring script %c request\n", call, dsvt.hdr.urcall[6]);
user_ok = false; } else {
}
if (user_ok) {
memset(system_cmd, '\0', sizeof(system_cmd)); memset(system_cmd, '\0', sizeof(system_cmd));
snprintf(system_cmd, FILENAME_MAX, "%s/exec_%c.sh %s %c &", BIN_DIR, dsvt.hdr.urcall[6], call, dsvt.hdr.rpt1[7]); snprintf(system_cmd, FILENAME_MAX, "%s/exec_%c.sh %s %c &", BIN_DIR, dsvt.hdr.urcall[6], call, dsvt.hdr.rpt1[7]);
printf("Executing %s\n", system_cmd); printf("Executing %s\n", system_cmd);
@ -2746,19 +2744,26 @@ void CQnetLink::Process()
} }
} }
} }
else if (0==memcmp(dsvt.hdr.urcall, " ", 6) && dsvt.hdr.urcall[6]=='D' && admin.find(call)!=admin.end()) { // only ADMIN can block dongle users else if (0==memcmp(dsvt.hdr.urcall, " ", 6) && dsvt.hdr.urcall[6]=='D') { // only ADMIN can block dongle users
if (admin.size()>0 && admin.end()==admin.find(call)) {
printf("%s not found in admin list, ignoring dongle gate request\n", call);
} else {
if (dsvt.hdr.urcall[7] == '1') { if (dsvt.hdr.urcall[7] == '1') {
max_dongles = saved_max_dongles; max_dongles = saved_max_dongles;
printf("Dongle connections are now allowed\n"); printf("Dongle connections are now allowed by %s\n", call);
} else if (dsvt.hdr.urcall[7] == '0') { } else if (dsvt.hdr.urcall[7] == '0') {
inbound_list.clear(); inbound_list.clear();
max_dongles = 0; max_dongles = 0;
printf("Dongle connections are now disallowed\n"); printf("Dongle connections are now disallowed by %s\n", call);
}
} }
} }
else if (0==memcmp(dsvt.hdr.urcall, " F", CALL_SIZE) && admin.find(call)!=admin.end()) { // only ADMIN can reload gwys.txt else if (0==memcmp(dsvt.hdr.urcall, " F", CALL_SIZE) && admin.find(call)!=admin.end()) { // only ADMIN can reload gwys.txt
qnDB.ClearGW(); if (admin.size()>0 && admin.end()==admin.find(call)) {
LoadGateways(gwys); printf("%s not found in admin list, ignoring gwys read request\n", call);
} else {
loadG = true;
}
} }
} }
@ -3020,6 +3025,11 @@ void CQnetLink::Process()
notify_msg[i][0] = '\0'; notify_msg[i][0] = '\0';
} }
} }
if (loadG && 0x0U==(tracing[0].streamid | tracing[1].streamid | tracing[2].streamid)) {
qnDB.ClearGW();
LoadGateways(gwys);
loadG = false;
}
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.