Merge branch '0.5.0.x' into 0.5.x
authorLuke Dashjr <luke-jr+git@utopios.org>
Tue, 17 Jan 2012 03:30:10 +0000 (22:30 -0500)
committerLuke Dashjr <luke-jr+git@utopios.org>
Tue, 17 Jan 2012 03:30:10 +0000 (22:30 -0500)
1  2 
src/bitcoinrpc.cpp

diff --combined src/bitcoinrpc.cpp
@@@ -36,8 -36,6 +36,8 @@@ void ThreadRPCServer2(void* parg)
  typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
  extern map<string, rpcfn_type> mapCallTable;
  
 +static std::string strRPCUserColonPass;
 +
  static int64 nWalletUnlockTime;
  static CCriticalSection cs_nWalletUnlockTime;
  
@@@ -128,7 -126,6 +128,7 @@@ Value help(const Array& params, bool fH
          // We already filter duplicates, but these deprecated screw up the sort order
          if (strMethod == "getamountreceived" ||
              strMethod == "getallreceived" ||
 +            strMethod == "getblocknumber" || // deprecated
              (strMethod.find("label") != string::npos))
              continue;
          if (strCommand != "" && strMethod != strCommand)
@@@ -184,13 -181,12 +184,13 @@@ Value getblockcount(const Array& params
  }
  
  
 +// deprecated
  Value getblocknumber(const Array& params, bool fHelp)
  {
      if (fHelp || params.size() != 0)
          throw runtime_error(
              "getblocknumber\n"
 -            "Returns the block number of the latest block in the longest block chain.");
 +            "Deprecated.  Use getblockcount.");
  
      return nBestHeight;
  }
@@@ -1316,7 -1312,7 +1316,7 @@@ Value listsinceblock(const Array& param
          CBlockIndex *block;
          for (block = pindexBest;
               block && block->nHeight > target_height;
-              block = block->pprev);
+              block = block->pprev)  { }
  
          lastblock = block ? block->GetBlockHash() : 0;
      }
@@@ -1854,7 -1850,7 +1854,7 @@@ string pAllowInSafeMode[] 
      "help",
      "stop",
      "getblockcount",
 -    "getblocknumber",
 +    "getblocknumber",  // deprecated
      "getconnectioncount",
      "getdifficulty",
      "getgenerate",
@@@ -2025,7 -2021,12 +2025,7 @@@ bool HTTPAuthorized(map<string, string>
          return false;
      string strUserPass64 = strAuth.substr(6); boost::trim(strUserPass64);
      string strUserPass = DecodeBase64(strUserPass64);
 -    string::size_type nColon = strUserPass.find(":");
 -    if (nColon == string::npos)
 -        return false;
 -    string strUser = strUserPass.substr(0, nColon);
 -    string strPassword = strUserPass.substr(nColon+1);
 -    return (strUser == mapArgs["-rpcuser"] && strPassword == mapArgs["-rpcpassword"]);
 +    return strUserPass == strRPCUserColonPass;
  }
  
  //
@@@ -2158,8 -2159,7 +2158,8 @@@ void ThreadRPCServer2(void* parg
  {
      printf("ThreadRPCServer started\n");
  
 -    if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "")
 +    strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
 +    if (strRPCUserColonPass == ":")
      {
          string strWhatAmI = "To use bitcoind";
          if (mapArgs.count("-server"))