version 1.211.2.1, 2012/11/20 03:02:44 |
version 1.219, 2013/10/17 20:57:06 |
Line 416 socket_listener_cb(kauth_cred_t cred, ka |
|
Line 416 socket_listener_cb(kauth_cred_t cred, ka |
|
/* Normal users can only drop their own connections. */ |
/* Normal users can only drop their own connections. */ |
struct socket *so = (struct socket *)arg1; |
struct socket *so = (struct socket *)arg1; |
|
|
if (proc_uidmatch(cred, so->so_cred)) |
if (proc_uidmatch(cred, so->so_cred) == 0) |
result = KAUTH_RESULT_ALLOW; |
result = KAUTH_RESULT_ALLOW; |
|
|
break; |
break; |
Line 538 socreate(int dom, struct socket **aso, i |
|
Line 538 socreate(int dom, struct socket **aso, i |
|
lock = lockso->so_lock; |
lock = lockso->so_lock; |
so->so_lock = lock; |
so->so_lock = lock; |
mutex_obj_hold(lock); |
mutex_obj_hold(lock); |
|
/* XXX Why is this not solock, to match sounlock? */ |
mutex_enter(lock); |
mutex_enter(lock); |
} else { |
} else { |
/* Lock assigned and taken during PRU_ATTACH. */ |
/* Lock assigned and taken during PRU_ATTACH. */ |
Line 585 fsocreate(int domain, struct socket **so |
|
Line 586 fsocreate(int domain, struct socket **so |
|
fp->f_data = so; |
fp->f_data = so; |
fd_affix(curproc, fp, fd); |
fd_affix(curproc, fp, fd); |
*fdout = fd; |
*fdout = fd; |
|
if (flags & SOCK_NONBLOCK) |
|
so->so_state |= SS_NBIO; |
} |
} |
return error; |
return error; |
} |
} |
Line 874 sosend(struct socket *so, struct mbuf *a |
|
Line 877 sosend(struct socket *so, struct mbuf *a |
|
struct mbuf *control, int flags, struct lwp *l) |
struct mbuf *control, int flags, struct lwp *l) |
{ |
{ |
struct mbuf **mp, *m; |
struct mbuf **mp, *m; |
struct proc *p; |
|
long space, len, resid, clen, mlen; |
long space, len, resid, clen, mlen; |
int error, s, dontroute, atomic; |
int error, s, dontroute, atomic; |
short wakeup_state = 0; |
short wakeup_state = 0; |
|
|
p = l->l_proc; |
|
clen = 0; |
clen = 0; |
|
|
/* |
/* |
Line 926 sosend(struct socket *so, struct mbuf *a |
|
Line 927 sosend(struct socket *so, struct mbuf *a |
|
} |
} |
if ((so->so_state & SS_ISCONNECTED) == 0) { |
if ((so->so_state & SS_ISCONNECTED) == 0) { |
if (so->so_proto->pr_flags & PR_CONNREQUIRED) { |
if (so->so_proto->pr_flags & PR_CONNREQUIRED) { |
if ((so->so_state & SS_ISCONFIRMING) == 0 && |
if (resid || clen == 0) { |
!(resid == 0 && clen != 0)) { |
|
error = ENOTCONN; |
error = ENOTCONN; |
goto release; |
goto release; |
} |
} |
Line 1184 soreceive(struct socket *so, struct mbuf |
|
Line 1184 soreceive(struct socket *so, struct mbuf |
|
*/ |
*/ |
s = splsoftnet(); |
s = splsoftnet(); |
solock(so); |
solock(so); |
if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) |
|
(*pr->pr_usrreq)(so, PRU_RCVD, NULL, NULL, NULL, l); |
|
|
|
restart: |
restart: |
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0) { |
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0) { |
sounlock(so); |
sounlock(so); |
Line 1667 sorflush(struct socket *so) |
|
Line 1664 sorflush(struct socket *so) |
|
static int |
static int |
sosetopt1(struct socket *so, const struct sockopt *sopt) |
sosetopt1(struct socket *so, const struct sockopt *sopt) |
{ |
{ |
int error = EINVAL, optval, opt; |
int error = EINVAL, opt; |
|
int optval = 0; /* XXX: gcc */ |
struct linger l; |
struct linger l; |
struct timeval tv; |
struct timeval tv; |
|
|
Line 1909 sogetopt1(struct socket *so, struct sock |
|
Line 1907 sogetopt1(struct socket *so, struct sock |
|
#ifdef SO_OTIMESTAMP |
#ifdef SO_OTIMESTAMP |
case SO_OTIMESTAMP: |
case SO_OTIMESTAMP: |
#endif |
#endif |
|
case SO_ACCEPTCONN: |
error = sockopt_setint(sopt, (so->so_options & opt) ? 1 : 0); |
error = sockopt_setint(sopt, (so->so_options & opt) ? 1 : 0); |
break; |
break; |
|
|