From 6830a61ff157d9c535ba43ef76acea3295c2eafd Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 1 Jan 2013 02:04:19 -0800 Subject: [PATCH 1/5] Make validation_create require admin. --- src/cpp/ripple/RPCHandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 123400760..74dc71c67 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1353,8 +1353,10 @@ Json::Value RPCHandler::doAccountTransactions(Json::Value jvRequest) } // { -// secret: +// secret: // optional // } +// +// This command requires admin access because it makes no sense to ask an untrusted server for this. Json::Value RPCHandler::doValidationCreate(Json::Value jvRequest) { RippleAddress raSeed; Json::Value obj(Json::objectValue); @@ -1518,6 +1520,7 @@ Json::Value RPCHandler::doWalletPropose(Json::Value jvRequest) Json::Value obj(Json::objectValue); obj["master_seed"] = naSeed.humanSeed(); + obj["master_seed_hex"] = naSeed.getSeed().ToString(); //obj["master_key"] = naSeed.humanSeed1751(); obj["account_id"] = naAccount.humanAccountID(); @@ -2455,7 +2458,7 @@ Json::Value RPCHandler::doCommand(Json::Value& jvRequest, int iRole) { "unl_reset", &RPCHandler::doUnlReset, true, optNone }, { "unl_score", &RPCHandler::doUnlScore, true, optNone }, - { "validation_create", &RPCHandler::doValidationCreate, false, optNone }, + { "validation_create", &RPCHandler::doValidationCreate, true, optNone }, { "validation_seed", &RPCHandler::doValidationSeed, false, optNone }, { "wallet_accounts", &RPCHandler::doWalletAccounts, false, optCurrent }, From 3da7b9b90b64a00e99e68afd4b1b3775f2ae6118 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 1 Jan 2013 12:00:40 -0800 Subject: [PATCH 2/5] Add a utility to create a gravatar hash. --- bin/email_hash.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 bin/email_hash.js diff --git a/bin/email_hash.js b/bin/email_hash.js new file mode 100755 index 000000000..4ba07c9e0 --- /dev/null +++ b/bin/email_hash.js @@ -0,0 +1,17 @@ +#!/usr/bin/node +// +// Returns a Gravatar stle hash as per: http://en.gravatar.com/site/implement/hash/ +// + +if (process.argv.length != 3) { + process.stderr.write("Usage: " + process.argv[1] + " email_address\n\nReturns gravitar style hash.\n"); + +} else { + var md5 = require('crypto').createHash('md5'); + + md5.update(process.argv[2].trim().toLowerCase()); + + process.stdout.write(md5.digest('hex') + "\n"); +} + +// vim:sw=2:sts=2:ts=8:et From 2023e4266b669f7abf1731f1407d77d353c22e1c Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 1 Jan 2013 12:34:53 -0800 Subject: [PATCH 3/5] Add a utility to hexify a string. --- bin/hexify.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/hexify.js diff --git a/bin/hexify.js b/bin/hexify.js new file mode 100755 index 000000000..231ee8b68 --- /dev/null +++ b/bin/hexify.js @@ -0,0 +1,22 @@ +#!/usr/bin/node +// +// Returns hex of string. +// + +var stringToHex = function (s) { + return Array.prototype.map.call(s, function (c) { + var b = c.charCodeAt(0); + + return b < 16 ? "0" + b.toString(16) : b.toString(16); + }).join(""); +}; + +if (process.argv.length != 3) { + process.stderr.write("Usage: " + process.argv[1] + " string\n\nReturns hex of lowercasing string.\n"); + +} else { + + process.stdout.write(stringToHex(process.argv[2].toLowerCase()) + "\n"); +} + +// vim:sw=2:sts=2:ts=8:et From c78f3520350e75800f502dad0fbe0cf18fde865d Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 1 Jan 2013 12:35:35 -0800 Subject: [PATCH 4/5] Add default fee for AccountSet. --- src/cpp/ripple/RPCHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 74dc71c67..30d5de75f 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1006,7 +1006,9 @@ Json::Value RPCHandler::doSubmit(Json::Value jvRequest) } if (!txJSON.isMember("Fee") - && ("OfferCreate" == txJSON["TransactionType"].asString() + && ( + "AccountSet" == txJSON["TransactionType"].asString() + || "OfferCreate" == txJSON["TransactionType"].asString() || "OfferCancel" == txJSON["TransactionType"].asString() || "TrustSet" == txJSON["TransactionType"].asString())) { From f09543fe8ac451988efb5be229764ede843767e7 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 1 Jan 2013 14:35:59 -0800 Subject: [PATCH 5/5] Cosmetic. --- bin/hexify.js | 2 +- rippled-example.cfg | 2 +- src/cpp/ripple/Config.cpp | 1 - test/jsonrpc-test.js | 3 --- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/hexify.js b/bin/hexify.js index 231ee8b68..1c14f646f 100755 --- a/bin/hexify.js +++ b/bin/hexify.js @@ -1,6 +1,6 @@ #!/usr/bin/node // -// Returns hex of string. +// Returns hex of lowercasing a string. // var stringToHex = function (s) { diff --git a/rippled-example.cfg b/rippled-example.cfg index 3e6ba5bc0..c37cd9c0e 100644 --- a/rippled-example.cfg +++ b/rippled-example.cfg @@ -52,7 +52,7 @@ # # [ips]: # Only valid in "rippled.cfg", "ripple.txt", and the referered [ips_url]. -# List of ips where the Newcoin protocol is avialable. +# List of ips where the Ripple protocol is avialable. # One ipv4 or ipv6 address per line. # A port may optionally be specified after adding a space to the address. # By convention, if known, IPs are listed in from most to least trusted. diff --git a/src/cpp/ripple/Config.cpp b/src/cpp/ripple/Config.cpp index d60cbc6f9..943b5b727 100644 --- a/src/cpp/ripple/Config.cpp +++ b/src/cpp/ripple/Config.cpp @@ -274,7 +274,6 @@ void Config::load() sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT); sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN); sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY); - if (sectionSingleB(secConfig, SECTION_VALIDATION_SEED, strTemp)) { diff --git a/test/jsonrpc-test.js b/test/jsonrpc-test.js index 1c1421666..ffad70ba6 100644 --- a/test/jsonrpc-test.js +++ b/test/jsonrpc-test.js @@ -20,9 +20,6 @@ var serverDelay = 1500; buster.testRunner.timeout = 5000; -var HttpServer = function () { -}; - var server; var server_events;