Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 13312005: Don't use $USER for Local Login check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 05b941ba995d6277969c519365c245d60628c8f3..03b35292eb86e0f0baf9af2523c70d1baff60227 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -34,6 +34,7 @@
#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/base/breakpad.h"
#include "remoting/base/constants.h"
+#include "remoting/base/util.h"
#include "remoting/host/branding.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/chromoting_host_context.h"
@@ -69,7 +70,6 @@
#include "remoting/protocol/me2me_host_authenticator_factory.h"
#if defined(OS_POSIX)
-#include <pwd.h>
#include <signal.h>
#include "base/file_descriptor_posix.h"
#include "remoting/host/pam_authorization_factory_posix.h"
@@ -107,35 +107,6 @@ void QuitMessageLoop(MessageLoop* message_loop) {
message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
-// Returns true if GetUsername() is implemented on this platform.
-bool CanGetUsername() {
-#if defined(OS_POSIX)
- return true;
-#else // !defined(OS_POSIX)
- return false;
-#endif // defined(OS_POSIX)
-} // namespace
-
-// Returns the username associated with this process, or the empty string on
-// error.
-std::string GetUsername() {
-#if defined(OS_POSIX)
- long buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (buf_size <= 0)
- return "";
- scoped_array<char> buf(new char[buf_size]);
- struct passwd passwd;
- struct passwd* passwd_result = NULL;
- getpwuid_r(getuid(), &passwd, buf.get(), buf_size, &passwd_result);
- if (!passwd_result)
- return "";
- return std::string(passwd_result->pw_name);
-#else // !defined(OS_POSIX)
- NOTREACHED();
- return "";
-#endif // defined(OS_POSIX)
-}
-
} // namespace
namespace remoting {

Powered by Google App Engine
This is Rietveld 408576698