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,21 +482,20 @@ func main() {
|
|||
idx := strings.Index(string(ab), remoteHost)
|
||||
if idx >= 0 {
|
||||
ab = ab[idx:]
|
||||
entries := strings.SplitN(string(ab), "\n", -1)
|
||||
//if len(entries) > 0 {
|
||||
//fmt.Println("entries[0]:", entries[0])
|
||||
authCookie = strings.TrimSpace(entries[0])
|
||||
//} else {
|
||||
// fmt.Fprintln(os.Stderr, "ERROR: no matching authtoken")
|
||||
// os.Exit(1)
|
||||
//}
|
||||
// Security scrub
|
||||
ab = nil
|
||||
runtime.GC()
|
||||
} 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])
|
||||
authCookie = strings.TrimSpace(entries[0])
|
||||
//} else {
|
||||
// fmt.Fprintln(os.Stderr, "ERROR: no matching authtoken")
|
||||
// os.Exit(1)
|
||||
//}
|
||||
// Security scrub
|
||||
ab = nil
|
||||
runtime.GC()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue