aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2001-12-13 22:09:37 +0000
committerRobert Watson <rwatson@FreeBSD.org>2001-12-13 22:09:37 +0000
commitf8cf411e494fff9bf8b3f5a16383cd48df5344c1 (patch)
treef3180d6ad4d9ffb0336175cb52ae402c484c23ca
parentd337b6b915179020db08e48844cd030eb77c435c (diff)
downloadsrc-f8cf411e494fff9bf8b3f5a16383cd48df5344c1.tar.gz
src-f8cf411e494fff9bf8b3f5a16383cd48df5344c1.zip
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
Notes
Notes: svn path=/head/; revision=87821
-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 122fcda00d81..ae6ba020dfa8 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 122fcda00d81..ae6ba020dfa8 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 0cd408f1e45b..a7ffcff77820 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;
}