Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-1]: src/sys/kern Apply patch (requested by dan in ticket #5955):
details: https://anonhg.NetBSD.org/src/rev/ffd734f16f74
branches: netbsd-2-1
changeset: 564111:ffd734f16f74
user: tron <tron%NetBSD.org@localhost>
date: Mon Oct 31 21:00:23 2005 +0000
description:
Apply patch (requested by dan in ticket #5955):
Don't clear unconditionally P_SUGID when we exec. Clear it only when
the real and effective user and group ids match. From Tavis Ormandy.
diffstat:
sys/kern/kern_exec.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (32 lines):
diff -r 26f3332a6052 -r ffd734f16f74 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Mon Oct 31 13:37:12 2005 +0000
+++ b/sys/kern/kern_exec.c Mon Oct 31 21:00:23 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.185.2.2 2004/06/27 13:33:52 he Exp $ */
+/* $NetBSD: kern_exec.c,v 1.185.2.2.4.1 2005/10/31 21:00:23 tron Exp $ */
/*-
* Copyright (C) 1993, 1994, 1996 Christopher G. Demetriou
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.185.2.2 2004/06/27 13:33:52 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.185.2.2.4.1 2005/10/31 21:00:23 tron Exp $");
#include "opt_ktrace.h"
#include "opt_syscall_debug.h"
@@ -739,8 +739,11 @@
p->p_ucred->cr_uid = attr.va_uid;
if (attr.va_mode & S_ISGID)
p->p_ucred->cr_gid = attr.va_gid;
- } else
- p->p_flag &= ~P_SUGID;
+ } else {
+ if (p->p_ucred->cr_uid == p->p_cred->p_ruid &&
+ p->p_ucred->cr_gid == p->p_cred->p_rgid)
+ p->p_flag &= ~P_SUGID;
+ }
p->p_cred->p_svuid = p->p_ucred->cr_uid;
p->p_cred->p_svgid = p->p_ucred->cr_gid;
Home |
Main Index |
Thread Index |
Old Index