From 3a709be6850e50915c9e188cc308d7bfa5f781e5 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Mon, 11 Apr 2011 05:42:20 +0000 Subject: 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 Signed-off-by: Anand Avati BUG: 2712 (username resolution in gsyncd fails) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2712 --- xlators/features/marker/utils/syncdaemon/resource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/features') 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)]) -- cgit