| Summary: | identd does not return usernames while running under a jail. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | mayres <mayres> |
| Component: | misc | Assignee: | dwmalone |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | mayres |
| Priority: | Normal | ||
| Version: | 4.3-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
mayres
2001-06-12 21:10:01 UTC
State Changed From-To: open->closed That's a feature, not a bug. Responsible Changed From-To: freebsd-bugs->dwmalone I'll have a look at this. .. State Changed From-To: closed->open DES and I have worked out a way of allowing ident in a jail using the socket's credentials and Robert Watson's u_cansee code. The (untested) patch below is intended to have the following semantics: 1) A unjailed getcred caller can get the creds for any socket. 2) A jailed getcred caller can only get the creds for a socket if that socket was created by a process in the same jail. I'll forward the patch to -audit with more details. David. --- tcp_subr.c.orig Thu Jun 14 13:46:01 2001 +++ tcp_subr.c Thu Jun 14 13:52:24 2001 @@ -880,7 +880,7 @@ struct inpcb *inp; int error, s; - error = suser(req->p); + error = suser_xxx(0, req->p, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -893,6 +893,9 @@ error = ENOENT; goto out; } + error = u_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + if (error) + goto out; bzero(&xuc, sizeof(xuc)); xuc.cr_uid = inp->inp_socket->so_cred->cr_uid; xuc.cr_ngroups = inp->inp_socket->so_cred->cr_ngroups; @@ -916,7 +919,7 @@ struct inpcb *inp; int error, s, mapped = 0; - error = suser(req->p); + error = suser_xxx(0, req->p, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -945,6 +948,9 @@ error = ENOENT; goto out; } + error = u_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + if (error) + goto out; bzero(&xuc, sizeof(xuc)); xuc.cr_uid = inp->inp_socket->so_cred->cr_uid; xuc.cr_ngroups = inp->inp_socket->so_cred->cr_ngroups; State Changed From-To: open->closed The getcred sysctl calls have been made work within jails in -current. Unfortunately merging this to -stable would involve a significant merging of Robert Watson's work on credentials which is probably too large a change for -stable. |