From e6f163e61e4fcf13038d5775c079e3da27637282 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Wed, 9 Oct 2019 11:08:42 +0000 Subject: [PATCH] rpcclient: Try user+pass auth before cookie auth --- rpcclient/infrastructure.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 42aeb49f..8609e7c5 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -1171,12 +1171,12 @@ type ConnConfig struct { // path is configured; if not, it will be the user-configured username and // passphrase. func (config *ConnConfig) getAuth() (username, passphrase string, err error) { - // If cookie auth isn't in use, just use the supplied - // username/passphrase. - if config.CookiePath == "" { + // Try username+passphrase auth first. + if config.Pass != "" { return config.User, config.Pass, nil } + // If no username or passphrase is set, try cookie auth. return config.retrieveCookie() }