Whitespace police.
This commit is contained in:
parent
da433f6296
commit
420d77836f
21
external/bsd/blacklist/bin/blacklistd.c
vendored
21
external/bsd/blacklist/bin/blacklistd.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: blacklistd.c,v 1.39 2019/11/06 20:50:01 christos Exp $ */
|
||||
/* $NetBSD: blacklistd.c,v 1.40 2020/03/10 13:36:07 roy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
@ -32,7 +32,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: blacklistd.c,v 1.39 2019/11/06 20:50:01 christos Exp $");
|
||||
__RCSID("$NetBSD: blacklistd.c,v 1.40 2020/03/10 13:36:07 roy Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -123,7 +123,7 @@ getremoteaddress(bl_info_t *bi, struct sockaddr_storage *rss, socklen_t *rsl)
|
||||
return 0;
|
||||
|
||||
if (errno != ENOTCONN) {
|
||||
(*lfun)(LOG_ERR, "getpeername failed (%m)");
|
||||
(*lfun)(LOG_ERR, "getpeername failed (%m)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -141,13 +141,13 @@ getremoteaddress(bl_info_t *bi, struct sockaddr_storage *rss, socklen_t *rsl)
|
||||
break;
|
||||
default:
|
||||
(*lfun)(LOG_ERR, "bad client passed socket family %u",
|
||||
(unsigned)bi->bi_ss.ss_family);
|
||||
(unsigned)bi->bi_ss.ss_family);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*rsl != bi->bi_slen) {
|
||||
(*lfun)(LOG_ERR, "bad client passed socket length %u != %u",
|
||||
(unsigned)*rsl, (unsigned)bi->bi_slen);
|
||||
(unsigned)*rsl, (unsigned)bi->bi_slen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ getremoteaddress(bl_info_t *bi, struct sockaddr_storage *rss, socklen_t *rsl)
|
||||
if (*rsl != rss->ss_len) {
|
||||
(*lfun)(LOG_ERR,
|
||||
"bad client passed socket internal length %u != %u",
|
||||
(unsigned)*rsl, (unsigned)rss->ss_len);
|
||||
(unsigned)*rsl, (unsigned)rss->ss_len);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@ -176,12 +176,12 @@ process(bl_t bl)
|
||||
struct timespec ts;
|
||||
|
||||
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
|
||||
(*lfun)(LOG_ERR, "clock_gettime failed (%m)");
|
||||
(*lfun)(LOG_ERR, "clock_gettime failed (%m)");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bi = bl_recv(bl)) == NULL) {
|
||||
(*lfun)(LOG_ERR, "no message (%m)");
|
||||
(*lfun)(LOG_ERR, "no message (%m)");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -251,7 +251,6 @@ process(bl_t bl)
|
||||
(*lfun)(LOG_INFO,
|
||||
"blocked %s/%d:%d for %d seconds",
|
||||
rbuf, c.c_lmask, c.c_port, c.c_duration);
|
||||
|
||||
}
|
||||
break;
|
||||
case BL_DELETE:
|
||||
@ -264,7 +263,7 @@ process(bl_t bl)
|
||||
/* ignore for now */
|
||||
break;
|
||||
default:
|
||||
(*lfun)(LOG_ERR, "unknown message %d", bi->bi_type);
|
||||
(*lfun)(LOG_ERR, "unknown message %d", bi->bi_type);
|
||||
}
|
||||
state_put(state, &c, &dbi);
|
||||
|
||||
@ -306,7 +305,7 @@ update(void)
|
||||
void *ss = &c.c_ss;
|
||||
|
||||
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
|
||||
(*lfun)(LOG_ERR, "clock_gettime failed (%m)");
|
||||
(*lfun)(LOG_ERR, "clock_gettime failed (%m)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
34
external/bsd/blacklist/bin/conf.c
vendored
34
external/bsd/blacklist/bin/conf.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.25 2019/11/06 21:01:17 christos Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.26 2020/03/10 13:36:07 roy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: conf.c,v 1.25 2019/11/06 21:01:17 christos Exp $");
|
||||
__RCSID("$NetBSD: conf.c,v 1.26 2020/03/10 13:36:07 roy Exp $");
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_LIBUTIL_H
|
||||
@ -173,9 +173,9 @@ again:
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else
|
||||
} else
|
||||
tot = im;
|
||||
|
||||
|
||||
if (e == 0) {
|
||||
c->c_duration = (int)tot;
|
||||
return 0;
|
||||
@ -214,7 +214,7 @@ static int
|
||||
getmask(const char *f, size_t l, bool local, const char **p, int *mask)
|
||||
{
|
||||
char *d;
|
||||
const char *s = *p;
|
||||
const char *s = *p;
|
||||
|
||||
if ((d = strchr(s, ':')) != NULL) {
|
||||
*d++ = '\0';
|
||||
@ -264,7 +264,7 @@ gethostport(const char *f, size_t l, bool local, struct conf *c, const char *p)
|
||||
sin6->sin6_len = sizeof(*sin6);
|
||||
#endif
|
||||
port = &sin6->sin6_port;
|
||||
}
|
||||
}
|
||||
} else if (pstr != p || strchr(p, '.') || conf_is_interface(p)) {
|
||||
if (pstr == p)
|
||||
pstr = "*";
|
||||
@ -366,11 +366,12 @@ getname(const char *f, size_t l, bool local, struct conf *c,
|
||||
{
|
||||
if (getmask(f, l, local, &p, &c->c_rmask) == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
if (strcmp(p, "*") == 0) {
|
||||
strlcpy(c->c_name, rulename, CONFNAMESZ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(p, "=") == 0) {
|
||||
if (local)
|
||||
goto out;
|
||||
@ -473,7 +474,6 @@ conf_amask_eq(const void *v1, const void *v2, size_t len, int mask)
|
||||
return 1;
|
||||
goto out;
|
||||
case FEQUAL:
|
||||
|
||||
(*lfun)(LOG_CRIT, "%s: Internal error: bad mask %d", __func__,
|
||||
mask);
|
||||
abort();
|
||||
@ -687,7 +687,7 @@ conf_addr_eq(const struct sockaddr_storage *s1,
|
||||
static int
|
||||
conf_eq(const struct conf *c1, const struct conf *c2)
|
||||
{
|
||||
|
||||
|
||||
if (!conf_addr_eq(&c1->c_ss, &c2->c_ss, c2->c_lmask))
|
||||
return 0;
|
||||
|
||||
@ -744,7 +744,7 @@ fmtport(char *b, size_t l, int port)
|
||||
if (port == FSTAR)
|
||||
return;
|
||||
|
||||
if (b[0] == '\0' || strcmp(b, "*") == 0)
|
||||
if (b[0] == '\0' || strcmp(b, "*") == 0)
|
||||
snprintf(b, l, "%d", port);
|
||||
else {
|
||||
snprintf(buf, sizeof(buf), ":%d", port);
|
||||
@ -820,7 +820,7 @@ conf_print(char *buf, size_t len, const char *pref, const char *delim,
|
||||
|
||||
fmtmask(ha, sizeof(ha), c->c_family, c->c_lmask);
|
||||
fmtport(ha, sizeof(ha), c->c_port);
|
||||
|
||||
|
||||
sp = *delim == '\t' ? 20 : -1;
|
||||
hb[0] = '\0';
|
||||
if (*delim)
|
||||
@ -878,7 +878,7 @@ conf_merge(struct conf *c, const struct conf *sc)
|
||||
(*lfun)(LOG_DEBUG, "%s: %s", __func__,
|
||||
conf_print(buf, sizeof(buf), "to:\t", "", c));
|
||||
}
|
||||
|
||||
|
||||
if (sc->c_name[0])
|
||||
memcpy(c->c_name, sc->c_name, CONFNAMESZ);
|
||||
if (sc->c_uid != FEQUAL)
|
||||
@ -1012,13 +1012,13 @@ conf_find(int fd, uid_t uid, const struct sockaddr_storage *rss,
|
||||
slen = sizeof(lss);
|
||||
memset(&lss, 0, slen);
|
||||
if (getsockname(fd, (void *)&lss, &slen) == -1) {
|
||||
(*lfun)(LOG_ERR, "getsockname failed (%m)");
|
||||
(*lfun)(LOG_ERR, "getsockname failed (%m)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
slen = sizeof(proto);
|
||||
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &proto, &slen) == -1) {
|
||||
(*lfun)(LOG_ERR, "getsockopt failed (%m)");
|
||||
(*lfun)(LOG_ERR, "getsockopt failed (%m)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1035,7 +1035,7 @@ conf_find(int fd, uid_t uid, const struct sockaddr_storage *rss,
|
||||
cr->c_proto = IPPROTO_UDP;
|
||||
break;
|
||||
default:
|
||||
(*lfun)(LOG_ERR, "unsupported protocol %d", proto);
|
||||
(*lfun)(LOG_ERR, "unsupported protocol %d", proto);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1047,7 +1047,7 @@ conf_find(int fd, uid_t uid, const struct sockaddr_storage *rss,
|
||||
cr->c_port = ntohs(((struct sockaddr_in6 *)&lss)->sin6_port);
|
||||
break;
|
||||
default:
|
||||
(*lfun)(LOG_ERR, "unsupported family %d", lss.ss_family);
|
||||
(*lfun)(LOG_ERR, "unsupported family %d", lss.ss_family);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@ conf_parse(const char *f)
|
||||
fclose(fp);
|
||||
confset_sort(&lc);
|
||||
confset_sort(&rc);
|
||||
|
||||
|
||||
confset_replace(&rconf, &rc);
|
||||
confset_replace(&lconf, &lc);
|
||||
|
||||
|
6
external/bsd/blacklist/bin/run.c
vendored
6
external/bsd/blacklist/bin/run.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: run.c,v 1.14 2016/04/04 15:52:56 christos Exp $ */
|
||||
/* $NetBSD: run.c,v 1.15 2020/03/10 13:36:07 roy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: run.c,v 1.14 2016/04/04 15:52:56 christos Exp $");
|
||||
__RCSID("$NetBSD: run.c,v 1.15 2020/03/10 13:36:07 roy Exp $");
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_LIBUTIL_H
|
||||
@ -75,7 +75,7 @@ run(const char *cmd, const char *name, ...)
|
||||
(argv[i] = va_arg(ap, char *)) != NULL; i++)
|
||||
continue;
|
||||
va_end(ap);
|
||||
|
||||
|
||||
if (debug) {
|
||||
size_t z;
|
||||
int r;
|
||||
|
6
external/bsd/blacklist/bin/support.c
vendored
6
external/bsd/blacklist/bin/support.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $ */
|
||||
/* $NetBSD: support.c,v 1.10 2020/03/10 13:36:07 roy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $");
|
||||
__RCSID("$NetBSD: support.c,v 1.10 2020/03/10 13:36:07 roy Exp $");
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@ -46,7 +46,7 @@ __RCSID("$NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $");
|
||||
#include "support.h"
|
||||
|
||||
static __attribute__((__format_arg__(3))) const char *
|
||||
expandm(char *buf, size_t len, const char *fmt)
|
||||
expandm(char *buf, size_t len, const char *fmt)
|
||||
{
|
||||
char *p;
|
||||
size_t r;
|
||||
|
7
external/bsd/blacklist/lib/bl.c
vendored
7
external/bsd/blacklist/lib/bl.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bl.c,v 1.28 2016/07/29 17:13:09 christos Exp $ */
|
||||
/* $NetBSD: bl.c,v 1.29 2020/03/10 13:36:08 roy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: bl.c,v 1.28 2016/07/29 17:13:09 christos Exp $");
|
||||
__RCSID("$NetBSD: bl.c,v 1.29 2020/03/10 13:36:08 roy Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -495,12 +495,11 @@ bl_recv(bl_t b)
|
||||
}
|
||||
|
||||
if (got != (GOT_CRED|GOT_FD)) {
|
||||
bl_log(b->b_fun, LOG_ERR, "message missing %s %s",
|
||||
bl_log(b->b_fun, LOG_ERR, "message missing %s %s",
|
||||
#if GOT_CRED != 0
|
||||
(got & GOT_CRED) == 0 ? "cred" :
|
||||
#endif
|
||||
"", (got & GOT_FD) == 0 ? "fd" : "");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user