James Moger
2012-09-26 301adb550d1d45bbbc6344252dd9cf1c628122d3
Fix LDAP connection leak (issue-139)
2 files modified
6 ■■■■ changed files
docs/04_releases.mkd 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/LdapUserService.java 5 ●●●● patch | view | raw | blame | history
docs/04_releases.mkd
@@ -11,6 +11,7 @@
#### fixes
- Fixed connection leak in LDAPUserService (issue 139)
- Fixed bug in commit page where changes to a submodule threw a null pointer exception (issue 132)
- Fixed bug in the diff view for filenames that have non-ASCII characters (issue 128)
src/com/gitblit/LdapUserService.java
@@ -162,6 +162,7 @@
        
        LDAPConnection ldapConnection = getLdapConnection();        
        if (ldapConnection != null) {
            try {
            // Find the logging in user's DN
            String accountBase = settings.getString(Keys.realm.ldap.accountBase, "");
            String accountPattern = settings.getString(Keys.realm.ldap.accountPattern, "(&(objectClass=person)(sAMAccountName=${username}))");
@@ -200,8 +201,10 @@
                    return user;
                }
            }
            } finally {
                ldapConnection.close();
        }
        }
        return null;        
    }