summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2009-06-29 13:40:27 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2009-06-29 13:40:27 +0000
commitc55e8df8a228f24894196fd84f201530d5608460 (patch)
tree0cde108526b59740f14b2a11455d0987b787d153 /usr.bin
parent9dae7d6a8a1b9735b12bc33d5f37c92a7bcde976 (diff)
sync with sudo 1.7.2
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sudo/ChangeLog19
-rw-r--r--usr.bin/sudo/redblack.c22
-rw-r--r--usr.bin/sudo/set_perms.c8
3 files changed, 37 insertions, 12 deletions
diff --git a/usr.bin/sudo/ChangeLog b/usr.bin/sudo/ChangeLog
index ef26b882c7e..9a3940d4af3 100644
--- a/usr.bin/sudo/ChangeLog
+++ b/usr.bin/sudo/ChangeLog
@@ -1,3 +1,22 @@
+2009-06-29 09:36 millert
+
+ * redblack.c: In rbrepair, re-color the root or the first non-block
+ node we find to be black. Re-coloring the root is probably not
+ needed but won't hurt.
+
+2009-06-29 09:35 millert
+
+ * sudo.cat, sudoers.cat, sudo.man.in, sudoers.man.in: regen
+
+2009-06-26 16:40 millert
+
+ * redblack.c: When repairing the tree, don't touch the root node.
+
+2009-06-25 08:44 millert
+
+ * set_perms.c: Protect call to setegid in runas_setup with #ifdef
+ HAVE_SETEUID. Reported by Josef Schmid.
+
2009-06-23 14:29 millert
* sudoers.pod: Document that we accept env_pam-style environment
diff --git a/usr.bin/sudo/redblack.c b/usr.bin/sudo/redblack.c
index 91c8586bba9..ac8ea2d2136 100644
--- a/usr.bin/sudo/redblack.c
+++ b/usr.bin/sudo/redblack.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004-2005, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2004-2005, 2007,2009 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -58,7 +58,7 @@
#include "redblack.h"
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: redblack.c,v 1.11 2009/06/26 20:40:17 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: redblack.c,v 1.12 2009/06/29 13:36:20 millert Exp $";
#endif /* lint */
static void rbrepair __P((struct rbtree *, struct rbnode *));
@@ -77,10 +77,11 @@ static void _rbdestroy __P((struct rbtree *, struct rbnode *,
* In addition to the ordinary requirements imposed on binary search
* trees, we make the following additional requirements of any valid
* red-black tree:
- * 1) The root is black.
- * 2) All leaves are black.
- * 3) Both children of each red node are black.
- * 4) The paths from each leaf up to the root each contain the same
+ * 1) Every node is either red or black.
+ * 2) The root is black.
+ * 3) All leaves are black.
+ * 4) Both children of each red node are black.
+ * 5) The paths from each leaf up to the root each contain the same
* number of black nodes.
*/
@@ -372,8 +373,8 @@ rbdestroy(tree, destroy)
* Delete node 'z' from the tree and return its data pointer.
*/
void *rbdelete(tree, z)
- struct rbtree* tree;
- struct rbnode* z;
+ struct rbtree *tree;
+ struct rbnode *z;
{
struct rbnode *x, *y;
void *data = z->data;
@@ -444,7 +445,7 @@ rbrepair(tree, node)
node->parent->color = black;
sibling->right->color = black;
rotate_left(tree, node->parent);
- break;
+ node = rbroot(tree); /* exit loop */
}
} else { /* if (node == node->parent->right) */
sibling = node->parent->left;
@@ -468,8 +469,9 @@ rbrepair(tree, node)
node->parent->color = black;
sibling->left->color = black;
rotate_right(tree, node->parent);
- break;
+ node = rbroot(tree); /* exit loop */
}
}
}
+ node->color = black;
}
diff --git a/usr.bin/sudo/set_perms.c b/usr.bin/sudo/set_perms.c
index 887e8b74574..4417330f976 100644
--- a/usr.bin/sudo/set_perms.c
+++ b/usr.bin/sudo/set_perms.c
@@ -52,7 +52,7 @@
#include "sudo.h"
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: set_perms.c,v 1.48 2009/05/25 12:02:41 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: set_perms.c,v 1.49 2009/06/25 12:44:33 millert Exp $";
#endif /* lint */
#ifdef __TANDEM
@@ -577,7 +577,11 @@ runas_setup()
* Initialize group vector
*/
runas_setgroups();
- if (setegid(gid) || setgid(gid))
+#ifdef HAVE_SETEUID
+ if (setegid(gid))
+ warning("cannot set egid to runas gid");
+#endif
+ if (setgid(gid))
warning("cannot set gid to runas gid");
}
}