File: callall.c

package info (click to toggle)
ifmail 2.14tx8.10-22
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,816 kB
  • ctags: 4,126
  • sloc: ansic: 30,317; perl: 4,955; yacc: 835; makefile: 732; sh: 426; cpp: 235; lex: 206; awk: 24
file content (79 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download | duplicates (15)
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;
}