[lkml]   [2000]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] Ownership of sockets 2.4.0-test2
On Thu, Jul 06, 2000 at 06:43:15PM +0100, Alan Cox wrote:
> It gets the right owner. The socket is owned by root. You are adding
> a hideous hack. If you must mess with this then it probably makes more sense
> to think about fchown() semantics on sockets

I've just taken a timeout from my temporary braindamage!

As you say, sock_alloc is not the right place. But I don't
see any way other than specifically checking if it is a
local or non-local socket. The attached patch moves it
into sock_create (and removes some of the other
braindamage too). It's much nicer (patch attached).

The thing that puzzles me, is that you don't think it's a bug.
It is of course root that eg. owns an rlogin connection, but
shouldn't identd and netstat have the possibility of reporting
the users uid somehow? The identd in particular.

PS: Are you thinking about fchown as something an suid-root
application should do?

diff -urN linux-2.4.0-test2/net/socket.c linux/net/socket.c
--- linux-2.4.0-test2/net/socket.c Wed Jun 21 19:10:02 2000
+++ linux/net/socket.c Thu Jul 6 21:45:55 2000
@@ -818,6 +818,13 @@

sock->type = type;

+ if ((domain != PF_LOCAL) &&
+ (domain != PF_UNIX) &&
+ sock->inode) { /* is this needed? */
+ sock->inode->i_uid = current->uid;
+ sock->inode->i_gid = current->gid;
+ }
if ((i = net_families[family]->create(sock, protocol)) < 0)
 \ /
  Last update: 2005-03-22 13:57    [W:0.070 / U:3.160 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site