mirror of https://gogs.blitter.com/RLabs/xs
Fixed bug in fallback from authtoken (-g) to password login
This commit is contained in:
parent
19697d5164
commit
d25b883873
|
@ -94,8 +94,8 @@ func AuthUserByToken(username string, connhostname string, auth string) (valid b
|
|||
}
|
||||
record[0] = strings.TrimSpace(record[0])
|
||||
record[1] = strings.TrimSpace(record[1])
|
||||
fmt.Println("auth:", auth, "record:",
|
||||
strings.Join([]string{record[0], record[1]}, ":"))
|
||||
//fmt.Println("auth:", auth, "record:",
|
||||
// strings.Join([]string{record[0], record[1]}, ":"))
|
||||
|
||||
if (connhostname == record[0]) &&
|
||||
(auth == strings.Join([]string{record[0], record[1]}, ":")) {
|
||||
|
|
|
@ -482,10 +482,6 @@ func main() {
|
|||
idx := strings.Index(string(ab), remoteHost)
|
||||
if idx >= 0 {
|
||||
ab = ab[idx:]
|
||||
} else {
|
||||
fmt.Fprintln(os.Stderr, "ERROR: no matching authtoken")
|
||||
os.Exit(1)
|
||||
}
|
||||
entries := strings.SplitN(string(ab), "\n", -1)
|
||||
//if len(entries) > 0 {
|
||||
//fmt.Println("entries[0]:", entries[0])
|
||||
|
@ -497,6 +493,9 @@ func main() {
|
|||
// Security scrub
|
||||
ab = nil
|
||||
runtime.GC()
|
||||
} else {
|
||||
fmt.Fprintln(os.Stderr, "ERROR: no matching authtoken")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue