1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "xutil.h"
#include "lutil.h"
#include "ftn.h"
#include "nodelist.h"
#include "config.h"
#include "scanout.h"
#include "needed.h"
static int each(faddr*,char,int,char*);
static fa_list *alist=NULL;
fa_list *callall(void)
{
fa_list *tmp;
int rc;
debug(7,"callall requested");
if (alist)
{
for (tmp=alist;tmp;tmp=alist)
{
alist=tmp->next;
tidy_faddr(tmp->addr);
free(tmp);
}
alist=NULL;
}
if ((rc=scanout(each)))
{
logerr("Error scanning outbound, aborting");
return NULL;
}
return alist;
}
static int each(addr,flavor,isflo,fname)
faddr *addr;
char flavor;
int isflo;
char *fname;
{
fa_list **tmp;
if ((flavor == 'h') ||
((isflo != OUT_PKT) && (isflo != OUT_FLO)))
return 0;
for (tmp=&alist;*tmp;tmp=&((*tmp)->next))
if (((*tmp)->addr->zone == addr->zone) &&
((*tmp)->addr->net == addr->net) &&
((*tmp)->addr->node == addr->node) &&
((*tmp)->addr->point == addr->point) &&
(((*tmp)->addr->domain == NULL) ||
(addr->domain == NULL) ||
(strcasecmp((*tmp)->addr->domain,addr->domain) == 0)))
break;
if (*tmp == NULL)
{
*tmp=(fa_list *)xmalloc(sizeof(fa_list));
(*tmp)->next=NULL;
(*tmp)->addr=(faddr *)xmalloc(sizeof(faddr));
(*tmp)->addr->name=NULL;
(*tmp)->addr->zone=addr->zone;
(*tmp)->addr->net=addr->net;
(*tmp)->addr->node=addr->node;
(*tmp)->addr->point=addr->point;
(*tmp)->addr->domain=xstrcpy(addr->domain);
debug(7,"has mail to %s",ascfnode((*tmp)->addr,0x1f));
}
return 0;
}
|