13656f229SKurt Lidl /*- 23656f229SKurt Lidl * Copyright (c) 2016 The FreeBSD Foundation 33656f229SKurt Lidl * 43656f229SKurt Lidl * This software was developed by Kurt Lidl under sponsorship from the 53656f229SKurt Lidl * FreeBSD Foundation. 63656f229SKurt Lidl * 73656f229SKurt Lidl * Redistribution and use in source and binary forms, with or without 83656f229SKurt Lidl * modification, are permitted provided that the following conditions 93656f229SKurt Lidl * are met: 103656f229SKurt Lidl * 1. Redistributions of source code must retain the above copyright 113656f229SKurt Lidl * notice, this list of conditions and the following disclaimer. 123656f229SKurt Lidl * 2. Redistributions in binary form must reproduce the above copyright 133656f229SKurt Lidl * notice, this list of conditions and the following disclaimer in the 143656f229SKurt Lidl * documentation and/or other materials provided with the distribution. 153656f229SKurt Lidl * 163656f229SKurt Lidl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 173656f229SKurt Lidl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 183656f229SKurt Lidl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 193656f229SKurt Lidl * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 203656f229SKurt Lidl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 213656f229SKurt Lidl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 223656f229SKurt Lidl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 233656f229SKurt Lidl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 243656f229SKurt Lidl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 253656f229SKurt Lidl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 263656f229SKurt Lidl * SUCH DAMAGE. */ 273656f229SKurt Lidl 283656f229SKurt Lidl 293656f229SKurt Lidl #include <ctype.h> 303656f229SKurt Lidl #include <stdarg.h> 313656f229SKurt Lidl #include <stdlib.h> 323656f229SKurt Lidl #include <unistd.h> 333656f229SKurt Lidl 343656f229SKurt Lidl #include <blacklist.h> 35*be4b7933SKurt Lidl #include "blacklist_client.h" 363656f229SKurt Lidl 373656f229SKurt Lidl static struct blacklist *blstate; 38e07d11b6SKurt Lidl extern int use_blacklist; 393656f229SKurt Lidl 403656f229SKurt Lidl void 413656f229SKurt Lidl blacklist_init(void) 423656f229SKurt Lidl { 43e07d11b6SKurt Lidl 44e07d11b6SKurt Lidl if (use_blacklist) 453656f229SKurt Lidl blstate = blacklist_open(); 463656f229SKurt Lidl } 473656f229SKurt Lidl 483656f229SKurt Lidl void 49*be4b7933SKurt Lidl blacklist_notify(int action, int fd, const char *msg) 503656f229SKurt Lidl { 51e07d11b6SKurt Lidl 523656f229SKurt Lidl if (blstate == NULL) 533656f229SKurt Lidl return; 543656f229SKurt Lidl (void)blacklist_r(blstate, action, fd, msg); 553656f229SKurt Lidl } 56