[svn] commit: r2571 - in /branches/trac268/src/bin/auth: change_user.cc change_user.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jul 21 19:29:19 UTC 2010
Author: jinmei
Date: Wed Jul 21 19:29:18 2010
New Revision: 2571
Log:
addressed review comments:
- unified exception throwing for unknown/invalid user names
- wording in comment description
also made some cleanups: removing an unused temp variable, making sure endpwent() is called.
Modified:
branches/trac268/src/bin/auth/change_user.cc
branches/trac268/src/bin/auth/change_user.h
Modified: branches/trac268/src/bin/auth/change_user.cc
==============================================================================
--- branches/trac268/src/bin/auth/change_user.cc (original)
+++ branches/trac268/src/bin/auth/change_user.cc Wed Jul 21 19:29:18 2010
@@ -32,12 +32,13 @@
const struct passwd *runas_pw = NULL;
runas_pw = getpwnam(username);
+ endpwent();
if (runas_pw == NULL) {
try {
runas_pw = getpwuid(lexical_cast<uid_t>(username));
- } catch (const bad_lexical_cast& err) {
- isc_throw(FatalError,
- "Failed to parse user name or UID:" << username);
+ endpwent();
+ } catch (const bad_lexical_cast&) {
+ ; // fall through to isc_throw below.
}
}
if (runas_pw == NULL) {
Modified: branches/trac268/src/bin/auth/change_user.h
==============================================================================
--- branches/trac268/src/bin/auth/change_user.h (original)
+++ branches/trac268/src/bin/auth/change_user.h Wed Jul 21 19:29:18 2010
@@ -19,8 +19,8 @@
/// \brief Change the run time user.
///
-/// This function changes the effective user of the authoritative server
-/// process.
+/// This function changes the user of the authoritative server process.
+///
/// \c username can be either a textual user name or its numeric ID.
/// If the specified user name (or ID) doesn't specify a local user ID
/// or the user originally starting the process doesn't have a permission
More information about the bind10-changes
mailing list