10 static int flagrh
= 0;
11 static stralloc rh
= {0};
12 static struct constmap maprh
;
17 flagrh
= control_readfile(&rh
,"control/rcpthosts",0);
18 if (flagrh
!= 1) return flagrh
;
19 if (!constmap_init(&maprh
,rh
.s
,rh
.len
,0)) return flagrh
= -1;
20 fdmrh
= open_read("control/morercpthosts.cdb");
21 if (fdmrh
== -1) if (errno
!= error_noent
) return flagrh
= -1;
25 static stralloc host
= {0};
27 int rcpthosts(buf
,len
)
33 if (flagrh
!= 1) return 1;
35 j
= byte_rchr(buf
,len
,'@');
36 if (j
>= len
) return 1; /* presumably envnoathost is acceptable */
38 ++j
; buf
+= j
; len
-= j
;
40 if (!stralloc_copyb(&host
,buf
,len
)) return -1;
44 for (j
= 0;j
< len
;++j
)
45 if (!j
|| (buf
[j
] == '.'))
46 if (constmap(&maprh
,buf
+ j
,len
- j
)) return 1;
52 for (j
= 0;j
< len
;++j
)
53 if (!j
|| (buf
[j
] == '.')) {
54 r
= cdb_seek(fdmrh
,buf
+ j
,len
- j
,&dlen
);