소스 검색

HPCC-7920 Core in dafilesrv if sent a VER command in authenticated mode

When dafilesrv is running in authenticated mode (started with -A) , it will
core if sent a VER command by dafscontrol.

VER is the only command that is NOT authenticated, and requires some special
handling. It wasn't quite special enough, unfortunately.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 년 전
부모
커밋
8ffb63fd5b
1개의 변경된 파일8개의 추가작업 그리고 12개의 파일을 삭제
  1. 8 12
      common/remote/sockfile.cpp

+ 8 - 12
common/remote/sockfile.cpp

@@ -3117,7 +3117,9 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer, imple
         {
             CThrottler throttler(parent->throttleSem());
             MemoryBuffer reply;
-            parent->dispatchCommand(buf, initSendBuffer(reply), this, &throttler);
+            RemoteFileCommandType cmd;
+            buf.read(cmd);
+            parent->dispatchCommand(cmd, buf, initSendBuffer(reply), this, &throttler);
             buf.clear();
             sendBuffer(socket, reply);
         }
@@ -4244,10 +4246,8 @@ public:
         return false;
     }
 
-    bool dispatchCommand(MemoryBuffer & msg, MemoryBuffer & reply, CRemoteClientHandler *client, CThrottler *throttler)
+    bool dispatchCommand(RemoteFileCommandType cmd, MemoryBuffer & msg, MemoryBuffer & reply, CRemoteClientHandler *client, CThrottler *throttler)
     {
-        RemoteFileCommandType cmd;
-        msg.read(cmd);
         bool ret = true;
         switch(cmd) {
             MAPCOMMAND(RFCcloseIO, cmdCloseFileIO);
@@ -4376,17 +4376,13 @@ public:
         selecthandler->stop(true);
     }
 
-    void processUnauthenticatedCommand(RemoteFileCommandType typ,ISocket *socket, MemoryBuffer &msg)
+    void processUnauthenticatedCommand(RemoteFileCommandType cmd, ISocket *socket, MemoryBuffer &msg)
     {
         // these are unauthenticated commands
-        switch (typ) {
-        case RFCgetver: break;
-        default:
-            typ = RFCinvalid;
-            msg.writeDirect(msg.getPos()-sizeof(RemoteFileCommandType),sizeof(RemoteFileCommandType),&typ);
-        }
+        if (cmd != RFCgetver)
+            cmd = RFCinvalid;
         MemoryBuffer reply;
-        dispatchCommand(msg, initSendBuffer(reply), NULL, NULL);
+        dispatchCommand(cmd, msg, initSendBuffer(reply), NULL, NULL);
         sendBuffer(socket, reply);
     }