void
send_blacklist(struct blacklist *blist, in_port_t port)
{
	struct cidr **cidrs, **tmp;

	if (blist->blc > 0) {
		cidrs = collapse_blacklist(blist->bl, blist->blc);
		if (cidrs == NULL)
			errx(1, "malloc failed");
		if (!dryrun) {
			if (configure_spamd(port, blist->name,
			    blist->message, cidrs) == -1)
				err(1, "Can't connect to spamd on port %d",
				    port);
#ifndef __FreeBSD__					
			if (!greyonly && configure_pf(cidrs) == -1)
				err(1, "pfctl failed");
#else
		if(use_pf){
			if (!greyonly && configure_pf(cidrs) == -1)
				err(1, "pfctl failed");
		}
		else{
			if (!greyonly && configure_ipfw(cidrs) == -1)
				err(1, "ipfw failed");
		}
#endif
		}
		for (tmp = cidrs; *tmp != NULL; tmp++)
			free(*tmp);
		free(cidrs);
		free(blist->bl);
	}
}
Beispiel #2
0
void
send_blacklist(struct blacklist *blist, in_port_t port)
{
	struct cidr *cidrs;

	if (blist->blc > 0) {
		cidrs = collapse_blacklist(blist->bl, blist->blc);
		if (cidrs == NULL)
			errx(1, "malloc failed");
		if (!dryrun) {
			if (configure_spamd(port, blist->name,
			    blist->message, cidrs) == -1)
				err(1, "Can't connect to spamd on port %d",
				    port);
			if (!greyonly && configure_pf(cidrs) == -1)
				err(1, "pfctl failed");
		}
		free(cidrs);
		free(blist->bl);
	}
}