diff options
author | Csaba Henk <csaba@gluster.com> | 2011-04-11 05:42:20 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-11 05:44:14 -0700 |
commit | 3a709be6850e50915c9e188cc308d7bfa5f781e5 (patch) | |
tree | 3d9f26f6565dcc5787ec9506b595a9bd11424f86 /xlators/features/marker/utils | |
parent | 78bd9a86c3e87c9e79f62990773767f81cab896d (diff) |
syncdaemon: do not use os.getlogin() for getting the name of the current user
This function relies on the terminal (cf. getlogin(3)), which is not available if we run as daemon
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2712 (username resolution in gsyncd fails)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2712
Diffstat (limited to 'xlators/features/marker/utils')
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/resource.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py index 7083b56cf..f157b1907 100644 --- a/xlators/features/marker/utils/syncdaemon/resource.py +++ b/xlators/features/marker/utils/syncdaemon/resource.py @@ -1,6 +1,7 @@ import re import os import sys +import pwd import stat import time import errno @@ -446,7 +447,7 @@ class SSH(AbstractUrl, SlaveRemote): if m: u, h = m.groups() else: - u, h = os.getlogin(), self.remote_addr + u, h = pwd.getpwuid(os.geteuid()).pw_name, self.remote_addr remote_addr = '@'.join([u, socket.gethostbyname(h)]) return ':'.join([remote_addr, self.inner_rsc.get_url(canonical=True)]) |