patch-2.3.99-pre4 linux/net/sunrpc/xprt.c

Next file: linux/net/unix/af_unix.c
Previous file: linux/net/sunrpc/xdr.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre3/linux/net/sunrpc/xprt.c linux/net/sunrpc/xprt.c
@@ -48,6 +48,7 @@
 #include <linux/version.h>
 #include <linux/types.h>
 #include <linux/malloc.h>
+#include <linux/capability.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
@@ -227,7 +228,7 @@
 		 */
 		break;
 	case -EAGAIN:
-		if (sock->flags & SO_NOSPACE)
+		if (test_bit(SOCK_NOSPACE, &sock->flags))
 			result = -ENOMEM;
 		break;
 	case -ENOTCONN:
@@ -1569,8 +1570,8 @@
 		goto failed;
 	}
 
-	/* If the caller has root privs, bind to a reserved port */
-	if (!current->fsuid && xprt_bindresvport(sock) < 0)
+	/* If the caller has the capability, bind to a reserved port */
+	if (capable(CAP_NET_BIND_SERVICE) && xprt_bindresvport(sock) < 0)
 		goto failed;
 
 	return sock;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)