PERFORCE change 24448 for review

Brian Feldman green at freebsd.org
Thu Jan 30 18:58:09 GMT 2003


http://perforce.freebsd.org/chv.cgi?CH=24448

Change 24448 by green at green_laptop_2 on 2003/01/30 10:57:34

	SEBSD's get_ordered_context_list() et al do not need to be using
	a valid username to function.

Affected files ...

.. //depot/projects/trustedbsd/sebsd/lib/libsebsd/get_ordered_context_list.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/sebsd/lib/libsebsd/get_ordered_context_list.c#2 (text+ko) ====

@@ -222,8 +222,11 @@
 	} else {
 		user = user_name;
 	}
+	/*
+	 * The user does not have to be valid.
+	 */
 	pw = getpwnam(user_name);
-	if (pw == NULL || asprintf(&path, "%s/.default_contexts",
+	if (pw != NULL && asprintf(&path, "%s/.default_contexts",
 	    pw->pw_dir) == -1) {
 		error = -1;
 		goto out;
@@ -239,11 +242,13 @@
 	 * will simply be skipped, and thus will not be treated as
 	 * actual errors.
 	 */
-	error = move_matching_contexts(path, user, my_context, context_list,
-	    kernel_context_list, ncontexts);
-	free(path);
-	if (error == -1 && errno != ENOENT)
-		goto out;
+	if (pw != NULL) {
+		error = move_matching_contexts(path, user, my_context,
+		    context_list, kernel_context_list, ncontexts);
+		free(path);
+		if (error == -1 && errno != ENOENT)
+			goto out;
+	}
 	error = move_matching_contexts(_DEFCONTEXT_PATH, user, my_context,
 	    context_list, kernel_context_list, ncontexts);
 	if (error == -1 && errno != ENOENT)
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list