mirror of https://gogs.blitter.com/RLabs/xs
Better error handling (no panic) for client connrefused
Server logs error w/o exiting if missing hkexsh.passwd file Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
parent
cbf3c77342
commit
5511fc83cd
|
@ -37,8 +37,7 @@ func AuthUserByPasswd(username string, auth string, fname string) (valid bool, a
|
||||||
b, e := ioutil.ReadFile(fname) // nolint: gosec
|
b, e := ioutil.ReadFile(fname) // nolint: gosec
|
||||||
if e != nil {
|
if e != nil {
|
||||||
valid = false
|
valid = false
|
||||||
log.Println("ERROR: Cannot read hkexsh.passwd file!")
|
log.Printf("ERROR: Cannot read %s!\n", fname)
|
||||||
log.Fatal(e)
|
|
||||||
}
|
}
|
||||||
r := csv.NewReader(bytes.NewReader(b))
|
r := csv.NewReader(bytes.NewReader(b))
|
||||||
|
|
||||||
|
|
|
@ -781,7 +781,7 @@ func main() {
|
||||||
conn, err := hkexnet.Dial("tcp", server, cipherAlg, hmacAlg, kexAlg)
|
conn, err := hkexnet.Dial("tcp", server, cipherAlg, hmacAlg, kexAlg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
panic(err)
|
os.Exit(3)
|
||||||
}
|
}
|
||||||
defer conn.Close() // nolint: errcheck
|
defer conn.Close() // nolint: errcheck
|
||||||
// From this point on, conn is a secure encrypted channel
|
// From this point on, conn is a secure encrypted channel
|
||||||
|
|
Loading…
Reference in New Issue