浏览代码

Resolves: bug 248820
Bug Description: quick install failed when login userid doesn't match install user's id
Reviewed by: me
Fix Description: getlogin returns the _login_ ID which is the initial login id (from utmp). We want the username of the effective user ID, so I just needed to change getLogin to do that.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no

Rich Megginson 18 年之前
父节点
当前提交
a7a11d6bd8
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      ldap/admin/src/scripts/Util.pm.in

+ 4 - 1
ldap/admin/src/scripts/Util.pm.in

@@ -111,8 +111,11 @@ sub isValidServerID {
     return $servid =~ /^[$validchars]+$/o;
 }
 
+# we want the name of the effective user id of this process e.g. if someone did
+# an su root, we want getLogin to return "root" not the originating id (getlogin)
+# in perl, $> is the effective numeric user id - we need to turn it into a string
 sub getLogin {
-    return getlogin || (getpwuid($>))[0] || $ENV{USER} || die "Error: could not determine the current user ID: $!";
+    return (getpwuid($>))[0] || $ENV{USER} || die "Error: could not determine the current user ID: $!";
 }
 
 sub isValidUser {