This is an automated email from the ASF dual-hosted git repository.

rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git

commit 1147ac076bc97b2728e410b375fd5011d4e89c21
Author: Dylan Volz <dylan_v...@comcast.com>
AuthorDate: Mon May 7 14:59:27 2018 -0600

    rename scrypt password function to make login logic clearer
---
 traffic_ops/traffic_ops_golang/auth/authenticate.go      | 4 ++--
 traffic_ops/traffic_ops_golang/auth/authenticate_test.go | 6 +++---
 traffic_ops/traffic_ops_golang/auth/login.go             | 4 ++--
 traffic_ops/traffic_ops_golang/config/config.go          | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/auth/authenticate.go 
b/traffic_ops/traffic_ops_golang/auth/authenticate.go
index 5b9b141..1835e72 100644
--- a/traffic_ops/traffic_ops_golang/auth/authenticate.go
+++ b/traffic_ops/traffic_ops_golang/auth/authenticate.go
@@ -89,9 +89,9 @@ func DerivePassword(password string) (string, error) {
        return strings.Join(scryptPass, KEY_DELIM), nil
 }
 
-// VerifyPassword parses the original Derived Key (DK) from the SCRYPT password
+// VerifySCRYPTPassword parses the original Derived Key (DK) from the SCRYPT 
password
 // so that it can compare that with the password/scriptPassword param
-func VerifyPassword(password string, scryptPassword string) error {
+func VerifySCRYPTPassword(password string, scryptPassword string) error {
 
        scomp, err := parseScrypt(scryptPassword)
        if err != nil {
diff --git a/traffic_ops/traffic_ops_golang/auth/authenticate_test.go 
b/traffic_ops/traffic_ops_golang/auth/authenticate_test.go
index b8d0826..036986e 100644
--- a/traffic_ops/traffic_ops_golang/auth/authenticate_test.go
+++ b/traffic_ops/traffic_ops_golang/auth/authenticate_test.go
@@ -27,7 +27,7 @@ func TestDeriveGoodPassword(t *testing.T) {
 
        pass := "password"
        derivedPassword, err := DerivePassword(pass)
-       err = VerifyPassword(pass, derivedPassword)
+       err = VerifySCRYPTPassword(pass, derivedPassword)
        if err != nil {
                t.Errorf("password should be valid")
        }
@@ -37,7 +37,7 @@ func TestDeriveBadPassword(t *testing.T) {
 
        pass := "password"
        derivedPassword, err := DerivePassword(pass)
-       err = VerifyPassword("badpassword", derivedPassword)
+       err = VerifySCRYPTPassword("badpassword", derivedPassword)
        if err == nil {
                t.Errorf("password should be invalid")
        }
@@ -45,7 +45,7 @@ func TestDeriveBadPassword(t *testing.T) {
 
 func TestScryptPasswordIsRequired(t *testing.T) {
 
-       err := VerifyPassword("password", "")
+       err := VerifySCRYPTPassword("password", "")
        if err == nil {
                t.Errorf("scrypt password should be required")
        }
diff --git a/traffic_ops/traffic_ops_golang/auth/login.go 
b/traffic_ops/traffic_ops_golang/auth/login.go
index 23a9705..8e4123c 100644
--- a/traffic_ops/traffic_ops_golang/auth/login.go
+++ b/traffic_ops/traffic_ops_golang/auth/login.go
@@ -123,9 +123,9 @@ func checkLocalUserPassword(form passwordForm, db *sqlx.DB) 
(bool, error) {
        if err != nil {
                return false, err
        }
-       err = VerifyPassword(form.Password, hashedPassword)
+       err = VerifySCRYPTPassword(form.Password, hashedPassword)
        if err != nil {
-               if hashedPassword == sha1Hex(form.Password) {
+               if hashedPassword == sha1Hex(form.Password) { // for backwards 
compatibility
                        return true, nil
                }
                return false, err
diff --git a/traffic_ops/traffic_ops_golang/config/config.go 
b/traffic_ops/traffic_ops_golang/config/config.go
index 59fdee4..64d7a34 100644
--- a/traffic_ops/traffic_ops_golang/config/config.go
+++ b/traffic_ops/traffic_ops_golang/config/config.go
@@ -159,7 +159,7 @@ func LoadConfig(cdnConfPath string, dbConfPath string, 
riakConfPath string, appV
        if cfg.LDAPConfPath != "" {
                cfg.LDAPEnabled, cfg.ConfigLDAP, err = 
GetLDAPConfig(cfg.LDAPConfPath)
                if err != nil {
-                       cfg.LDAPEnabled = false // probably unnecessary
+                       cfg.LDAPEnabled = false
                        return cfg, fmt.Errorf("parsing ldap config '%s': %v", 
cfg.LDAPConfPath, err)
                }
        } else {

-- 
To stop receiving notification emails like this one, please contact
r...@apache.org.

Reply via email to