Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, for more info) to build successfully.

Commit f2c57eca authored by rswindell's avatar rswindell

Fix bug with AreaFix "ECHOSTATS" command: if the echotag specified was not

found, it would be added to the list of echoes tracked in echostats.ini.
Ideally, a negative-response message would be sent to requester in this case,
but we're not doing that currently.
parent 1c659577
......@@ -494,12 +494,14 @@ bool write_echostats(const char* fname, echostat_t* echostat, size_t echo_count)
return true;
echostat_t* get_echostat(const char* tag)
echostat_t* get_echostat(const char* tag, bool create)
for(unsigned int i = 0; i < echostat_count; i++) {
if(stricmp(echostat[i].tag, tag) == 0)
return &echostat[i];
return NULL;
echostat_t* new_echostat = realloc(echostat, sizeof(echostat_t) * (echostat_count + 1));
if(new_echostat == NULL)
return NULL;
......@@ -2129,7 +2131,7 @@ bool areafix_command(char* instr, nodecfg_t* nodecfg, const char* to)
char* p = instr;
echostat_t* stat = get_echostat(p);
echostat_t* stat = get_echostat(p, /* create: */false);
if(stat == NULL) {
lprintf(LOG_INFO, "AreaFix (for %s) EchoStats request for unknown echo: %s", faddrtoa(&addr), p);
} else {
......@@ -4665,7 +4667,7 @@ void export_echomail(const char* sub_code, const nodecfg_t* nodecfg, bool rescan
echostat_t* stat = get_echostat(tag);
echostat_t* stat = get_echostat(tag, /* create: */true);
if(stat == NULL) {
lprintf(LOG_CRIT, "Failed to allocated memory for echostats!");
......@@ -5711,7 +5713,7 @@ void import_packets(const char* inbound, nodecfg_t* inbox, bool secure)
truncstr(areatag, " \t\r\n");
printf("%21s: ", areatag); /* Show areatag/echotag: */
echostat_t* stat = get_echostat(areatag);
echostat_t* stat = get_echostat(areatag, /* create: */true);
if(stat == NULL) {
lprintf(LOG_CRIT, "Failed to allocate memory for echostats!");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment