Sfoglia il codice sorgente

Signed-off-by: William Whitehead <william.whitehead@lexisnexis.com>

William Whitehead 10 anni fa
parent
commit
63d426bfc6

+ 10 - 6
common/remote/sockfile.cpp

@@ -4436,14 +4436,18 @@ public:
             if (!clientCertificate.certificate)
                 throw createDafsException(DAFSERR_connection_failed,"SSL Certificate information not found in environment.conf");
             if (listenep.port <= 0)
+            {
+                assertex(FALSE);
                 listenep.port = configepPort;
-
+            }
             //Create unsecure socket to reject non-ssl client requests
-            StringBuffer ip;
-            IpAddress ipAddr;
-            acceptsock->getPeerAddress(ipAddr);
-            ipAddr.getIpText(ip);
-            rejectsock.setown(ISocket::create_ip(DAFILESRV_PORT, ip.str()));
+            if (listenep.isNull())
+                rejectsock.setown(ISocket::create(DAFILESRV_PORT));
+            else {
+                StringBuffer ips;
+                listenep.getIpText(ips);
+                rejectsock.setown(ISocket::create_ip(DAFILESRV_PORT,ips.str()));
+            }
         }
 #ifdef _DEBUG
         StringBuffer sb;

+ 1 - 1
dali/dafilesrv/dafilesrv.cpp

@@ -550,7 +550,7 @@ int main(int argc,char **argv)
                 PROGLOG(DAFS_SERVICE_DISPLAY_NAME " Running");
                 server.setown(createRemoteFileServer());
                 try {
-                    server->run(listenep);
+                    server->run(listenep, useSSL);
                 }
                 catch (IException *e) {
                     EXCLOG(e,DAFS_SERVICE_NAME);

+ 1 - 1
system/jlib/jsocket.cpp

@@ -6116,7 +6116,7 @@ int wait_multiple(bool isRead,               //IN   true if wait read, false it
         StringBuffer dbgSB("wait_multiple() ready socket(s) :");
 #endif
         //Build up list of socks which are ready for accept read/write without blocking
-        for (aindex_t idx = 0; res && socks.length(); idx++)
+        for (aindex_t idx = 0; res && idx < socks.length(); idx++)
         {
             if (FD_ISSET(socks.item(idx), &fds))
             {

+ 5 - 2
system/jlib/jutil.cpp

@@ -2306,8 +2306,11 @@ jlib_decl bool querySecuritySettings(bool *          _useSSL,
 #endif
                 Owned<IProperties> conf = createProperties(configFileSpec.str(), true);
                 useSSL = conf->getPropBool("dfsUseSSL", false);
-                certificate.set(conf->queryProp("dfsSSLCertFile"));
-                privateKey.set(conf->queryProp("dfsSSLPrivateKeyFile"));
+                if (useSSL)
+                {
+                    certificate.set(conf->queryProp("dfsSSLCertFile"));
+                    privateKey.set(conf->queryProp("dfsSSLPrivateKeyFile"));
+                }
                 retrieved = true;
             }
             catch (IException *e)