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

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


The following commit(s) were added to refs/heads/master by this push:
     new 96a1e0192c Fix t3c cookie issue when user changes (#6725)
96a1e0192c is described below

commit 96a1e0192c92d3b2efd69d7b9eb462a071f8c630
Author: Joe Pappano <[email protected]>
AuthorDate: Thu Apr 7 16:34:41 2022 -0400

    Fix t3c cookie issue when user changes (#6725)
    
    * added func to write cookie to filesystem.
    
    * changed cookie file name to contain the TO username.
---
 cache-config/t3c-request/t3c-request.go | 2 +-
 cache-config/t3c-update/t3c-update.go   | 2 +-
 cache-config/t3cutil/toreq/client.go    | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cache-config/t3c-request/t3c-request.go 
b/cache-config/t3c-request/t3c-request.go
index 821ee80cdc..4f94fc186c 100644
--- a/cache-config/t3c-request/t3c-request.go
+++ b/cache-config/t3c-request/t3c-request.go
@@ -68,5 +68,5 @@ func main() {
                        os.Exit(3)
                }
        }
-       cfg.TCCfg.TOClient.WriteFsCookie(toreq.FsCookiePath)
+       cfg.TCCfg.TOClient.WriteFsCookie(toreq.FsCookiePath + cfg.TOUser + 
".cookie")
 }
diff --git a/cache-config/t3c-update/t3c-update.go 
b/cache-config/t3c-update/t3c-update.go
index 310a4f3db4..31f9884ef5 100644
--- a/cache-config/t3c-update/t3c-update.go
+++ b/cache-config/t3c-update/t3c-update.go
@@ -80,5 +80,5 @@ func main() {
        } else {
                log.Infoln("Update successfully completed")
        }
-
+       cfg.TCCfg.TOClient.WriteFsCookie(toreq.FsCookiePath + cfg.TOUser + 
".cookie")
 }
diff --git a/cache-config/t3cutil/toreq/client.go 
b/cache-config/t3cutil/toreq/client.go
index 289eddafac..5f5d97ddfb 100644
--- a/cache-config/t3cutil/toreq/client.go
+++ b/cache-config/t3cutil/toreq/client.go
@@ -68,14 +68,14 @@ func (cl *TOClient) SetURL(newURL string) {
        }
 }
 
-const FsCookiePath = `/var/lib/trafficcontrol-cache-config/fsCookie`
+const FsCookiePath = `/var/lib/trafficcontrol-cache-config/`
 
 // New logs into Traffic Ops, returning the TOClient which contains the 
logged-in client.
 func New(url *url.URL, user string, pass string, insecure bool, timeout 
time.Duration, userAgent string) (*TOClient, error) {
        log.Infoln("URL: '" + url.String() + "' User: '" + user + "' Pass len: 
'" + strconv.Itoa(len(pass)) + "'")
 
        client := &TOClient{}
-       fsCookie, err := torequtil.GetFsCookie(FsCookiePath)
+       fsCookie, err := torequtil.GetFsCookie(FsCookiePath + user + ".cookie")
        if err != nil {
                log.Infoln("Error retrieving cookie: ", err)
        }

Reply via email to