summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-12-13 22:09:37 +0000
committerrwatson <rwatson@FreeBSD.org>2001-12-13 22:09:37 +0000
commit36784fd2c4f908d39e9ed1d9454f22f8aea9d928 (patch)
treef3180d6ad4d9ffb0336175cb52ae402c484c23ca /sys/kern
parent7460365e6c74248431b9510c0e596e3ed2b0c166 (diff)
downloadFreeBSD-src-36784fd2c4f908d39e9ed1d9454f22f8aea9d928.zip
FreeBSD-src-36784fd2c4f908d39e9ed1d9454f22f8aea9d928.tar.gz
o Back out portions of 1.50 and 1.47, eliminating sonewconn3() and
always deriving the credential for a newly accepted connection from the listen socket. Previously, the selection of the credential depended on the protocol: UNIX domain sockets would use the connecting process's credential, and protocols supporting a creation of the socket before the receiving end called accept() would use the listening socket. After this change, it is always the listening credential. Reviewed by: green
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_sockbuf.c15
-rw-r--r--sys/kern/uipc_socket2.c15
-rw-r--r--sys/kern/uipc_usrreq.c2
3 files changed, 3 insertions, 29 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index 122fcda..ae6ba02 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -218,16 +218,6 @@ sonewconn(head, connstatus)
register struct socket *head;
int connstatus;
{
-
- return (sonewconn3(head, connstatus, NULL));
-}
-
-struct socket *
-sonewconn3(head, connstatus, td)
- register struct socket *head;
- int connstatus;
- struct thread *td;
-{
register struct socket *so;
if (head->so_qlen > 3 * head->so_qlimit / 2)
@@ -242,10 +232,7 @@ sonewconn3(head, connstatus, td)
so->so_state = head->so_state | SS_NOFDREF;
so->so_proto = head->so_proto;
so->so_timeo = head->so_timeo;
- if (td != NULL)
- so->so_cred = crhold(td->td_proc->p_ucred);
- else
- so->so_cred = crhold(head->so_cred);
+ so->so_cred = crhold(head->so_cred);
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) ||
(*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
sotryfree(so);
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 122fcda..ae6ba02 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -218,16 +218,6 @@ sonewconn(head, connstatus)
register struct socket *head;
int connstatus;
{
-
- return (sonewconn3(head, connstatus, NULL));
-}
-
-struct socket *
-sonewconn3(head, connstatus, td)
- register struct socket *head;
- int connstatus;
- struct thread *td;
-{
register struct socket *so;
if (head->so_qlen > 3 * head->so_qlimit / 2)
@@ -242,10 +232,7 @@ sonewconn3(head, connstatus, td)
so->so_state = head->so_state | SS_NOFDREF;
so->so_proto = head->so_proto;
so->so_timeo = head->so_timeo;
- if (td != NULL)
- so->so_cred = crhold(td->td_proc->p_ucred);
- else
- so->so_cred = crhold(head->so_cred);
+ so->so_cred = crhold(head->so_cred);
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) ||
(*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
sotryfree(so);
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 0cd408f..a7ffcff 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -691,7 +691,7 @@ unp_connect(so, nam, td)
}
if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
if ((so2->so_options & SO_ACCEPTCONN) == 0 ||
- (so3 = sonewconn3(so2, 0, td)) == 0) {
+ (so3 = sonewconn(so2, 0)) == 0) {
error = ECONNREFUSED;
goto bad;
}
OpenPOWER on IntegriCloud