summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>1999-09-19 02:17:02 +0000
committergreen <green@FreeBSD.org>1999-09-19 02:17:02 +0000
commit4395e552e2eb08e6dc53ccf82bfcc4040c59bda6 (patch)
treedd4bc747543783e9e5ae654bb73c96623d75d2e9 /sys/netinet
parent7ab42b2253ccc67416479e053f47749a18e199df (diff)
downloadFreeBSD-src-4395e552e2eb08e6dc53ccf82bfcc4040c59bda6.zip
FreeBSD-src-4395e552e2eb08e6dc53ccf82bfcc4040c59bda6.tar.gz
Change so_cred's type to a ucred, not a pcred. THis makes more sense, actually.
Make a sonewconn3() which takes an extra argument (proc) so new sockets created with sonewconn() from a user's system call get the correct credentials, not just the parent's credentials.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c7
-rw-r--r--sys/netinet/ip_fw.c12
-rw-r--r--sys/netinet/tcp_subr.c6
-rw-r--r--sys/netinet/tcp_timewait.c6
-rw-r--r--sys/netinet/udp_usrreq.c6
5 files changed, 15 insertions, 22 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 162eaa3..018a040 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -202,7 +202,7 @@ in_pcbbind(inp, nam, p)
return (EACCES);
if (p && p->p_prison)
prison = 1;
- if (so->so_cred && so->so_cred->p_ruid != 0 &&
+ if (so->so_cred->cr_uid != 0 &&
!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
t = in_pcblookup_local(inp->inp_pcbinfo,
sin->sin_addr, lport,
@@ -212,9 +212,8 @@ in_pcbbind(inp, nam, p)
ntohl(t->inp_laddr.s_addr) != INADDR_ANY ||
(t->inp_socket->so_options &
SO_REUSEPORT) == 0) &&
- (t->inp_socket->so_cred) &&
- (so->so_cred->p_ruid !=
- t->inp_socket->so_cred->p_ruid))
+ (so->so_cred->cr_uid !=
+ t->inp_socket->so_cred->cr_uid))
return (EADDRINUSE);
}
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c
index fadb710..46c7d54 100644
--- a/sys/netinet/ip_fw.c
+++ b/sys/netinet/ip_fw.c
@@ -698,13 +698,13 @@ again:
P = in_pcblookup_hash(&tcbinfo, ip->ip_src,
tcp->th_sport, ip->ip_dst, tcp->th_dport, 0);
- if (P && P->inp_socket && P->inp_socket->so_cred) {
+ if (P && P->inp_socket) {
if (f->fw_flg & IP_FW_F_UID) {
- if (P->inp_socket->so_cred->p_ruid !=
+ if (P->inp_socket->so_cred->cr_uid !=
f->fw_uid)
continue;
} else if (!groupmember(f->fw_gid,
- P->inp_socket->so_cred->pc_ucred))
+ P->inp_socket->so_cred))
continue;
} else continue;
@@ -729,13 +729,13 @@ again:
P = in_pcblookup_hash(&udbinfo, ip->ip_src,
udp->uh_sport, ip->ip_dst, udp->uh_dport, 1);
- if (P && P->inp_socket && P->inp_socket->so_cred) {
+ if (P && P->inp_socket) {
if (f->fw_flg & IP_FW_F_UID) {
- if (P->inp_socket->so_cred->p_ruid !=
+ if (P->inp_socket->so_cred->cr_uid !=
f->fw_uid)
continue;
} else if (!groupmember(f->fw_gid,
- P->inp_socket->so_cred->pc_ucred))
+ P->inp_socket->so_cred))
continue;
} else continue;
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index a6a5270..07da954 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -641,13 +641,11 @@ tcp_getcred SYSCTL_HANDLER_ARGS
s = splnet();
inp = in_pcblookup_hash(&tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, 0);
- if (inp == NULL || inp->inp_socket == NULL ||
- inp->inp_socket->so_cred == NULL) {
+ if (inp == NULL || inp->inp_socket == NULL) {
error = ENOENT;
goto out;
}
- error = SYSCTL_OUT(req, inp->inp_socket->so_cred->pc_ucred,
- sizeof(struct ucred));
+ error = SYSCTL_OUT(req, inp->inp_socket->so_cred, sizeof(struct ucred));
out:
splx(s);
return (error);
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index a6a5270..07da954 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -641,13 +641,11 @@ tcp_getcred SYSCTL_HANDLER_ARGS
s = splnet();
inp = in_pcblookup_hash(&tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, 0);
- if (inp == NULL || inp->inp_socket == NULL ||
- inp->inp_socket->so_cred == NULL) {
+ if (inp == NULL || inp->inp_socket == NULL) {
error = ENOENT;
goto out;
}
- error = SYSCTL_OUT(req, inp->inp_socket->so_cred->pc_ucred,
- sizeof(struct ucred));
+ error = SYSCTL_OUT(req, inp->inp_socket->so_cred, sizeof(struct ucred));
out:
splx(s);
return (error);
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 337e796..44ff6ee 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -473,13 +473,11 @@ udp_getcred SYSCTL_HANDLER_ARGS
s = splnet();
inp = in_pcblookup_hash(&udbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, 1);
- if (inp == NULL || inp->inp_socket == NULL ||
- inp->inp_socket->so_cred == NULL) {
+ if (inp == NULL || inp->inp_socket == NULL) {
error = ENOENT;
goto out;
}
- error = SYSCTL_OUT(req, inp->inp_socket->so_cred->pc_ucred,
- sizeof(struct ucred));
+ error = SYSCTL_OUT(req, inp->inp_socket->so_cred, sizeof(struct ucred));
out:
splx(s);
return (error);
OpenPOWER on IntegriCloud