ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [09/26] incubator-ranger git commit: RANGER-720: Handling some error cases and fixing the issues that were reported in the Jira
Date Wed, 02 Dec 2015 23:19:25 GMT
RANGER-720: Handling some error cases and fixing the issues that were reported in the Jira

Signed-off-by: Velmurugan Periasamy <vel@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/7b7b314d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/7b7b314d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/7b7b314d

Branch: refs/heads/tag-policy
Commit: 7b7b314d89fab7c40f747c04c3bca989c4593de3
Parents: 04c5dc3
Author: Sailaja Polavarapu <spolavarapu@hortonworks.com>
Authored: Mon Nov 16 13:01:23 2015 -0800
Committer: Velmurugan Periasamy <vel@apache.org>
Committed: Mon Nov 23 17:08:36 2015 -0500

----------------------------------------------------------------------
 .../ldapconfigcheck/LdapConfigCheckMain.java       |  6 +-----
 .../apache/ranger/ldapconfigcheck/UserSync.java    | 17 ++++++++++-------
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/7b7b314d/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/LdapConfigCheckMain.java
----------------------------------------------------------------------
diff --git a/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/LdapConfigCheckMain.java
b/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/LdapConfigCheckMain.java
index ad56b2e..073df27 100644
--- a/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/LdapConfigCheckMain.java
+++ b/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/LdapConfigCheckMain.java
@@ -200,10 +200,6 @@ public class LdapConfigCheckMain {
             msg = "ranger.usersync.ldap.user.objectclass ";
             throw new NullArgumentException(msg);
         }
-        if (userSyncObj.getUserGroupMemberName() == null || userSyncObj.getUserGroupMemberName().isEmpty())
{
-            msg = "ranger.usersync.ldap.user.groupnameattribute ";
-            throw new NullArgumentException(msg);
-        }
         if ((userSyncObj.getUserSearchBase() == null || userSyncObj.getUserSearchBase().isEmpty())
&&
                 (userSyncObj.getSearchBase() == null || userSyncObj.getSearchBase().isEmpty()))
{
             msg = "ranger.usersync.ldap.user.searchbase and " +
@@ -223,7 +219,7 @@ public class LdapConfigCheckMain {
             msg = "ranger.usersync.group.objectclass ";
             throw new NullArgumentException(msg);
         }
-        if (userSyncObj.getUserGroupMemberName() == null || userSyncObj.getUserGroupMemberName().isEmpty())
{
+        if (userSyncObj.getGroupMemberName() == null || userSyncObj.getGroupMemberName().isEmpty())
{
             msg = "ranger.usersync.group.memberattributename ";
             throw new NullArgumentException(msg);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/7b7b314d/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/UserSync.java
----------------------------------------------------------------------
diff --git a/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/UserSync.java
b/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/UserSync.java
index 53da9f2..f8b9aea 100644
--- a/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/UserSync.java
+++ b/ugsync/ldapconfigchecktool/ldapconfigcheck/src/main/java/org/apache/ranger/ldapconfigcheck/UserSync.java
@@ -258,7 +258,7 @@ public class UserSync {
                         groupMemberAttr = attributes.get(userGroupMemAttrValues[i]);
                         if (groupMemberAttr != null) {
                             userGroupMemberName = userGroupMemAttrValues[i];
-                            groupName = groupMemberAttr.get(1).toString();
+                            groupName = groupMemberAttr.get(0).toString();
                             break;
                         }
                     }
@@ -421,7 +421,7 @@ public class UserSync {
     public void getAllUsers(LdapContext ldapContext) throws Throwable {
         int noOfUsers = 0;
         Attribute userNameAttr = null;
-        String groupName = null;
+        //String groupName = null;
         Attribute groupMemberAttr;
         NamingEnumeration<SearchResult> userSearchResultEnum = null;
         SearchControls userSearchControls = new SearchControls();
@@ -598,12 +598,15 @@ public class UserSync {
         groupSearchControls.setSearchScope(config.getGroupSearchScope());
 
         try {
-            int baseIndex = groupName.indexOf(",");
-            groupBase = groupName.substring(baseIndex + 1);
-            groupFilter = groupName.substring(0, baseIndex);
-            groupSearchResultEnum = ldapContext.search(groupBase, groupFilter,
+	    if (groupName == null || groupName.isEmpty()) {
+		groupSearchResultEnum = ldapContext.search(searchBase, null);
+	    } else {
+                int baseIndex = groupName.indexOf(",");
+            	groupBase = groupName.substring(baseIndex + 1);
+            	groupFilter = groupName.substring(0, baseIndex);
+            	groupSearchResultEnum = ldapContext.search(groupBase, groupFilter,
                     groupSearchControls);
-
+	    }
             noOfGroups = 0;
             while (groupSearchResultEnum.hasMore()) {
                 if (noOfGroups >= 1) {


Mime
View raw message