Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add native issetugid() call.



details:   https://anonhg.NetBSD.org/src/rev/8618114dee26
branches:  trunk
changeset: 485179:8618114dee26
user:      minoura <minoura%NetBSD.org@localhost>
date:      Fri Apr 21 16:15:39 2000 +0000

description:
Add native issetugid() call.
Implementation from compat/freebsd.

diffstat:

 sys/kern/kern_prot.c     |  20 +++++++++++++++++++-
 sys/kern/syscalls.master |   3 ++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 76320018a6d8 -r 8618114dee26 sys/kern/kern_prot.c
--- a/sys/kern/kern_prot.c      Fri Apr 21 16:05:50 2000 +0000
+++ b/sys/kern/kern_prot.c      Fri Apr 21 16:15:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_prot.c,v 1.56 2000/03/30 09:27:12 augustss Exp $  */
+/*     $NetBSD: kern_prot.c,v 1.57 2000/04/21 16:15:39 minoura Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@@ -505,6 +505,24 @@
        return (0);
 }
 
+int
+sys_issetugid(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       /*
+        * Note: OpenBSD sets a P_SUGIDEXEC flag set at execve() time,
+        * we use P_SUGID because we consider changing the owners as
+        * "tainting" as well.
+        * This is significant for procs that start as root and "become"
+        * a user without an exec - programs cannot know *everything*
+        * that libc *might* have put in their data segment.
+        */
+       *retval = (p->p_flag & P_SUGID) != 0;
+       return 0;
+}
+
 /* ARGSUSED */
 int
 sys_setgroups(p, v, retval)
diff -r 76320018a6d8 -r 8618114dee26 sys/kern/syscalls.master
--- a/sys/kern/syscalls.master  Fri Apr 21 16:05:50 2000 +0000
+++ b/sys/kern/syscalls.master  Fri Apr 21 16:15:39 2000 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.100 2000/04/17 14:31:22 mrg Exp $
+       $NetBSD: syscalls.master,v 1.101 2000/04/21 16:15:39 minoura Exp $
 
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
 
@@ -584,3 +584,4 @@
 303    EXCL            __shmctl13
 #endif
 304    STD             { int sys_lchflags(const char *path, u_long flags); }
+305    STD             { int sys_issetugid(void); }



Home | Main Index | Thread Index | Old Index