accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1423518 - /accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
Date Tue, 18 Dec 2012 16:23:34 GMT
Author: vines
Date: Tue Dec 18 16:23:34 2012
New Revision: 1423518

URL: http://svn.apache.org/viewvc?rev=1423518&view=rev
Log:
Accumulo-912 - no password clobbering, bonus password checking


Modified:
    accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java

Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java?rev=1423518&r1=1423517&r2=1423518&view=diff
==============================================================================
--- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
(original)
+++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
Tue Dec 18 16:23:34 2012
@@ -18,6 +18,7 @@ package org.apache.accumulo.core.client.
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -30,6 +31,7 @@ import org.apache.accumulo.core.client.I
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.TextUtil;
@@ -103,7 +105,10 @@ public class MockInstance implements Ins
   @Override
   public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException
{
     Connector conn = new MockConnector(user, acu, this);
-    conn.securityOperations().createUser(user, pass, new Authorizations());
+    if (!acu.users.containsKey(user))
+      conn.securityOperations().createUser(user, pass, new Authorizations());
+    else if (!Arrays.equals(acu.users.get(user).password, pass))
+        throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
     return conn;
   }
   



Mime
View raw message