From nobody Wed Feb 08 21:05:07 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PBsvl5Cg2z3pKKy; Wed, 8 Feb 2023 21:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PBsvl4mQhz3jND; Wed, 8 Feb 2023 21:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675890307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9HIox1qWvM+s/0IfYyMkmMOai3MKOgIn1of+mpE+aKU=; b=oD85KfgkFfPsPnTKhIp4Q/Lblaq8DfiLoUAu1Vlmes78kIN9h3JoTVDOEfcQyAFSWxyNHY lI2O0eZKIJCac7RGiYgdqnGGf6+UFfNPs/u+2e0SfkI8/O9x+rHl76w6yEX/9oJmrh0bdE RqIKG2oD+F+yfoQzhXccPuWuETwIQjiBMpHS5FlIfGS3mQ0DpYiLnkCTC/DqVRtAbYy6vP SqNi4RCIDfmM2ndFHBECW8MJ3bLBeUeVV3/z9QJDU3PJkUf9Bh8JtT7lNZEvxagpxeiQeA WWfYizCZA/7M1/ai5U3D2M1gZM4tnmVVZb8/wSDJ0tu5kXWIIAOWZYulqa9rbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675890307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9HIox1qWvM+s/0IfYyMkmMOai3MKOgIn1of+mpE+aKU=; b=Z1syZ4V/aFMsqZfvxVoRylypFkxbBc9Wti3+ImL02DhWlIOdl8ij2dWrTP+/EP7e6HKYM0 /QNf97tpo4gEtjD875w+wfIxZv3WUZPobK5hzf35rmb4k1C9UyVtVmWCosWdjtbKClBdvS Jg3jYJzL3aXF5OwcXDTgUg935H6B5OK8pnsSGGeDBP8gctT3GIC110b6sFSOU/saI9Eu9I IXgb8cBY4g33pFhi+bkmbOfCNMpRH4sI/C2lcIFyU2Wrbd0H9hiRV6F4GI85mzjaGzKeTG ksyUSVP1DuDZOxD8t5SXNb6Nyptx0TbOTifoX83HGcEIjdtA7HAssLt2M4n07g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675890307; a=rsa-sha256; cv=none; b=gnMgIzsZtfJimVZ7buGBvOeO9cISRVcf7PtUlYw71Unl9shBCAIETg0kw8MvXArNcQu4Iu 0vf39D9DXJZdahP7cLCGy7LZKtmQjCLDjGwdcH9R7rA3zu7gueb/fyS6YPvZN1o+b4W7qk N++K3Y5GyrvC/Mcf2MDMTZXvIMqrwzHUI9RFhwJflLDrU3R7SFo5ZEHIJ5GehBdjiK51kU GB2rqS46Z40e3ZehLVAkC+p6g++Ke1fLE9vWbbKFsevq4rkqRBmiuEFEXrIF1EF6ZmQS0e Ioeg1PVBHFjBMTXtZIL6tdtMTsz0GWIo1Vo2FV7tJPG7XCj+yaIPCfZujOXmxQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PBsvl3py6z1BLQ; Wed, 8 Feb 2023 21:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 318L57tO067611; Wed, 8 Feb 2023 21:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 318L57bd067610; Wed, 8 Feb 2023 21:05:07 GMT (envelope-from git) Date: Wed, 8 Feb 2023 21:05:07 GMT Message-Id: <202302082105.318L57bd067610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 04c6f6ce1b4d - stable/13 - blacklistd: diff reduction against upstream List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 04c6f6ce1b4d912d925aba0d0f5f0f1d03d9084a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=04c6f6ce1b4d912d925aba0d0f5f0f1d03d9084a commit 04c6f6ce1b4d912d925aba0d0f5f0f1d03d9084a Author: Ed Maste AuthorDate: 2023-01-23 16:19:46 +0000 Commit: Ed Maste CommitDate: 2023-02-08 21:04:36 +0000 blacklistd: diff reduction against upstream Add `conf_` prefix, maching https://github.com/zoulasc/blocklist Sponsored by: The FreeBSD Foundation (cherry picked from commit 8089749d38781946c008372f4016d69eee549f1c) --- contrib/blacklist/bin/conf.c | 54 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/contrib/blacklist/bin/conf.c b/contrib/blacklist/bin/conf.c index e2a45f80d787..f21dd8b05158 100644 --- a/contrib/blacklist/bin/conf.c +++ b/contrib/blacklist/bin/conf.c @@ -90,7 +90,7 @@ advance(char **p) } static int -getnum(const char *f, size_t l, bool local, void *rp, const char *name, +conf_getnum(const char *f, size_t l, bool local, void *rp, const char *name, const char *p) { int e; @@ -127,13 +127,14 @@ out: } static int -getnfail(const char *f, size_t l, bool local, struct conf *c, const char *p) +conf_getnfail(const char *f, size_t l, bool local, struct conf *c, + const char *p) { - return getnum(f, l, local, &c->c_nfail, "nfail", p); + return conf_getnum(f, l, local, &c->c_nfail, "nfail", p); } static int -getsecs(const char *f, size_t l, bool local, struct conf *c, const char *p) +conf_getsecs(const char *f, size_t l, bool local, struct conf *c, const char *p) { int e; char *ep; @@ -193,7 +194,7 @@ out: } static int -getport(const char *f, size_t l, bool local, void *r, const char *p) +conf_getport(const char *f, size_t l, bool local, void *r, const char *p) { struct servent *sv; @@ -207,11 +208,11 @@ getport(const char *f, size_t l, bool local, void *r, const char *p) return 0; } - return getnum(f, l, local, r, "service", p); + return conf_getnum(f, l, local, r, "service", p); } static int -getmask(const char *f, size_t l, bool local, const char **p, int *mask) +conf_getmask(const char *f, size_t l, bool local, const char **p, int *mask) { char *d; const char *s = *p; @@ -226,11 +227,12 @@ getmask(const char *f, size_t l, bool local, const char **p, int *mask) } *d++ = '\0'; - return getnum(f, l, local, mask, "mask", d); + return conf_getnum(f, l, local, mask, "mask", d); } static int -gethostport(const char *f, size_t l, bool local, struct conf *c, const char *p) +conf_gethostport(const char *f, size_t l, bool local, struct conf *c, + const char *p) { char *d; // XXX: Ok to write to string. in_port_t *port = NULL; @@ -249,7 +251,7 @@ gethostport(const char *f, size_t l, bool local, struct conf *c, const char *p) } else pstr = p; - if (getmask(f, l, local, &pstr, &c->c_lmask) == -1) + if (conf_getmask(f, l, local, &pstr, &c->c_lmask) == -1) goto out; if (d) { @@ -300,7 +302,7 @@ gethostport(const char *f, size_t l, bool local, struct conf *c, const char *p) } } - if (getport(f, l, local, &c->c_port, pstr) == -1) + if (conf_getport(f, l, local, &c->c_port, pstr) == -1) return -1; if (port && c->c_port != FSTAR && c->c_port != FEQUAL) @@ -320,7 +322,7 @@ out2: } static int -getproto(const char *f, size_t l, bool local __unused, struct conf *c, +conf_getproto(const char *f, size_t l, bool local __unused, struct conf *c, const char *p) { if (strcmp(p, "stream") == 0) { @@ -331,22 +333,22 @@ getproto(const char *f, size_t l, bool local __unused, struct conf *c, c->c_proto = IPPROTO_UDP; return 0; } - return getnum(f, l, local, &c->c_proto, "protocol", p); + return conf_getnum(f, l, local, &c->c_proto, "protocol", p); } static int -getfamily(const char *f, size_t l, bool local __unused, struct conf *c, +conf_getfamily(const char *f, size_t l, bool local __unused, struct conf *c, const char *p) { if (strncmp(p, "tcp", 3) == 0 || strncmp(p, "udp", 3) == 0) { c->c_family = p[3] == '6' ? AF_INET6 : AF_INET; return 0; } - return getnum(f, l, local, &c->c_family, "family", p); + return conf_getnum(f, l, local, &c->c_family, "family", p); } static int -getuid(const char *f, size_t l, bool local __unused, struct conf *c, +conf_getuid(const char *f, size_t l, bool local __unused, struct conf *c, const char *p) { struct passwd *pw; @@ -356,15 +358,15 @@ getuid(const char *f, size_t l, bool local __unused, struct conf *c, return 0; } - return getnum(f, l, local, &c->c_uid, "user", p); + return conf_getnum(f, l, local, &c->c_uid, "user", p); } static int -getname(const char *f, size_t l, bool local, struct conf *c, +conf_getname(const char *f, size_t l, bool local, struct conf *c, const char *p) { - if (getmask(f, l, local, &p, &c->c_rmask) == -1) + if (conf_getmask(f, l, local, &p, &c->c_rmask) == -1) return -1; if (strcmp(p, "*") == 0) { @@ -406,19 +408,19 @@ conf_parseline(const char *f, size_t l, char *p, struct conf *c, bool local) p++; memset(c, 0, sizeof(*c)); - e = getvalue(f, l, local, c, &p, gethostport); + e = getvalue(f, l, local, c, &p, conf_gethostport); if (e) return -1; - e = getvalue(f, l, local, c, &p, getproto); + e = getvalue(f, l, local, c, &p, conf_getproto); if (e) return -1; - e = getvalue(f, l, local, c, &p, getfamily); + e = getvalue(f, l, local, c, &p, conf_getfamily); if (e) return -1; - e = getvalue(f, l, local, c, &p, getuid); + e = getvalue(f, l, local, c, &p, conf_getuid); if (e) return -1; - e = getvalue(f, l, local, c, &p, getname); + e = getvalue(f, l, local, c, &p, conf_getname); if (e) return -1; - e = getvalue(f, l, local, c, &p, getnfail); + e = getvalue(f, l, local, c, &p, conf_getnfail); if (e) return -1; - e = getvalue(f, l, local, c, &p, getsecs); + e = getvalue(f, l, local, c, &p, conf_getsecs); if (e) return -1; return 0;