Commit 3da8258d authored by guus's avatar guus

Fixing incorrect parameter assignment in SetPassword query (OF-26). Thanks lkh007!

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11510 b35dd754-fafc-0310-a699-88a17e54d16e
parent a073e3df
...@@ -307,7 +307,6 @@ public class JDBCAuthProvider implements AuthProvider { ...@@ -307,7 +307,6 @@ public class JDBCAuthProvider implements AuthProvider {
private void setPasswordValue(String username, String password) throws UserNotFoundException { private void setPasswordValue(String username, String password) throws UserNotFoundException {
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
if (username.contains("@")) { if (username.contains("@")) {
// Check that the specified domain matches the server's domain // Check that the specified domain matches the server's domain
int index = username.indexOf("@"); int index = username.indexOf("@");
...@@ -322,24 +321,22 @@ public class JDBCAuthProvider implements AuthProvider { ...@@ -322,24 +321,22 @@ public class JDBCAuthProvider implements AuthProvider {
try { try {
con = getConnection(); con = getConnection();
pstmt = con.prepareStatement(setPasswordSQL); pstmt = con.prepareStatement(setPasswordSQL);
pstmt.setString(1, username); pstmt.setString(2, username);
if (passwordType == PasswordType.md5) { if (passwordType == PasswordType.md5) {
password = StringUtils.hash(password, "MD5"); password = StringUtils.hash(password, "MD5");
} }
else if (passwordType == PasswordType.sha1) { else if (passwordType == PasswordType.sha1) {
password = StringUtils.hash(password, "SHA-1"); password = StringUtils.hash(password, "SHA-1");
} }
pstmt.setString(2, password); pstmt.setString(1, password);
pstmt.executeQuery();
rs = pstmt.executeQuery();
} }
catch (SQLException e) { catch (SQLException e) {
Log.error("Exception in JDBCAuthProvider", e); Log.error("Exception in JDBCAuthProvider", e);
throw new UserNotFoundException(); throw new UserNotFoundException();
} }
finally { finally {
DbConnectionManager.closeConnection(rs, pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment