version 1.212, 2012/10/08 19:20:45 |
version 1.217, 2013/08/29 17:49:21 |
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); |