Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/blacklist Revert allowing fd == -1 at the reque...
details: https://anonhg.NetBSD.org/src/rev/6999fb0d774f
branches: trunk
changeset: 970086:6999fb0d774f
user: roy <roy%NetBSD.org@localhost>
date: Thu Mar 12 11:31:23 2020 +0000
description:
Revert allowing fd == -1 at the request of Christos.
diffstat:
external/bsd/blacklist/bin/blacklistd.c | 16 +++++++---------
external/bsd/blacklist/bin/conf.c | 13 ++-----------
external/bsd/blacklist/lib/bl.c | 32 +++++++++++++++-----------------
3 files changed, 24 insertions(+), 37 deletions(-)
diffs (151 lines):
diff -r 15a7ccd0192d -r 6999fb0d774f external/bsd/blacklist/bin/blacklistd.c
--- a/external/bsd/blacklist/bin/blacklistd.c Thu Mar 12 10:44:00 2020 +0000
+++ b/external/bsd/blacklist/bin/blacklistd.c Thu Mar 12 11:31:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistd.c,v 1.42 2020/03/11 02:33:18 roy Exp $ */
+/* $NetBSD: blacklistd.c,v 1.43 2020/03/12 11:31:23 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.42 2020/03/11 02:33:18 roy Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.43 2020/03/12 11:31:23 roy Exp $");
#include <sys/types.h>
#include <sys/socket.h>
@@ -119,14 +119,12 @@
*rsl = sizeof(*rss);
memset(rss, 0, *rsl);
- if (bi->bi_fd != -1) {
- if (getpeername(bi->bi_fd, (void *)rss, rsl) != -1)
- return 0;
+ if (getpeername(bi->bi_fd, (void *)rss, rsl) != -1)
+ return 0;
- if (errno != ENOTCONN) {
- (*lfun)(LOG_ERR, "getpeername failed (%m)");
- return -1;
- }
+ if (errno != ENOTCONN) {
+ (*lfun)(LOG_ERR, "getpeername failed (%m)");
+ return -1;
}
if (bi->bi_slen == 0) {
diff -r 15a7ccd0192d -r 6999fb0d774f external/bsd/blacklist/bin/conf.c
--- a/external/bsd/blacklist/bin/conf.c Thu Mar 12 10:44:00 2020 +0000
+++ b/external/bsd/blacklist/bin/conf.c Thu Mar 12 11:31:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.27 2020/03/11 02:12:08 roy Exp $ */
+/* $NetBSD: conf.c,v 1.28 2020/03/12 11:31:23 roy Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: conf.c,v 1.27 2020/03/11 02:12:08 roy Exp $");
+__RCSID("$NetBSD: conf.c,v 1.28 2020/03/12 11:31:23 roy Exp $");
#include <stdio.h>
#ifdef HAVE_LIBUTIL_H
@@ -1009,14 +1009,6 @@
char buf[BUFSIZ];
memset(cr, 0, sizeof(*cr));
-
- if (fd == -1) {
- cr->c_proto = FSTAR;
- cr->c_port = FSTAR;
- memcpy(&lss, rss, sizeof(lss));
- goto done_fd;
- }
-
slen = sizeof(lss);
memset(&lss, 0, slen);
if (getsockname(fd, (void *)&lss, &slen) == -1) {
@@ -1059,7 +1051,6 @@
return NULL;
}
-done_fd:
cr->c_ss = lss;
cr->c_lmask = FSTAR;
cr->c_uid = (int)uid;
diff -r 15a7ccd0192d -r 6999fb0d774f external/bsd/blacklist/lib/bl.c
--- a/external/bsd/blacklist/lib/bl.c Thu Mar 12 10:44:00 2020 +0000
+++ b/external/bsd/blacklist/lib/bl.c Thu Mar 12 11:31:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bl.c,v 1.30 2020/03/11 02:12:08 roy Exp $ */
+/* $NetBSD: bl.c,v 1.31 2020/03/12 11:31:23 roy Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: bl.c,v 1.30 2020/03/11 02:12:08 roy Exp $");
+__RCSID("$NetBSD: bl.c,v 1.31 2020/03/12 11:31:23 roy Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -384,6 +384,7 @@
if (bl_getsock(b, &ub.bl.bl_ss, sa, slen, ctx) == -1)
return -1;
+
ub.bl.bl_salen = slen;
memcpy(ub.bl.bl_data, ctx, ctxlen);
@@ -393,17 +394,15 @@
msg.msg_iovlen = 1;
msg.msg_flags = 0;
- if (pfd != -1) {
- msg.msg_control = ua.ctrl;
- msg.msg_controllen = sizeof(ua.ctrl);
+ msg.msg_control = ua.ctrl;
+ msg.msg_controllen = sizeof(ua.ctrl);
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(int));
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
- memcpy(CMSG_DATA(cmsg), &pfd, sizeof(pfd));
- }
+ memcpy(CMSG_DATA(cmsg), &pfd, sizeof(pfd));
tried = 0;
again:
@@ -495,15 +494,14 @@
}
- if (!(got & GOT_FD))
- bi->bi_fd = -1;
-
+ if (got != (GOT_CRED|GOT_FD)) {
+ bl_log(b->b_fun, LOG_ERR, "message missing %s %s",
#if GOT_CRED != 0
- if (!(got & GOT_CRED)) {
- bl_log(b->b_fun, LOG_ERR, "message missing cred");
+ (got & GOT_CRED) == 0 ? "cred" :
+#endif
+ "", (got & GOT_FD) == 0 ? "fd" : "");
return NULL;
}
-#endif
if ((size_t)rlen <= sizeof(ub.bl)) {
bl_log(b->b_fun, LOG_ERR, "message too short %zd", rlen);
Home |
Main Index |
Thread Index |
Old Index