summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-25 09:51:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-25 09:51:48 +0000
commitb941f8023c9dff5757c71d9dbe3983346eb575ef (patch)
treee42996cf39be1a557cf3c843517612a175dfbc02
parenteb4a0a442351491de444491546bb3b4cb1c9b6aa (diff)
issetugid() system call discovers if a process was started setuid or setgid
-rw-r--r--sys/kern/kern_prot.c14
-rw-r--r--sys/kern/syscalls.master3
-rw-r--r--sys/sys/proc.h3
3 files changed, 17 insertions, 3 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index fe386801da0..9944ce1958d 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_prot.c,v 1.3 1996/08/01 05:26:02 tholo Exp $ */
+/* $OpenBSD: kern_prot.c,v 1.4 1996/08/25 09:51:37 deraadt Exp $ */
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
/*
@@ -127,6 +127,18 @@ sys_geteuid(p, v, retval)
/* ARGSUSED */
int
+sys_issetugid(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ if (p->p_flag & P_SUGIDEXEC)
+ return (1);
+ return (0);
+}
+
+/* ARGSUSED */
+int
sys_getgid(p, v, retval)
struct proc *p;
void *v;
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index c1767a2de19..3f259eed8b6 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.9 1996/05/18 08:53:10 deraadt Exp $
+ $OpenBSD: syscalls.master,v 1.10 1996/08/25 09:51:34 deraadt Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -455,3 +455,4 @@
251 STD { int sys_rfork(int flags); }
252 STD { int sys_poll(struct pollfd *fds, unsigned long nfds, \
int timeout); }
+253 STD { int sys_issetugid(void); }
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 2641c1b87bf..cd9c3d1ce2a 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.8 1996/05/28 12:16:27 deraadt Exp $ */
+/* $OpenBSD: proc.h,v 1.9 1996/08/25 09:51:47 deraadt Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -231,6 +231,7 @@ struct proc {
/* XXX Not sure what to do with these, yet. */
#define P_FSTRACE 0x10000 /* tracing via file system (elsewhere?) */
#define P_SSTEP 0x20000 /* process needs single-step fixup ??? */
+#define P_SUGIDEXEC 0x40000 /* last execve() was a setuid/setgid execve() */
/*
* MOVE TO ucred.h?