Date: Thu, 30 Jan 2003 10:58:09 -0800 (PST) From: Brian Feldman <green@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 24448 for review Message-ID: <200301301858.h0UIw9GT033301@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301301858.h0UIw9GT033301>