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/de2a0eb658e1
branches:  trunk
changeset: 1008166:de2a0eb658e1
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 91111b94891a -r de2a0eb658e1 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