Update CMakeLists.txt - play with openssl
[novacoin.git] / src / bitcoinrpc.cpp
index b411be4..bb8ea6d 100644 (file)
@@ -8,17 +8,19 @@
 #include "bitcoinrpc.h"
 #include "db.h"
 #include "interface.h"
+#include "random.h"
 #include "sync.h"
 #include "util.h"
+#include "wallet.h"
 
 #undef printf
 
-#include <boost/algorithm/string.hpp>
 #include <ixwebsocket/IXHttpClient.h>
 #include <ixwebsocket/IXHttpServer.h>
 
 #include <list>
 #include <memory>
+#include <regex>
 
 #define printf OutputDebugStringF
 
@@ -204,14 +206,12 @@ Value help(const Array& params, bool fHelp)
 
 Value stop(const Array& params, bool fHelp)
 {
+// Accept the deprecated and ignored 'detach´ boolean argument
     if (fHelp || params.size() > 1)
         throw std::runtime_error(
-            "stop <detach>\n"
-            "<detach> is true or false to detach the database or not for this stop only\n"
-            "Stop NovaCoin server (and possibly override the detachdb config value).");
+            "stop\n"
+            "Stop Novacoin server.");
     // Shutdown will take long enough that the response should get back
-    if (!params.empty())
-        bitdb.SetDetach(params[0].get_bool());
     StartShutdown();
     return "NovaCoin server stopping";
 }
@@ -338,7 +338,7 @@ bool HTTPAuthorized(ix::WebSocketHttpHeaders& mapHeaders)
     std::string strAuth = mapHeaders["authorization"];
     if (strAuth.substr(0,6) != "Basic ")
         return false;
-    std::string strUserPass64 = strAuth.substr(6); boost::algorithm::trim(strUserPass64);
+    std::string strUserPass64 = std::regex_replace(strAuth.substr(6), static_cast<std::regex>("\\s+"), "");
     std::string strUserPass = DecodeBase64(strUserPass64);
     return TimingResistantEqual(strUserPass, strRPCUserColonPass);
 }
@@ -472,7 +472,7 @@ void StartRPCServer()
     if (mapArgs["-rpcpassword"].empty())
     {
         unsigned char rand_pwd[32];
-        RAND_bytes(rand_pwd, 32);
+        GetRandBytes(rand_pwd, 32);
         std::string strWhatAmI = "To use novacoind";
         if (mapArgs.count("-server"))
             strWhatAmI = strprintf(_("To use the %s option"), "\"-server\"");