Fixed several memory leaks in mbfido

This commit is contained in:
Michiel Broek 2002-06-17 20:36:06 +00:00
parent 3cc5a6fa3a
commit 25ca17d6f9
9 changed files with 112 additions and 51 deletions

View File

@ -38,6 +38,7 @@ v0.35.01 05-Jun-2002
mbfido: mbfido:
When creating uplink area requests the from aka used is now When creating uplink area requests the from aka used is now
the aka defined in the group. the aka defined in the group.
Removed several memory leaks again.
mbfile: mbfile:
Added -v commandline switch to supress virus checking for the Added -v commandline switch to supress virus checking for the

View File

@ -124,7 +124,7 @@ void A_List(faddr *t, char *replyid, int Notify)
char *temp, *Group, *subject; char *temp, *Group, *subject;
int i, First = TRUE, SubTot, Total = 0, Cons; int i, First = TRUE, SubTot, Total = 0, Cons;
char Stat[5]; char Stat[5];
faddr *f, *g; faddr *f, *g, *Temp;
sysconnect System; sysconnect System;
long msgptr; long msgptr;
fpos_t fileptr,fileptr1,fileptr2; fpos_t fileptr,fileptr1,fileptr2;
@ -209,7 +209,9 @@ void A_List(faddr *t, char *replyid, int Notify)
fseek(gp, mgrouphdr.hdrsize, SEEK_SET); fseek(gp, mgrouphdr.hdrsize, SEEK_SET);
while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) { while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) {
g = bestaka_s(fido2faddr(mgroup.UseAka)); Temp = fido2faddr(mgroup.UseAka);
g = bestaka_s(Temp);
tidy_faddr(Temp);
if ((!strcmp(mgroup.Name, Group)) && if ((!strcmp(mgroup.Name, Group)) &&
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) { (g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
SubTot = 0; SubTot = 0;
@ -296,7 +298,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
char *temp, *Group, *subject; char *temp, *Group, *subject;
int i, First = TRUE, Cons; int i, First = TRUE, Cons;
char Stat[2]; char Stat[2];
faddr *f, *g; faddr *f, *g, *Temp;
sysconnect System; sysconnect System;
time_t Now; time_t Now;
struct tm *tt; struct tm *tt;
@ -379,7 +381,9 @@ void A_Flow(faddr *t, char *replyid, int Notify)
plm = plw = plt = rlm = rlw = rlt = 0; plm = plw = plt = rlm = rlw = rlt = 0;
fseek(gp, mgrouphdr.hdrsize, SEEK_SET); fseek(gp, mgrouphdr.hdrsize, SEEK_SET);
while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) { while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) {
g = bestaka_s(fido2faddr(mgroup.UseAka)); Temp = fido2faddr(mgroup.UseAka);
g = bestaka_s(Temp);
tidy_faddr(Temp);
if ((!strcmp(mgroup.Name, Group)) && if ((!strcmp(mgroup.Name, Group)) &&
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) { (g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
@ -521,7 +525,7 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
{ {
int i, First; int i, First;
char *Group; char *Group;
faddr *b; faddr *b, *Temp;
sysconnect Sys; sysconnect Sys;
Syslog('+', "AreaMgr: \"%s\"", Area); Syslog('+', "AreaMgr: \"%s\"", Area);
@ -556,7 +560,9 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
} }
b = bestaka_s(t); b = bestaka_s(t);
i = metric(b, fido2faddr(msgs.Aka)); Temp = fido2faddr(msgs.Aka);
i = metric(b, Temp);
tidy_faddr(Temp);
Syslog('m', "Aka match level is %d", i); Syslog('m', "Aka match level is %d", i);
if (i >= METRIC_NET) { if (i >= METRIC_NET) {
@ -610,7 +616,7 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
{ {
int i, First; int i, First;
char *Group, *temp; char *Group, *temp;
faddr *b; faddr *b, *Temp;
sysconnect Sys; sysconnect Sys;
FILE *gp; FILE *gp;
@ -684,7 +690,9 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
} }
b = bestaka_s(t); b = bestaka_s(t);
i = metric(b, fido2faddr(msgs.Aka)); Temp = fido2faddr(msgs.Aka);
i = metric(b, Temp);
tidy_faddr(Temp);
Syslog('m', "Aka match level is %d", i); Syslog('m', "Aka match level is %d", i);
if (i >= METRIC_NET) { if (i >= METRIC_NET) {
@ -737,7 +745,7 @@ void A_All(faddr *t, int Connect, FILE *tmp, char *Grp)
{ {
FILE *mp, *gp; FILE *mp, *gp;
char *Group, *temp; char *Group, *temp;
faddr *f; faddr *f, *Temp;
int i, Link, First = TRUE, Cons; int i, Link, First = TRUE, Cons;
sysconnect Sys; sysconnect Sys;
long Pos; long Pos;
@ -792,15 +800,18 @@ void A_All(faddr *t, int Connect, FILE *tmp, char *Grp)
fseek(mp, msgshdr.hdrsize, SEEK_SET); fseek(mp, msgshdr.hdrsize, SEEK_SET);
while (fread(&msgs, msgshdr.recsize, 1, mp) == 1) { while (fread(&msgs, msgshdr.recsize, 1, mp) == 1) {
Temp = fido2faddr(msgs.Aka);
if ((!strcmp(Group, msgs.Group)) && (msgs.Active) && (!msgs.Mandatory) && strlen(msgs.Tag) && if ((!strcmp(Group, msgs.Group)) && (msgs.Active) && (!msgs.Mandatory) && strlen(msgs.Tag) &&
((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS) || (msgs.Type == LIST)) && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS) || (msgs.Type == LIST)) &&
(metric(fido2faddr(msgs.Aka), f) < METRIC_NET)) { (metric(Temp, f) < METRIC_NET)) {
if (Connect) { if (Connect) {
Link = FALSE; Link = FALSE;
for (i = 0; i < Cons; i++) { for (i = 0; i < Cons; i++) {
fread(&Sys, sizeof(Sys), 1, mp); fread(&Sys, sizeof(Sys), 1, mp);
if (metric(fido2faddr(Sys.aka), t) == METRIC_EQUAL) tidy_faddr(Temp);
Temp = fido2faddr(Sys.aka);
if (metric(Temp, t) == METRIC_EQUAL)
Link = TRUE; Link = TRUE;
} }
if (!Link) { if (!Link) {
@ -829,7 +840,9 @@ void A_All(faddr *t, int Connect, FILE *tmp, char *Grp)
} else { } else {
for (i = 0; i < Cons; i++) { for (i = 0; i < Cons; i++) {
fread(&Sys, sizeof(Sys), 1, mp); fread(&Sys, sizeof(Sys), 1, mp);
if ((metric(fido2faddr(Sys.aka), t) == METRIC_EQUAL) && (!Sys.cutoff)) { tidy_faddr(Temp);
Temp = fido2faddr(Sys.aka);
if ((metric(Temp, t) == METRIC_EQUAL) && (!Sys.cutoff)) {
memset(&Sys, 0, sizeof(Sys)); memset(&Sys, 0, sizeof(Sys));
fseek(mp, - sizeof(Sys), SEEK_CUR); fseek(mp, - sizeof(Sys), SEEK_CUR);
fwrite(&Sys, sizeof(Sys), 1, mp); fwrite(&Sys, sizeof(Sys), 1, mp);
@ -844,6 +857,7 @@ void A_All(faddr *t, int Connect, FILE *tmp, char *Grp)
} }
} else } else
fseek(mp, msgshdr.syssize, SEEK_CUR); fseek(mp, msgshdr.syssize, SEEK_CUR);
tidy_faddr(Temp);
} }
} }
} }
@ -872,7 +886,7 @@ void A_Pause(faddr *, int, FILE *);
void A_Pause(faddr *t, int Pause, FILE *tmp) void A_Pause(faddr *t, int Pause, FILE *tmp)
{ {
FILE *mp; FILE *mp;
faddr *f; faddr *f, *Temp;
int i, Cons; int i, Cons;
sysconnect Sys; sysconnect Sys;
char *temp; char *temp;
@ -900,7 +914,8 @@ void A_Pause(faddr *t, int Pause, FILE *tmp)
if (msgs.Active) { if (msgs.Active) {
for (i = 0; i < Cons; i++) { for (i = 0; i < Cons; i++) {
fread(&Sys, sizeof(Sys), 1, mp); fread(&Sys, sizeof(Sys), 1, mp);
if ((metric(fido2faddr(Sys.aka), t) == METRIC_EQUAL) && (!Sys.cutoff)) { Temp = fido2faddr(Sys.aka);
if ((metric(Temp, t) == METRIC_EQUAL) && (!Sys.cutoff)) {
Sys.pause = Pause; Sys.pause = Pause;
fseek(mp, - sizeof(Sys), SEEK_CUR); fseek(mp, - sizeof(Sys), SEEK_CUR);
fwrite(&Sys, sizeof(Sys), 1, mp); fwrite(&Sys, sizeof(Sys), 1, mp);
@ -910,6 +925,7 @@ void A_Pause(faddr *t, int Pause, FILE *tmp)
MsgResult("areamgr.responses",tmp); MsgResult("areamgr.responses",tmp);
a_list = TRUE; a_list = TRUE;
} }
tidy_faddr(Temp);
} }
} else { } else {
fseek(mp, msgshdr.syssize, SEEK_CUR); fseek(mp, msgshdr.syssize, SEEK_CUR);

View File

@ -93,6 +93,7 @@ int CheckTicGroup(char *Area, int SendUplink, faddr *f)
long offset, AreaNr; long offset, AreaNr;
int i, rc = 0, Found = FALSE; int i, rc = 0, Found = FALSE;
sysconnect System; sysconnect System;
faddr *From, *To;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
Syslog('f', "Checking file group \"%s\" \"%s\"", fgroup.Name, fgroup.Comment); Syslog('f', "Checking file group \"%s\" \"%s\"", fgroup.Name, fgroup.Comment);
@ -188,13 +189,20 @@ int CheckTicGroup(char *Area, int SendUplink, faddr *f)
*/ */
if (SendUplink) { if (SendUplink) {
sprintf(temp, "+%s", Area); sprintf(temp, "+%s", Area);
if (UplinkRequest(fido2faddr(fgroup.UpLink), fido2faddr(fgroup.UseAka), TRUE, temp)) {
From = fido2faddr(fgroup.UseAka);
To = fido2faddr(fgroup.UpLink);
if (UplinkRequest(To, From, TRUE, temp)) {
WriteError("Can't send netmail to uplink"); WriteError("Can't send netmail to uplink");
fclose(ap); fclose(ap);
free(buf); free(buf);
free(temp); free(temp);
tidy_faddr(From);
tidy_faddr(To);
return 1; return 1;
} }
tidy_faddr(From);
tidy_faddr(To);
} }
Syslog('f', "Netmail ready"); Syslog('f', "Netmail ready");

View File

@ -94,6 +94,7 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f)
long offset; long offset;
int i, rc = 0; int i, rc = 0;
sysconnect System; sysconnect System;
faddr *From, *To;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
Syslog('m', "Checking echogroup %s %s", mgroup.Name, mgroup.Comment); Syslog('m', "Checking echogroup %s %s", mgroup.Name, mgroup.Comment);
@ -121,13 +122,19 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f)
*/ */
if (SendUplink) { if (SendUplink) {
sprintf(temp, "+%s", Area); sprintf(temp, "+%s", Area);
if (UplinkRequest(fido2faddr(mgroup.UpLink), fido2faddr(mgroup.UseAka), FALSE, temp)) { From = fido2faddr(mgroup.UseAka);
To = fido2faddr(mgroup.UpLink);
if (UplinkRequest(To, From, FALSE, temp)) {
WriteError("Can't send netmail to uplink"); WriteError("Can't send netmail to uplink");
fclose(ap); fclose(ap);
free(buf); free(buf);
free(temp); free(temp);
tidy_faddr(From);
tidy_faddr(To);
return 1; return 1;
} }
tidy_faddr(From);
tidy_faddr(To);
} }
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));

View File

@ -116,7 +116,7 @@ void F_List(faddr *t, char *replyid, int Notify)
char *temp, *Group, *subject; char *temp, *Group, *subject;
int i, First = TRUE, SubTot, Total = 0, Cons; int i, First = TRUE, SubTot, Total = 0, Cons;
char Stat[4]; char Stat[4];
faddr *f, *g; faddr *f, *g, *Temp;
sysconnect System; sysconnect System;
long msgptr; long msgptr;
fpos_t fileptr,fileptr1,fileptr2; fpos_t fileptr,fileptr1,fileptr2;
@ -200,7 +200,8 @@ void F_List(faddr *t, char *replyid, int Notify)
fseek(gp, fgrouphdr.hdrsize, SEEK_SET); fseek(gp, fgrouphdr.hdrsize, SEEK_SET);
while (fread(&fgroup, fgrouphdr.recsize, 1, gp) == 1) { while (fread(&fgroup, fgrouphdr.recsize, 1, gp) == 1) {
g = bestaka_s(fido2faddr(fgroup.UseAka)); Temp = fido2faddr(fgroup.UseAka);
g = bestaka_s(Temp);
if ((!strcmp(fgroup.Name, Group)) && if ((!strcmp(fgroup.Name, Group)) &&
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) { (g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
SubTot = 0; SubTot = 0;
@ -260,6 +261,7 @@ void F_List(faddr *t, char *replyid, int Notify)
} }
MacroRead(fi, qp); MacroRead(fi, qp);
} }
tidy_faddr(Temp);
} }
} }
@ -352,7 +354,7 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
{ {
int i, First; int i, First;
char *Group; char *Group;
faddr *b; faddr *b, *Temp;
sysconnect Sys; sysconnect Sys;
Syslog('+', "FileMgr: %s", Area); Syslog('+', "FileMgr: %s", Area);
@ -387,7 +389,9 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
} }
b = bestaka_s(t); b = bestaka_s(t);
i = metric(b, fido2faddr(tic.Aka)); Temp = fido2faddr(tic.Aka);
i = metric(b, Temp);
tidy_faddr(Temp);
Syslog('m', "Aka match level is %d", i); Syslog('m', "Aka match level is %d", i);
if (i >= METRIC_NET) { if (i >= METRIC_NET) {
@ -441,7 +445,7 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
{ {
int i, First; int i, First;
char *Group, *temp; char *Group, *temp;
faddr *b; faddr *b, *Temp;
sysconnect Sys; sysconnect Sys;
FILE *gp; FILE *gp;
@ -515,7 +519,9 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
} }
b = bestaka_s(t); b = bestaka_s(t);
i = metric(b, fido2faddr(tic.Aka)); Temp = fido2faddr(tic.Aka);
i = metric(b, Temp);
tidy_faddr(Temp);
Syslog('m', "Aka match level is %d", i); Syslog('m', "Aka match level is %d", i);
if (i >= METRIC_NET) { if (i >= METRIC_NET) {
@ -567,7 +573,7 @@ void F_All(faddr *t, int Connect, FILE *tmp, char *Grp)
{ {
FILE *fp, *gp; FILE *fp, *gp;
char *Group, *temp; char *Group, *temp;
faddr *f; faddr *f, *Temp;
int i, Link, First = TRUE, Cons; int i, Link, First = TRUE, Cons;
sysconnect Sys; sysconnect Sys;
long Pos; long Pos;
@ -618,14 +624,17 @@ void F_All(faddr *t, int Connect, FILE *tmp, char *Grp)
fseek(fp, tichdr.hdrsize, SEEK_SET); fseek(fp, tichdr.hdrsize, SEEK_SET);
while (fread(&tic, tichdr.recsize, 1, fp) == 1) { while (fread(&tic, tichdr.recsize, 1, fp) == 1) {
Temp = fido2faddr(tic.Aka);
if ((!strcmp(Group, tic.Group)) && tic.Active && strlen(tic.Name) && if ((!strcmp(Group, tic.Group)) && tic.Active && strlen(tic.Name) &&
(metric(fido2faddr(tic.Aka), f) < METRIC_NET)) { (metric(Temp, f) < METRIC_NET)) {
if (Connect) { if (Connect) {
Link = FALSE; Link = FALSE;
for (i = 0; i < Cons; i++) { for (i = 0; i < Cons; i++) {
fread(&Sys, sizeof(Sys), 1, fp); fread(&Sys, sizeof(Sys), 1, fp);
if (metric(fido2faddr(Sys.aka), t) == METRIC_EQUAL) tidy_faddr(Temp);
Temp = fido2faddr(Sys.aka);
if (metric(Temp, t) == METRIC_EQUAL)
Link = TRUE; Link = TRUE;
} }
if (!Link) { if (!Link) {
@ -653,7 +662,9 @@ void F_All(faddr *t, int Connect, FILE *tmp, char *Grp)
} else { } else {
for (i = 0; i < Cons; i++) { for (i = 0; i < Cons; i++) {
fread(&Sys, sizeof(Sys), 1, fp); fread(&Sys, sizeof(Sys), 1, fp);
if (metric(fido2faddr(Sys.aka), t) == METRIC_EQUAL) { tidy_faddr(Temp);
Temp = fido2faddr(Sys.aka);
if (metric(Temp, t) == METRIC_EQUAL) {
memset(&Sys, 0, sizeof(Sys)); memset(&Sys, 0, sizeof(Sys));
fseek(fp, - sizeof(Sys), SEEK_CUR); fseek(fp, - sizeof(Sys), SEEK_CUR);
fwrite(&Sys, sizeof(Sys), 1, fp); fwrite(&Sys, sizeof(Sys), 1, fp);
@ -668,6 +679,7 @@ void F_All(faddr *t, int Connect, FILE *tmp, char *Grp)
} }
} else } else
fseek(fp, tichdr.syssize, SEEK_CUR); fseek(fp, tichdr.syssize, SEEK_CUR);
tidy_faddr(Temp);
} }
} }
} }
@ -696,7 +708,7 @@ void F_Pause(faddr *, int, FILE *);
void F_Pause(faddr *t, int Pause, FILE *tmp) void F_Pause(faddr *t, int Pause, FILE *tmp)
{ {
FILE *fp; FILE *fp;
faddr *f; faddr *f, *Temp;
int i, Cons; int i, Cons;
sysconnect Sys; sysconnect Sys;
char *temp; char *temp;
@ -723,7 +735,8 @@ void F_Pause(faddr *t, int Pause, FILE *tmp)
if (tic.Active) { if (tic.Active) {
for (i = 0; i < Cons; i++) { for (i = 0; i < Cons; i++) {
fread(&Sys, sizeof(Sys), 1, fp); fread(&Sys, sizeof(Sys), 1, fp);
if ((metric(fido2faddr(Sys.aka), t) == METRIC_EQUAL) && (!Sys.cutoff)) { Temp = fido2faddr(Sys.aka);
if ((metric(Temp, t) == METRIC_EQUAL) && (!Sys.cutoff)) {
Sys.pause = Pause; Sys.pause = Pause;
fseek(fp, - sizeof(Sys), SEEK_CUR); fseek(fp, - sizeof(Sys), SEEK_CUR);
fwrite(&Sys, sizeof(Sys), 1, fp); fwrite(&Sys, sizeof(Sys), 1, fp);
@ -733,6 +746,7 @@ void F_Pause(faddr *t, int Pause, FILE *tmp)
MsgResult("filemgr.responses",tmp); MsgResult("filemgr.responses",tmp);
f_list = TRUE; f_list = TRUE;
} }
tidy_faddr(Temp);
} }
} else { } else {
fseek(fp, tichdr.syssize, SEEK_CUR); fseek(fp, tichdr.syssize, SEEK_CUR);

View File

@ -51,7 +51,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname; char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname;
FILE *fp, *fi, *net; FILE *fp, *fi, *net;
char flavor; char flavor;
faddr *dest, *routeto, *Fa; faddr *dest, *routeto, *Fa, *Temp;
int i, z, n; int i, z, n;
time_t now, ftime; time_t now, ftime;
fa_list *tmp; fa_list *tmp;
@ -114,11 +114,6 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
dest = fido2faddr(Node); dest = fido2faddr(Node);
attach(*routeto, fwdfile, LEAVE, flavor); attach(*routeto, fwdfile, LEAVE, flavor);
// if (strlen(CFG.dospath))
// subject = xstrcpy(Unix2Dos(fwdfile));
// else
// subject = xstrcpy(fwdfile);
ticfile = calloc(PATH_MAX, sizeof(char)); ticfile = calloc(PATH_MAX, sizeof(char));
ticname = calloc(15, sizeof(char)); ticname = calloc(15, sizeof(char));
if (nodes.Tic) { if (nodes.Tic) {
@ -133,7 +128,8 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
* Send netmail message if the node has it turned on. * Send netmail message if the node has it turned on.
*/ */
if (nodes.Message) { if (nodes.Message) {
if ((net = SendMgrMail(fido2faddr(Node), CFG.ct_KeepMgr, TRUE, (char *)"Filemgr", subject, NULL)) != NULL) { Temp = fido2faddr(Node);
if ((net = SendMgrMail(Temp, CFG.ct_KeepMgr, TRUE, (char *)"Filemgr", subject, NULL)) != NULL) {
if ((fi = OpenMacro("forward.tic", nodes.Language, FALSE)) != NULL) { if ((fi = OpenMacro("forward.tic", nodes.Language, FALSE)) != NULL) {
ftime = TIC.FileDate; ftime = TIC.FileDate;
MacroVars("a", "s", TIC.TicIn.Area); MacroVars("a", "s", TIC.TicIn.Area);
@ -158,11 +154,12 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
MacroVars("l", "s", TIC.TicIn.Replace); MacroVars("l", "s", TIC.TicIn.Replace);
MacroRead(fi, net); MacroRead(fi, net);
fprintf(net, "%s\r", TearLine()); fprintf(net, "%s\r", TearLine());
CloseMail(net, fido2faddr(Node)); CloseMail(net, Temp);
} }
} else { } else {
WriteError("$Can't create netmail"); WriteError("$Can't create netmail");
} }
tidy_faddr(Temp);
} }
free(subject); free(subject);

View File

@ -99,7 +99,7 @@ void WriteMailGroups(FILE *fp, faddr *f)
int Count = 0, First = TRUE; int Count = 0, First = TRUE;
char *Group, *temp; char *Group, *temp;
FILE *gp,*fi; FILE *gp,*fi;
faddr *g; faddr *g, *Temp;
fpos_t fileptr; fpos_t fileptr;
if ((fi = OpenMacro("areamgr.group", nodes.Language, FALSE)) == NULL) if ((fi = OpenMacro("areamgr.group", nodes.Language, FALSE)) == NULL)
@ -127,7 +127,8 @@ void WriteMailGroups(FILE *fp, faddr *f)
fseek(gp, mgrouphdr.hdrsize, SEEK_SET); fseek(gp, mgrouphdr.hdrsize, SEEK_SET);
while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) { while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) {
g = bestaka_s(fido2faddr(mgroup.UseAka)); Temp = fido2faddr(mgroup.UseAka);
g = bestaka_s(Temp);
if ((!strcmp(mgroup.Name, Group)) && if ((!strcmp(mgroup.Name, Group)) &&
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) { (g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
MacroVars("gh", "ss", mgroup.Name, mgroup.Comment); MacroVars("gh", "ss", mgroup.Name, mgroup.Comment);
@ -136,6 +137,7 @@ void WriteMailGroups(FILE *fp, faddr *f)
Count++; Count++;
break; break;
} }
tidy_faddr(Temp);
} }
} }
@ -156,7 +158,7 @@ void WriteFileGroups(FILE *fp, faddr *f)
int Count = 0, First = TRUE; int Count = 0, First = TRUE;
char *Group, *temp; char *Group, *temp;
FILE *gp, *fi; FILE *gp, *fi;
faddr *g; faddr *g, *Temp;
fpos_t fileptr; fpos_t fileptr;
if ((fi = OpenMacro("filemgr.group", nodes.Language, FALSE)) == NULL) if ((fi = OpenMacro("filemgr.group", nodes.Language, FALSE)) == NULL)
@ -184,7 +186,8 @@ void WriteFileGroups(FILE *fp, faddr *f)
fseek(gp, fgrouphdr.hdrsize, SEEK_SET); fseek(gp, fgrouphdr.hdrsize, SEEK_SET);
while (fread(&fgroup, fgrouphdr.recsize, 1, gp) == 1) { while (fread(&fgroup, fgrouphdr.recsize, 1, gp) == 1) {
g = bestaka_s(fido2faddr(fgroup.UseAka)); Temp = fido2faddr(fgroup.UseAka);
g = bestaka_s(Temp);
if ((!strcmp(fgroup.Name, Group)) && if ((!strcmp(fgroup.Name, Group)) &&
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) { (g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
MacroVars("gh", "ss", fgroup.Name, fgroup.Comment ); MacroVars("gh", "ss", fgroup.Name, fgroup.Comment );
@ -193,6 +196,7 @@ void WriteFileGroups(FILE *fp, faddr *f)
Count++; Count++;
break; break;
} }
tidy_faddr(Temp);
} }
} }
@ -502,6 +506,7 @@ int Areas(void)
AreaList *alist = NULL, *tmp; AreaList *alist = NULL, *tmp;
int i, count = 0, Found; int i, count = 0, Found;
sysconnect System; sysconnect System;
faddr *From, *To;
Syslog('+', "Process areas taglists"); Syslog('+', "Process areas taglists");
@ -685,11 +690,15 @@ int Areas(void)
* Sent one uplink command with additions and deletions * Sent one uplink command with additions and deletions
*/ */
if (mgroup.UpLink.zone) { if (mgroup.UpLink.zone) {
if (UplinkRequest(fido2faddr(mgroup.UpLink), fido2faddr(mgroup.UseAka), FALSE, cmd)) { From = fido2faddr(mgroup.UseAka);
To = fido2faddr(mgroup.UpLink);
if (UplinkRequest(To, From, FALSE, cmd)) {
WriteError("Uplink request failed"); WriteError("Uplink request failed");
} else { } else {
Syslog('+', "AreaMgr request sent to %s", aka2str(mgroup.UpLink)); Syslog('+', "AreaMgr request sent to %s", aka2str(mgroup.UpLink));
} }
tidy_faddr(From);
tidy_faddr(To);
} else { } else {
Syslog('+', "No uplink defined, not sending a AreaMgr request"); Syslog('+', "No uplink defined, not sending a AreaMgr request");
} }
@ -939,11 +948,15 @@ int Areas(void)
* Sent one uplink command with additions and deletions * Sent one uplink command with additions and deletions
*/ */
if (fgroup.UpLink.zone) { if (fgroup.UpLink.zone) {
if (UplinkRequest(fido2faddr(fgroup.UpLink), fido2faddr(fgroup.UseAka), TRUE, cmd)) { From = fido2faddr(fgroup.UseAka);
To = fido2faddr(fgroup.UpLink);
if (UplinkRequest(To, From, TRUE, cmd)) {
WriteError("Uplink request failed"); WriteError("Uplink request failed");
} else { } else {
Syslog('+', "AreaMgr request sent to %s", aka2str(fgroup.UpLink)); Syslog('+', "AreaMgr request sent to %s", aka2str(fgroup.UpLink));
} }
tidy_faddr(From);
tidy_faddr(To);
} else { } else {
Syslog('+', "No uplink defined, not sending a FileMgr request"); Syslog('+', "No uplink defined, not sending a FileMgr request");
} }

View File

@ -213,7 +213,7 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int incode, int outcode, int newsmode, faddr *reci
char *ftnfrom=NULL; char *ftnfrom=NULL;
static ftnmsg *tmsg; static ftnmsg *tmsg;
int needreplyaddr = 1; int needreplyaddr = 1;
faddr *tmp; faddr *tmp, *tmp2;
tmsg=(ftnmsg *)malloc(sizeof(ftnmsg)); tmsg=(ftnmsg *)malloc(sizeof(ftnmsg));
memset(tmsg, 0, sizeof(ftnmsg)); memset(tmsg, 0, sizeof(ftnmsg));
@ -422,9 +422,11 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int incode, int outcode, int newsmode, faddr *reci
if (tmsg->from) if (tmsg->from)
Syslog('m', "From address was%s distinguished as ftn", tmsg->from ? "" : " not"); Syslog('m', "From address was%s distinguished as ftn", tmsg->from ? "" : " not");
if (newsmode) if (newsmode) {
bestaka = bestaka_s(fido2faddr(msgs.Aka)); tmp2 = fido2faddr(msgs.Aka);
else bestaka = bestaka_s(tmp2);
tidy_faddr(tmp2);
} else
bestaka = bestaka_s(tmsg->to); bestaka = bestaka_s(tmsg->to);
if ((tmsg->from == NULL) && (bestaka)) { if ((tmsg->from == NULL) && (bestaka)) {

View File

@ -59,6 +59,7 @@ int Notify(char *Options)
FILE *np; FILE *np;
char *temp, Opt[44]; char *temp, Opt[44];
int i; int i;
faddr *Tmp;
Syslog('+', "Notify \"%s\"", Options); Syslog('+', "Notify \"%s\"", Options);
@ -139,13 +140,15 @@ int Notify(char *Options)
fflush(stdout); fflush(stdout);
} }
Tmp = fido2faddr(nodes.Aka[i]);
if (i == 0) { if (i == 0) {
F_Status(fido2faddr(nodes.Aka[i]), NULL); F_Status(Tmp, NULL);
A_Status(fido2faddr(nodes.Aka[i]), NULL); A_Status(Tmp, NULL);
} }
F_List(fido2faddr(nodes.Aka[i]), NULL, TRUE); F_List(Tmp, NULL, TRUE);
A_List(fido2faddr(nodes.Aka[i]), NULL, TRUE); A_List(Tmp, NULL, TRUE);
A_Flow(fido2faddr(nodes.Aka[i]), NULL, TRUE); A_Flow(Tmp, NULL, TRUE);
tidy_faddr(Tmp);
notify++; notify++;
} }
} }