From owner-p4-projects Thu Jan 30 10:58:13 2003 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7917037B405; Thu, 30 Jan 2003 10:58:11 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E95B37B401 for ; Thu, 30 Jan 2003 10:58:10 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id BBC9943FAF for ; Thu, 30 Jan 2003 10:58:09 -0800 (PST) (envelope-from green@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h0UIw9bv033307 for ; Thu, 30 Jan 2003 10:58:09 -0800 (PST) (envelope-from green@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h0UIw9GT033301 for perforce@freebsd.org; Thu, 30 Jan 2003 10:58:09 -0800 (PST) Date: Thu, 30 Jan 2003 10:58:09 -0800 (PST) Message-Id: <200301301858.h0UIw9GT033301@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to green@freebsd.org using -f From: Brian Feldman Subject: PERFORCE change 24448 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=24448 Change 24448 by green@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@FreeBSD.org with "unsubscribe p4-projects" in the body of the message