Surely anonymous sockets shouldn't get bound to port numbers less
than 1024 (i.e. PROT_SOCK)? The kernel patch I made was a bit wrong
though. Instead of
if (prot_sock_ok)
return prot_sock_ok(AF_INET, snum);
if (snum < PROT_SOCK && !suser())
return(-EACCES);
it should be
if (snum < PROT_SOCK) {
if (prot_sock_ok) {
int err = prot_sock_ok(AF_INET, snum);
if (err)
return err;
} else if (!suser())
return(-EACCES);
}
}
I've checked 2.0.30 and it changed the lines preceding the
above from
if (snum == 0)
snum = get_new_socknum(sk->prot, 0);
to
if (snum == 0)
snum = sk->prot->good_socknum();
That will probably stop the patch from applying automatically but
appending the above "if (snum < PROT_SOCK) { ... }" block manually
should be fine.
Note that if anyone wants to try out the sockfs filesystem without
applying the kernel patch, you can build sockfs with -DSTANDALONE
and it'll provide a dummy prot_sock_ok pointer so that it links OK.
You can then mount and try out the filesystem: it's just the kernel
won't take any notice of its permission contents when doing a bind().
--Malcolm
-- Malcolm Beattie <mbeattie@sable.ox.ac.uk> Unix Systems Programmer Oxford University Computing Services