Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Use the socket credentials that are established duri...



details:   https://anonhg.NetBSD.org/src/rev/c2d51256001c
branches:  trunk
changeset: 970131:c2d51256001c
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Mar 13 16:37:12 2020 +0000

description:
Use the socket credentials that are established during the socket creation
instead of the current process credentials (which can change via
set{e,}{u,g}id(2)) and by passing the fd to a different process. This makes
the routing socket behave like other file descriptors. Proposed in tech-kern.

diffstat:

 sys/net/rtsock_shared.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r b0b9f94c6e8b -r c2d51256001c sys/net/rtsock_shared.c
--- a/sys/net/rtsock_shared.c   Fri Mar 13 16:25:19 2020 +0000
+++ b/sys/net/rtsock_shared.c   Fri Mar 13 16:37:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_shared.c,v 1.16 2020/03/12 19:36:33 christos Exp $      */
+/*     $NetBSD: rtsock_shared.c,v 1.17 2020/03/13 16:37:12 christos Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.16 2020/03/12 19:36:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.17 2020/03/13 16:37:12 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -703,10 +703,10 @@
        }
 
        /*
-        * Verify that the caller has the appropriate privilege; RTM_GET
+        * Verify that the socket has the appropriate privilege; RTM_GET
         * is the only operation the non-superuser is allowed.
         */
-       if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_ROUTE,
+       if (kauth_authorize_network(so->so_cred, KAUTH_NETWORK_ROUTE,
            0, rtm, NULL, NULL) != 0)
                senderr(EACCES);
 



Home | Main Index | Thread Index | Old Index