changeset 13064:67f1b74cdb24

6949966 deallocate's mk_revoke should be more careful
author Jan Parcel <Jan.Parcel@Sun.COM>
date Mon, 09 Aug 2010 15:53:32 -0700
parents 60ed88a16f55
children 9377d65d657e
files usr/src/cmd/allocate/allocate3.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/allocate/allocate3.c	Mon Aug 09 16:22:41 2010 -0400
+++ b/usr/src/cmd/allocate/allocate3.c	Mon Aug 09 15:53:32 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <auth_attr.h>
@@ -818,6 +817,12 @@
 					    fuserpid);
 					continue;
 				}
+				if (strcmp(info.pr_fname, "deallocate")
+				    == NULL) {
+					dprintf("%d matched deallocate name\n",
+					    fuserpid);
+					continue;
+				}
 				dprintf("killing %s", info.pr_fname);
 				dprintf("(%d)\n", fuserpid);
 				if ((r =
@@ -1051,6 +1056,11 @@
 		goto out;
 	}
 	is_authorized = _is_dev_authorized(da, uid);
+	if (is_authorized == ALLOC_BY_NONE) {
+		dprintf("Not deallocating %s, not allocatable\n",
+		    da->da_devname);
+		goto out;
+	}
 	if (!(optflag & (FORCE | FORCE_ALL)) && !is_authorized) {
 		dprintf("User %d is unauthorized to deallocate\n", (int)uid);
 		error = UAUTHERR;