File: nodecheck.c

package info (click to toggle)
ifmail 2.14tx8.10-32
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,056 kB
  • sloc: ansic: 30,328; perl: 4,955; yacc: 839; makefile: 716; sh: 424; cpp: 235; lex: 206; awk: 24
file content (59 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (12)
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
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>
#ifdef HAS_NDBM_H
#include <fcntl.h>
#endif
#include "directory.h"

#include "xutil.h"
#include "lutil.h"
#include "ftn.h"
#include "config.h"
#include "nodecheck.h"
#include "nlindex.h"
#include "needed.h"


int chknlent(addr)
faddr *addr;
{
	struct _ixentry xaddr;
	datum key;
	datum dat;
	int n;

	debug(20,"chknlent for %s",ascfnode(addr,0x1f));

	key.dptr=(char*)&xaddr;
	key.dsize=sizeof(struct _ixentry);

	if (addr == NULL) return(0);

	xaddr.zone=addr->zone;
	xaddr.net=addr->net;
	xaddr.node=addr->node;
	xaddr.point=0; /* We only check if the node/boss exist */

	switch (initnl())
	{
	case 0:	break;
	case 1:	loginf("WARNING: nodelist index needs to be rebuilt with \"ifindex\"");
		break;
	default: return(0);
	}

#ifdef HAS_NDBM_H
	dat=dbm_fetch(nldb,key);
#else
	dat=fetch(key);
#endif
	if (dat.dptr == NULL) return(0);
	n=dat.dsize/sizeof(struct _loc);
	debug(20,"found %d entries",n);
	return(1);
}