summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/uipc_socket.c6
-rw-r--r--sys/kern/uipc_socket2.c3
-rw-r--r--sys/netinet/in_pcb.c7
-rw-r--r--sys/sys/socketvar.h4
4 files changed, 9 insertions, 11 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 6d0d9862a64..9cfe26d7f68 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.5 1996/08/14 07:26:21 deraadt Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.6 1996/08/24 04:56:36 deraadt Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -83,7 +83,7 @@ socreate(dom, aso, type, proto)
so->so_type = type;
if (p->p_ucred->cr_uid == 0)
so->so_state = SS_PRIV;
- so->so_ucred = crdup(p->p_ucred);
+ so->so_uid = p->p_ucred->cr_uid;
so->so_proto = prp;
error =
(*prp->pr_usrreq)(so, PRU_ATTACH, NULL, (struct mbuf *)(long)proto,
@@ -152,8 +152,6 @@ sofree(so)
}
sbrelease(&so->so_snd);
sorflush(so);
- if (so->so_ucred)
- crfree(so->so_ucred);
FREE(so, M_SOCKET);
}
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index b414175685f..66b22eb336e 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.2 1996/03/03 17:20:20 niklas Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.3 1996/08/24 04:56:37 deraadt Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -173,6 +173,7 @@ sonewconn1(head, connstatus)
so->so_proto = head->so_proto;
so->so_timeo = head->so_timeo;
so->so_pgid = head->so_pgid;
+ so->so_uid = head->so_uid;
(void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat);
soqinsque(head, so, soqueue);
if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH,
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index bfdff60f4ae..630a8282d7e 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.11 1996/08/05 01:17:25 deraadt Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.12 1996/08/24 04:56:39 deraadt Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -165,11 +165,10 @@ in_pcbbind(v, nam)
if (ntohs(lport) < IPPORT_RESERVED &&
(error = suser(p->p_ucred, &p->p_acflag)))
return (EACCES);
- if (so->so_ucred->cr_uid) {
+ if (so->so_uid) {
t = in_pcblookup(table, zeroin_addr, 0,
sin->sin_addr, lport, INPLOOKUP_WILDCARD);
- if (t && (so->so_ucred->cr_uid !=
- t->inp_socket->so_ucred->cr_uid))
+ if (t && (so->so_uid != t->inp_socket->so_uid))
return (EADDRINUSE);
}
t = in_pcblookup(table, zeroin_addr, 0,
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index d59c400bfe5..2b89eb987fa 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socketvar.h,v 1.6 1996/08/05 01:00:41 deraadt Exp $ */
+/* $OpenBSD: socketvar.h,v 1.7 1996/08/24 04:56:40 deraadt Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@@ -97,7 +97,7 @@ struct socket {
void *so_internal; /* Space for svr4 stream data */
void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf));
caddr_t so_upcallarg; /* Arg for above */
- struct ucred *so_ucred; /* who opened the socket */
+ uid_t so_uid; /* who opened the socket */
};
/*