ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject incubator-ignite git commit: # IGNITE-943 Bug fix: NPE in setAuthenticator
Date Thu, 28 May 2015 19:07:55 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-943 2bc07956a -> 6b1265c2b


# IGNITE-943 Bug fix: NPE in setAuthenticator


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6b1265c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6b1265c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6b1265c2

Branch: refs/heads/ignite-943
Commit: 6b1265c2b103b4131b3ffc6deecd55d440fbe9b0
Parents: 2bc0795
Author: sevdokimov <sergey.evdokimov@jetbrains.com>
Authored: Thu May 28 22:06:29 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
Committed: Thu May 28 22:06:29 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  5 -----
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 20 ++++++--------------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  5 -----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  5 ++++-
 4 files changed, 10 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b1265c2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 2171085..e672d64 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -319,11 +319,6 @@ class ClientImpl extends TcpDiscoveryImpl {
     }
 
     /** {@inheritDoc} */
-    @Override public void setAuthenticator(DiscoverySpiNodeAuthenticator auth) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
     @Override public void sendCustomEvent(DiscoverySpiCustomMessage evt) {
         if (segmented)
             throw new IgniteException("Failed to send custom message: client is disconnected");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b1265c2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index b5c9519..57c13d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -115,9 +115,6 @@ class ServerImpl extends TcpDiscoveryImpl {
     /** Response on join request from coordinator (in case of duplicate ID or auth failure).
*/
     private final GridTuple<TcpDiscoveryAbstractMessage> joinRes = F.t1();
 
-    /** Node authenticator. */
-    private DiscoverySpiNodeAuthenticator nodeAuth;
-
     /** Mutex. */
     private final Object mux = new Object();
 
@@ -631,11 +628,6 @@ class ServerImpl extends TcpDiscoveryImpl {
     }
 
     /** {@inheritDoc} */
-    @Override public void setAuthenticator(DiscoverySpiNodeAuthenticator nodeAuth) {
-        this.nodeAuth = nodeAuth;
-    }
-
-    /** {@inheritDoc} */
     @Override public void sendCustomEvent(DiscoverySpiCustomMessage evt) {
         try {
             msgWorker.addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt,
spi.marsh.marshal(evt)));
@@ -680,10 +672,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                 if (log.isDebugEnabled())
                     log.debug("Join request message has not been sent (local node is the
first in the topology).");
 
-                if (nodeAuth != null) {
+                if (spi.nodeAuth != null) {
                     // Authenticate local node.
                     try {
-                        SecurityContext subj = nodeAuth.authenticateNode(locNode, locCred);
+                        SecurityContext subj = spi.nodeAuth.authenticateNode(locNode, locCred);
 
                         if (subj == null)
                             throw new IgniteSpiException("Authentication failed for local
node: " + locNode.id());
@@ -2469,12 +2461,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                     return;
                 }
 
-                if (nodeAuth != null) {
+                if (spi.nodeAuth != null) {
                     // Authenticate node first.
                     try {
                         SecurityCredentials cred = unmarshalCredentials(node);
 
-                        SecurityContext subj = nodeAuth.authenticateNode(node, cred);
+                        SecurityContext subj = spi.nodeAuth.authenticateNode(node, cred);
 
                         if (subj == null) {
                             // Node has not pass authentication.
@@ -2843,7 +2835,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     return;
                 }
 
-                if (!isLocalNodeCoordinator() && nodeAuth != null && nodeAuth.isGlobalNodeAuthentication())
{
+                if (!isLocalNodeCoordinator() && spi.nodeAuth != null &&
spi.nodeAuth.isGlobalNodeAuthentication()) {
                     boolean authFailed = true;
 
                     try {
@@ -2861,7 +2853,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             authFailed = false;
                         }
                         else {
-                            SecurityContext subj = nodeAuth.authenticateNode(node, cred);
+                            SecurityContext subj = spi.nodeAuth.authenticateNode(node, cred);
 
                             SecurityContext coordSubj = spi.ignite().configuration().getMarshaller().unmarshal(
                                 node.<byte[]>attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b1265c2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
index 4836911..f285279 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
@@ -113,11 +113,6 @@ abstract class TcpDiscoveryImpl {
     public abstract void disconnect() throws IgniteSpiException;
 
     /**
-     * @param auth Auth.
-     */
-    public abstract void setAuthenticator(DiscoverySpiNodeAuthenticator auth);
-
-    /**
      * @param msg Message.
      */
     public abstract void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b1265c2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 64e6001..1b8424c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -294,6 +294,9 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     protected long ipFinderCleanFreq = DFLT_IP_FINDER_CLEAN_FREQ;
 
+    /** Node authenticator. */
+    protected DiscoverySpiNodeAuthenticator nodeAuth;
+
     /** Context initialization latch. */
     @GridToStringExclude
     private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
@@ -353,7 +356,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi,
T
 
     /** {@inheritDoc} */
     @Override public void setAuthenticator(DiscoverySpiNodeAuthenticator auth) {
-        impl.setAuthenticator(auth);
+        nodeAuth = auth;
     }
 
     /** {@inheritDoc} */


Mime
View raw message