summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-01-27 20:31:43 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-01-27 20:31:43 +0000
commit686e00b474f699736f663a74e686f81d072f52e4 (patch)
tree3a902cd20f43012198c6e14abe2d86e4171dfcf0 /sys
parent80bae4299d7c1cbc29584b6c59f855bad62f38b3 (diff)
In sosend() the size of the control message for file descriptor
passing is checked. As the data type has changed in unp_internalize(), the calculation has to be adapted in sosend(). Found by relayd regress test on i386. OK millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c4
-rw-r--r--sys/kern/uipc_usrreq.c7
-rw-r--r--sys/sys/unpcb.h7
3 files changed, 9 insertions, 9 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 10f82b9d272..0c3171a8187 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.174 2017/01/26 00:08:50 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.175 2017/01/27 20:31:42 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -415,7 +415,7 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
mtod(control, struct cmsghdr *)->cmsg_type == SCM_RIGHTS)
clen = CMSG_SPACE(
(clen - CMSG_ALIGN(sizeof(struct cmsghdr))) *
- (sizeof(struct file *) / sizeof(int)));
+ (sizeof(struct fdpass) / sizeof(int)));
}
#define snderr(errno) { error = errno; NET_UNLOCK(s); goto release; }
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 40c9b99bdb2..7ecafb4e600 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.112 2017/01/25 06:15:50 mpi Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.113 2017/01/27 20:31:42 bluhm Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -56,11 +56,6 @@ void uipc_setaddr(const struct unpcb *, struct mbuf *);
/* list of all UNIX domain sockets, for unp_gc() */
LIST_HEAD(unp_head, unpcb) unp_head = LIST_HEAD_INITIALIZER(unp_head);
-struct fdpass {
- struct file *fp;
- int flags;
-};
-
/*
* Stack of sets of files that were passed over a socket but were
* not received and need to be closed.
diff --git a/sys/sys/unpcb.h b/sys/sys/unpcb.h
index b4488e0ebe2..4213297d47a 100644
--- a/sys/sys/unpcb.h
+++ b/sys/sys/unpcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unpcb.h,v 1.13 2017/01/23 23:44:04 deraadt Exp $ */
+/* $OpenBSD: unpcb.h,v 1.14 2017/01/27 20:31:42 bluhm Exp $ */
/* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
/*
@@ -86,6 +86,11 @@ struct unpcb {
#define sotounpcb(so) ((struct unpcb *)((so)->so_pcb))
#ifdef _KERNEL
+struct fdpass {
+ struct file *fp;
+ int flags;
+};
+
int unp_attach(struct socket *);
int unp_bind(struct unpcb *, struct mbuf *, struct proc *);
int unp_connect(struct socket *, struct mbuf *, struct proc *);