priv: Use PRIV_NETINET_RESERVEDPORT
authorMichael Neumann <mneumann@ntecs.de>
Sun, 12 Jul 2009 16:33:52 +0000 (18:33 +0200)
committerMichael Neumann <mneumann@ntecs.de>
Sun, 12 Jul 2009 16:33:52 +0000 (18:33 +0200)
sys/kern/kern_jail.c
sys/netinet/in_pcb.c

index 4fd7e31..203a430 100644 (file)
@@ -699,6 +699,13 @@ prison_priv_check(struct ucred *cred, int priv)
                return (0);
 
                /*
+                * Allow jailed root to bind reserved ports.
+                */
+       case PRIV_NETINET_RESERVEDPORT:
+               return (0);
+
+
+               /*
                 * Conditionally allow creating raw sockets in jail.
                 */
        case PRIV_NETINET_RAW:
index d937d79..46da87e 100644 (file)
@@ -291,7 +291,7 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct thread *td)
 
                        /* GROSS */
                        if (ntohs(lport) < IPPORT_RESERVED &&
-                           cred && priv_check_cred(cred, PRIV_ROOT, PRISON_ROOT))
+                           cred && priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 0))
                                return (EACCES);
                        if (so->so_cred->cr_uid != 0 &&
                            !IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
@@ -349,7 +349,7 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct thread *td)
                        lastport = &pcbinfo->lasthi;
                } else if (inp->inp_flags & INP_LOWPORT) {
                        if (cred &&
-                           (error = priv_check_cred(cred, PRIV_ROOT, PRISON_ROOT))) {
+                           (error = priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT, 0))) {
                                inp->inp_laddr.s_addr = INADDR_ANY;
                                return (error);
                        }