changeset 3679:a021f8a95be6

6370646 'auditconfig -getcond' no longer requires privilege to run 6414737 auditconfig -setasid, -setaudit, -setauid issues 6483469 audit_symlink_create() shoudn't call VOP_LOOKUP() with NO_FOLLOW
author tz204579
date Mon, 19 Feb 2007 03:51:40 -0800
parents c532e9896e3d
children 773fb303fd36
files usr/src/cmd/auditconfig/auditconfig.c usr/src/uts/common/c2/audit.c usr/src/uts/common/c2/audit_syscalls.c
diffstat 3 files changed, 28 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/auditconfig/auditconfig.c	Mon Feb 19 02:52:46 2007 -0800
+++ b/usr/src/cmd/auditconfig/auditconfig.c	Mon Feb 19 03:51:40 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -2339,16 +2339,32 @@
 static void
 execit(char **argv)
 {
-	char *shell;
+	char *args, *args_pos;
+	size_t len = 0;
+	size_t n = 0;
+	char **argv_pos;
 
 	if (*argv) {
-		(void) execvp(*argv, argv);
+		/* concatenate argument array to be passed to sh -c "..." */
+		for (argv_pos = argv; *argv_pos; argv_pos++)
+			len += strlen(*argv_pos) + 1;
+
+		if ((args = malloc(len + 1)) == NULL)
+			exit_error(
+				gettext("Allocation for command/arguments "
+					"failed"));
+
+		args_pos = args;
+		for (argv_pos = argv; *argv_pos; argv_pos++) {
+			n += snprintf(args_pos, len - n, "%s ", *argv_pos);
+			args_pos = args + n;
+		}
+		/* strip the last space */
+		args[strlen(args)] = '\0';
+
+		(void) execl("/bin/sh", "sh", "-c", args, NULL);
 	} else {
-		if (((shell = getenv("SHELL")) == NULL) ||
-			*shell != '/')
-			shell = "/bin/csh";
-
-		(void) execlp(shell, shell, NULL);
+		(void) execl("/bin/sh", "sh", NULL);
 	}
 
 	exit_error(gettext("exec(2) failed"));
--- a/usr/src/uts/common/c2/audit.c	Mon Feb 19 02:52:46 2007 -0800
+++ b/usr/src/uts/common/c2/audit.c	Mon Feb 19 03:51:40 2007 -0800
@@ -1428,7 +1428,7 @@
 	if (error)
 		return;
 
-	error = VOP_LOOKUP(dvp, sname, &vp, NULL, NO_FOLLOW, NULL, CRED());
+	error = VOP_LOOKUP(dvp, sname, &vp, NULL, 0, NULL, CRED());
 	if (error == 0) {
 		audit_attributes(vp);
 		VN_RELE(vp);
--- a/usr/src/uts/common/c2/audit_syscalls.c	Mon Feb 19 02:52:46 2007 -0800
+++ b/usr/src/uts/common/c2/audit_syscalls.c	Mon Feb 19 03:51:40 2007 -0800
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1877,7 +1876,6 @@
 
 	switch (cmd) {
 	case A_GETCOND:
-		break;
 	case A_GETCAR:
 	case A_GETCLASS:
 	case A_GETCWD: