go-hep.org/x/hep@v0.38.1/xrootd/xrdproto/auth/krb5/krb5_unix.go (about) 1 // Copyright ©2018 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build !windows 6 7 package krb5 8 9 import ( 10 "fmt" 11 "os" 12 "os/user" 13 "path/filepath" 14 "strings" 15 ) 16 17 // FIXME(sbinet): may be overwritten by $KRB5_CONFIG 18 // FIXME(sbinet): Linux puts it at: /etc/krb5.conf 19 // others may put it at: /etc/krb5/krb5.conf 20 21 const configPath = "/etc/krb5.conf" 22 23 func cachePath() string { 24 if v := os.Getenv("KRB5CCNAME"); v != "" { 25 if strings.HasPrefix(v, "FILE:") { 26 v = string(v[len("FILE:"):]) 27 } 28 return v 29 } 30 31 usr, err := user.Current() 32 if err != nil { 33 return "" 34 } 35 36 v := filepath.Join(os.TempDir(), fmt.Sprintf("krb5cc_%s", usr.Uid)) 37 return v 38 }