From 66d74dfb75e2001d0040e8b2a2d5add26e51db07 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 13 May 2016 23:59:19 +0200 Subject: [PATCH] [release 1.4.5] cmd/geth: fix console history exclusion Calls to 'personal' API should be excluded from console history because they can be called with an account passphrase as argument. The check for such calls was inverted and didn't work. (cherry picked from commit 86da6feb40fd366c75236d87fa306576c51ed2a8) Conflicts: cmd/geth/js.go --- cmd/geth/js.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 69c03f4c40..729cc2fd71 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -41,7 +41,6 @@ import ( ) var ( - leadingSpace = regexp.MustCompile("^ ") passwordRegexp = regexp.MustCompile("personal.[nus]") onlyws = regexp.MustCompile("^\\s*$") exit = regexp.MustCompile("^\\s*exit\\s*;*\\s*$") @@ -361,7 +360,7 @@ func (self *jsre) interactive() { str += input + "\n" self.setIndent() if indentCount <= 0 { - if mustLogInHistory(str) { + if !excludeFromHistory(str) { utils.Stdin.AppendHistory(str[:len(str)-1]) } self.parseInput(str) @@ -371,10 +370,8 @@ func (self *jsre) interactive() { } } -func mustLogInHistory(input string) bool { - return len(input) == 0 || - passwordRegexp.MatchString(input) || - !leadingSpace.MatchString(input) +func excludeFromHistory(input string) bool { + return len(input) == 0 || input[0] == ' ' || passwordRegexp.MatchString(input) } func (self *jsre) withHistory(datadir string, op func(*os.File)) {