From 1dee569f0eb5011df947b919e47d723baa62c626 Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Mon, 5 Dec 2011 11:51:21 +0530 Subject: [PATCH] bug 8313: LDAP connector tested with ApacheDS --- client/tomcatconf/components.xml.in | 2 +- .../com/cloud/server/auth/MD5UserAuthenticator.java | 12 +++++++----- ui/old/scripts/cloud.core.init.js | 2 +- ui/scripts/sharedFunctions.js | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in index 0f4ba685751..90be416d4e8 100755 --- a/client/tomcatconf/components.xml.in +++ b/client/tomcatconf/components.xml.in @@ -68,7 +68,7 @@ - + diff --git a/server/src/com/cloud/server/auth/MD5UserAuthenticator.java b/server/src/com/cloud/server/auth/MD5UserAuthenticator.java index ac6a54c1d84..a93cc174089 100644 --- a/server/src/com/cloud/server/auth/MD5UserAuthenticator.java +++ b/server/src/com/cloud/server/auth/MD5UserAuthenticator.java @@ -18,6 +18,9 @@ package com.cloud.server.auth; +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.Map; import javax.ejb.Local; @@ -29,6 +32,7 @@ import com.cloud.server.ManagementServer; import com.cloud.user.UserAccount; import com.cloud.user.dao.UserAccountDao; import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.exception.CloudRuntimeException; /** * Simple UserAuthenticator that performs a MD5 hash of the password before @@ -52,8 +56,7 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator { s_logger.debug("Unable to find user with " + username + " in domain " + domainId); return false; } - - /* + MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); @@ -70,14 +73,13 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator { for (int i = 0; i < padding; i++) { sb.append('0'); } - sb.append(pwStr); - */ + sb.append(pwStr); // Will: The MD5Authenticator is now a straight pass-through comparison of the // the passwords because we will not assume that the password passed in has // already been MD5 hashed. I am keeping the above code in case this requirement changes // or people need examples of how to MD5 hash passwords in java. - if (!user.getPassword().equals(password)) { + if (!user.getPassword().equals(sb.toString())) { s_logger.debug("Password does not match"); return false; } diff --git a/ui/old/scripts/cloud.core.init.js b/ui/old/scripts/cloud.core.init.js index 6b71eccd3cf..380bb770c82 100644 --- a/ui/old/scripts/cloud.core.init.js +++ b/ui/old/scripts/cloud.core.init.js @@ -16,7 +16,7 @@ * */ // Default password is MD5 hashed. Set the following variable to false to disable this. -var md5Hashed = true; +var md5Hashed = false; $(document).ready(function() { function initUI() { diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 858e47950a3..e83f0291f55 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -22,7 +22,7 @@ var ERROR_INTERNET_CANNOT_CONNECT = 12029; var ERROR_VMOPS_ACCOUNT_ERROR = 531; // Default password is MD5 hashed. Set the following variable to false to disable this. -var md5Hashed = true; +var md5Hashed = false; //page size for API call (e.g."listXXXXXXX&pagesize=N" ) var pageSize = 50;