Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 fa6cd7ef0 -> c0c2ca545


AMBARI-22016 - changeToSecureUid.sh might collide with existing user if it is 
not a local user (Aman Poonia via jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c0c2ca54
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c0c2ca54
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c0c2ca54

Branch: refs/heads/branch-2.6
Commit: c0c2ca5457f0a0275c16cc6c56e8eeca20886887
Parents: fa6cd7e
Author: Jonathan Hurley <[email protected]>
Authored: Mon Oct 23 09:51:32 2017 -0400
Committer: Jonathan Hurley <[email protected]>
Committed: Mon Oct 23 09:51:32 2017 -0400

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c0c2ca54/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
index a6b8b77..e735ea7 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
@@ -26,7 +26,7 @@ newUid=$3
 function find_available_uid() {
  for ((i=1001; i<=2000; i++))
  do
-   grep -q $i /etc/passwd
+   getent passwd $i | cut -d: -f4
    if [ "$?" -ne 0 ]
    then
     newUid=$i

Reply via email to