uipc_socket.c (84472) | uipc_socket.c (84527) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 |
34 * $FreeBSD: head/sys/kern/uipc_socket.c 84472 2001-10-04 13:11:48Z dwmalone $ | 34 * $FreeBSD: head/sys/kern/uipc_socket.c 84527 2001-10-05 07:06:32Z ps $ |
35 */ 36 37#include "opt_inet.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/fcntl.h> 42#include <sys/lock.h> --- 44 unchanged lines hidden (view full) --- 87MALLOC_DEFINE(M_PCB, "pcb", "protocol control block"); 88 89SYSCTL_DECL(_kern_ipc); 90 91static int somaxconn = SOMAXCONN; 92SYSCTL_INT(_kern_ipc, KIPC_SOMAXCONN, somaxconn, CTLFLAG_RW, 93 &somaxconn, 0, "Maximum pending socket connection queue size"); 94 | 35 */ 36 37#include "opt_inet.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/fcntl.h> 42#include <sys/lock.h> --- 44 unchanged lines hidden (view full) --- 87MALLOC_DEFINE(M_PCB, "pcb", "protocol control block"); 88 89SYSCTL_DECL(_kern_ipc); 90 91static int somaxconn = SOMAXCONN; 92SYSCTL_INT(_kern_ipc, KIPC_SOMAXCONN, somaxconn, CTLFLAG_RW, 93 &somaxconn, 0, "Maximum pending socket connection queue size"); 94 |
95int showallsockets = 1; 96SYSCTL_INT(_kern_ipc, OID_AUTO, showallsockets, CTLFLAG_RW, &showallsockets, 97 0, "show users all other users pcb data"); 98 |
|
95/* 96 * Socket operation routines. 97 * These routines are called by the routines in 98 * sys_socket.c or from a system process, and 99 * implement the semantics of socket operations by 100 * switching out to the protocol specific routines. 101 */ 102 --- 1536 unchanged lines hidden (view full) --- 1639static int 1640filt_solisten(struct knote *kn, long hint) 1641{ 1642 struct socket *so = (struct socket *)kn->kn_fp->f_data; 1643 1644 kn->kn_data = so->so_qlen - so->so_incqlen; 1645 return (! TAILQ_EMPTY(&so->so_comp)); 1646} | 99/* 100 * Socket operation routines. 101 * These routines are called by the routines in 102 * sys_socket.c or from a system process, and 103 * implement the semantics of socket operations by 104 * switching out to the protocol specific routines. 105 */ 106 --- 1536 unchanged lines hidden (view full) --- 1643static int 1644filt_solisten(struct knote *kn, long hint) 1645{ 1646 struct socket *so = (struct socket *)kn->kn_fp->f_data; 1647 1648 kn->kn_data = so->so_qlen - so->so_incqlen; 1649 return (! TAILQ_EMPTY(&so->so_comp)); 1650} |
1651 1652int 1653socheckuid(struct socket *so, uid_t uid) 1654{ 1655 1656 if (so == NULL) 1657 return (EPERM); 1658 if (so->so_cred->cr_uid == uid) 1659 return (0); 1660 return (EPERM); 1661} 1662 1663int 1664socheckproc(struct socket *so, struct proc *p) 1665{ 1666 1667 if (p == NULL) 1668 return (ESRCH); 1669 if (socheckuid(so, p->p_ucred->cr_ruid) == 0) 1670 return (0); 1671 if (socheckuid(so, p->p_ucred->cr_uid) == 0) 1672 return (0); 1673 if (!suser_xxx(0, p, PRISON_ROOT)) 1674 return (0); 1675 return (EPERM); 1676} |
|