patch-2.4.0-test8 linux/net/netrom/af_netrom.c
Next file: linux/net/netsyms.c
Previous file: linux/net/ipv6/sit.c
Back to the patch index
Back to the overall index
- Lines: 88
- Date:
Mon Aug 28 21:16:05 2000
- Orig file:
v2.4.0-test7/linux/net/netrom/af_netrom.c
- Orig date:
Thu May 11 15:30:08 2000
diff -u --recursive --new-file v2.4.0-test7/linux/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c
@@ -30,6 +30,7 @@
* Jonathan(G4KLX) Removed hdrincl.
* NET/ROM 007 Jonathan(G4KLX) New timer architecture.
* Impmented Idle timer.
+ * Arnaldo C. Melo s/suser/capable/, micro cleanups
*/
#include <linux/config.h>
@@ -437,10 +438,7 @@
if (put_user(len, optlen))
return -EFAULT;
- if (copy_to_user(optval, &val, len))
- return -EFAULT;
-
- return 0;
+ return copy_to_user(optval, &val, len) ? -EFAULT : 0;
}
static int nr_listen(struct socket *sock, int backlog)
@@ -616,7 +614,7 @@
* Only the super user can set an arbitrary user callsign.
*/
if (addr->fsa_ax25.sax25_ndigis == 1) {
- if (!suser())
+ if (!capable(CAP_NET_BIND_SERVICE))
return -EACCES;
sk->protinfo.nr->user_addr = addr->fsa_digipeater[0];
sk->protinfo.nr->source_addr = addr->fsa_ax25.sax25_call;
@@ -624,7 +622,7 @@
source = &addr->fsa_ax25.sax25_call;
if ((user = ax25_findbyuid(current->euid)) == NULL) {
- if (ax25_uid_policy && !suser())
+ if (ax25_uid_policy && !capable(CAP_NET_BIND_SERVICE))
return -EPERM;
user = source;
}
@@ -680,7 +678,7 @@
source = (ax25_address *)dev->dev_addr;
if ((user = ax25_findbyuid(current->euid)) == NULL) {
- if (ax25_uid_policy && !suser())
+ if (ax25_uid_policy && !capable(CAP_NET_ADMIN))
return -EPERM;
user = source;
}
@@ -1111,9 +1109,7 @@
amount = sk->sndbuf - atomic_read(&sk->wmem_alloc);
if (amount < 0)
amount = 0;
- if (put_user(amount, (int *)arg))
- return -EFAULT;
- return 0;
+ return put_user(amount, (int *)arg);
}
case TIOCINQ: {
@@ -1122,18 +1118,14 @@
/* These two are safe on a single CPU system as only user tasks fiddle here */
if ((skb = skb_peek(&sk->receive_queue)) != NULL)
amount = skb->len;
- if (put_user(amount, (int *)arg))
- return -EFAULT;
- return 0;
+ return put_user(amount, (int *)arg);
}
case SIOCGSTAMP:
if (sk != NULL) {
if (sk->stamp.tv_sec == 0)
return -ENOENT;
- if (copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)))
- return -EFAULT;
- return 0;
+ return copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)) ? -EFAULT : 0;
}
return -EINVAL;
@@ -1152,7 +1144,7 @@
case SIOCADDRT:
case SIOCDELRT:
case SIOCNRDECOBS:
- if (!suser()) return -EPERM;
+ if (!capable(CAP_NET_ADMIN)) return -EPERM;
return nr_rt_ioctl(cmd, (void *)arg);
default:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)