clef: don't error is pcsc is not installed

This commit is contained in:
Guillaume Ballet 2019-06-05 11:09:49 +02:00
parent 22d03be930
commit b0d66c994c

View file

@ -22,6 +22,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"math/big" "math/big"
"os"
"reflect" "reflect"
"strings" "strings"
@ -156,12 +157,22 @@ func StartClefAccountManager(ksLocation string, nousb, lightKDF bool, scpath str
// Start a smart card hub // Start a smart card hub
if len(scpath) > 0 { if len(scpath) > 0 {
// Sanity check that the smartcard path is valid
fi, err := os.Stat(scpath)
if err != nil {
log.Info("Smartcard socket file missing, disabling", "err", err)
} else {
if fi.Mode()&os.ModeType != os.ModeSocket {
log.Error("Invalid smartcard socket file type", "path", scpath, "type", fi.Mode().String())
} else {
if schub, err := scwallet.NewHub(scpath, scwallet.Scheme, ksLocation); err != nil { if schub, err := scwallet.NewHub(scpath, scwallet.Scheme, ksLocation); err != nil {
log.Warn(fmt.Sprintf("Failed to start smart card hub, disabling: %v", err)) log.Warn(fmt.Sprintf("Failed to start smart card hub, disabling: %v", err))
} else { } else {
backends = append(backends, schub) backends = append(backends, schub)
} }
} }
}
}
// Clef doesn't allow insecure http account unlock. // Clef doesn't allow insecure http account unlock.
return accounts.NewManager(&accounts.Config{InsecureUnlockAllowed: false}, backends...) return accounts.NewManager(&accounts.Config{InsecureUnlockAllowed: false}, backends...)