ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dillido...@apache.org
Subject git commit: ARGUS-157: defensively handle potential connection leaks in LdapUserGroupBuilder (cherry picked from commit b61836fae9f8a5bfeed37bff18afb036e2ce1ab3)
Date Wed, 05 Nov 2014 23:18:16 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/ranger-0.4 37c62a8de -> 2f8287b4c


ARGUS-157: defensively handle potential connection leaks in LdapUserGroupBuilder
(cherry picked from commit b61836fae9f8a5bfeed37bff18afb036e2ce1ab3)


Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/2f8287b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/2f8287b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/2f8287b4

Branch: refs/heads/ranger-0.4
Commit: 2f8287b4cc55309da00630c0ab91f770eb9edab2
Parents: 37c62a8
Author: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Authored: Wed Nov 5 14:42:57 2014 -0800
Committer: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Committed: Wed Nov 5 15:13:19 2014 -0800

----------------------------------------------------------------------
 .../xasecure/ldapusersync/process/LdapUserGroupBuilder.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2f8287b4/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
b/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
index c8d3204..e0a3fa3 100644
--- a/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
+++ b/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
@@ -180,6 +180,7 @@ public class LdapUserGroupBuilder implements UserGroupSource {
 	@Override
 	public void updateSink(UserGroupSink sink) throws Throwable {
 		LOG.info("LDAPUserGroupBuilder updateSink started");
+    NamingEnumeration<SearchResult> searchResultEnum = null;
 		try {
 			createLdapContext();
 			
@@ -191,7 +192,7 @@ public class LdapUserGroupBuilder implements UserGroupSource {
 		    
 			int counter = 0;
 			do {
-				NamingEnumeration<SearchResult> searchResultEnum = ldapContext
+				searchResultEnum = ldapContext
 					.search(userSearchBase, extendedSearchFilter,
 							searchControls);
 				while (searchResultEnum.hasMore()) { 
@@ -281,6 +282,9 @@ public class LdapUserGroupBuilder implements UserGroupSource {
 			LOG.info("LDAPUserGroupBuilder.updateSink() completed with user count: "
 					+ counter);
 		} finally {
+      if (searchResultEnum != null) {
+        searchResultEnum.close();
+      }
 			closeLdapContext();
 		}
 	}


Mime
View raw message