AF_UNIX sockets problem (+ solution patch)

From: Ingo Rohloff (lundril@gmx.net)
Date: Thu Mar 09 2000 - 11:36:44 EST


Hi,

I just noticed that since 2.3.50 it is not possible
to create an AF_UNIX socket as "normal" user.

You have to be superuser to "bind" the socket to
a file/inode.

The reason is the change in "linux/fs/namei.c" and
the recently introduced routine "vfs_mknod(...)".

This routine allows to create a socket only if
CAP_MKNOD is set.

a possible patch/fix:

-----------------snip ------------------------------------
--- linux/fs/namei_old.c Thu Mar 9 16:29:33 2000
+++ linux/fs/namei.c Thu Mar 9 16:11:37 2000
@@ -745,7 +745,7 @@
 
         mode &= ~current->fs->umask;
 
- if (!S_ISFIFO(mode) && !capable(CAP_MKNOD))
+ if (!S_ISFIFO(mode) && !S_ISSOCK(mode) && !capable(CAP_MKNOD))
                 goto exit_lock;
 
         error = may_create(dir, dentry);
----------------snip--------------------------------------

With this patch everyone can create AF_UNIX sockets
(and I think this is the wanted behaviour, isn't it ?)

so long
  Ingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:15 EST