#include "core.h"
static u_int debug;
+static u_int gid;
+kgid_t misdn_permitted_gid;
MODULE_AUTHOR("Karsten Keil");
MODULE_LICENSE("GPL");
module_param(debug, uint, S_IRUGO | S_IWUSR);
+module_param(gid, uint, 0);
+MODULE_PARM_DESC(gid, "Unix group for accessing misdn socket (default 0)");
static u64 device_ids;
#define MAX_DEVICE_ID 63
{
int err;
+ misdn_permitted_gid = make_kgid(current_user_ns(), gid);
+
printk(KERN_INFO "Modular ISDN core version %d.%d.%d\n",
MISDN_MAJOR_VERSION, MISDN_MINOR_VERSION, MISDN_RELEASE);
mISDN_init_clock(&debug);
extern struct mISDNdevice *get_mdevice(u_int);
extern int get_mdevice_count(void);
+extern kgid_t misdn_permitted_gid;
/* stack status flag */
#define mISDN_STACK_ACTION_MASK 0x0000ffff
{
struct sock *sk;
+ if (!capable(CAP_SYS_ADMIN) &&
+ !gid_eq(misdn_permitted_gid, current_gid()) &&
+ !in_group_p(misdn_permitted_gid))
+ return -EPERM;
+
if (sock->type != SOCK_DGRAM)
return -ESOCKTNOSUPPORT;
case IMSETDEVNAME:
{
struct mISDN_devrename dn;
+ if (!capable(CAP_SYS_ADMIN) &&
+ !gid_eq(misdn_permitted_gid, current_gid()) &&
+ !in_group_p(misdn_permitted_gid))
+ return -EPERM;
if (copy_from_user(&dn, (void __user *)arg,
sizeof(dn))) {
err = -EFAULT;