| 212 | } |
| 213 | |
| 214 | static bool InitRPCAuthentication() |
| 215 | { |
| 216 | if (gArgs.GetArg("-rpcpassword", "") == "") |
| 217 | { |
| 218 | LogPrintf("No rpcpassword set - using random cookie authentication.\n"); |
| 219 | if (!GenerateAuthCookie(&strRPCUserColonPass)) { |
| 220 | uiInterface.ThreadSafeMessageBox( |
| 221 | _("Error: A fatal internal error occurred, see debug.log for details"), // Same message as AbortNode |
| 222 | "", CClientUIInterface::MSG_ERROR); |
| 223 | return false; |
| 224 | } |
| 225 | } else { |
| 226 | LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.\n"); |
| 227 | strRPCUserColonPass = gArgs.GetArg("-rpcuser", "") + ":" + gArgs.GetArg("-rpcpassword", ""); |
| 228 | } |
| 229 | if (gArgs.GetArg("-rpcauth","") != "") |
| 230 | { |
| 231 | LogPrintf("Using rpcauth authentication.\n"); |
| 232 | } |
| 233 | return true; |
| 234 | } |
| 235 | |
| 236 | bool StartHTTPRPC() |
| 237 | { |
no test coverage detected