diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5bbae6d608..b35655f0e5 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -130,8 +130,8 @@ var ( } SmartCardFlag = cli.StringFlag{ Name: "pcscd-sock", - Usage: "Path to the smartcard daemon (pcscd) socket file (linux only)", - Value: "/run/pcscd/pcscd.comm", + Usage: "Path to the smartcard daemon (pcscd) socket file (unix only, leave empty for platform default)", + Value: "", } NetworkIdFlag = cli.Uint64Flag{ Name: "networkid", @@ -1153,16 +1153,20 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) { func setSmartCard(ctx *cli.Context, cfg *node.Config) { // No support for windows, currently if runtime.GOOS != "windows" { - // Check for the existence of the PCSCD socket file. If it exists, then - // the smartcard wallet will be enabled. There might still be some issues - // e.g. when the daemon is not running. Those issues are meant to be - // caught at the daemon initialization level, though. - if fi, err := os.Stat(ctx.GlobalString(SmartCardFlag.Name)); err == nil { - cfg.SmartCard = fi.Mode()&os.ModeType == os.ModeSocket - cfg.SmartCardDaemonPath = ctx.GlobalString(SmartCardFlag.Name) - fmt.Println(ctx.GlobalString(SmartCardFlag.Name)) - } else { - log.Error(ctx.GlobalString(SmartCardFlag.Name), "doesn't seem to be a socket file") + fmt.Println("setting smartcard") + cfg.SmartCard = true + + // Use the platform default unless specified on the command line + if len(ctx.GlobalString(SmartCardFlag.Name)) > 0 { + if fi, err := os.Stat(ctx.GlobalString(SmartCardFlag.Name)); err == nil { + if fi.Mode()&os.ModeType == os.ModeSocket { + cfg.SmartCardDaemonPath = ctx.GlobalString(SmartCardFlag.Name) + } else { + log.Error(ctx.GlobalString(SmartCardFlag.Name), "doesn't seem to be a socket file") + } + } else { + log.Error(ctx.GlobalString(SmartCardFlag.Name), "doesn't exist") + } } } else { log.Info("Smartcard support disabled on this platform") diff --git a/vendor/github.com/gballet/go-libpcsclite/doc.go b/vendor/github.com/gballet/go-libpcsclite/doc.go index d1085319ae..0f28c0c9c4 100644 --- a/vendor/github.com/gballet/go-libpcsclite/doc.go +++ b/vendor/github.com/gballet/go-libpcsclite/doc.go @@ -61,8 +61,6 @@ const ( SCardPowever = 0x0010 /* Card is powered */ SCardNegotiable = 0x0020 /* Ready for PTS */ SCardSpecific = 0x0040 /* PTS has been set */ - - PCSCDSockName = "/run/pcscd/pcscd.comm" ) // List of commands to send to the daemon diff --git a/vendor/github.com/gballet/go-libpcsclite/doc_bsd.go b/vendor/github.com/gballet/go-libpcsclite/doc_bsd.go new file mode 100644 index 0000000000..ddec46c670 --- /dev/null +++ b/vendor/github.com/gballet/go-libpcsclite/doc_bsd.go @@ -0,0 +1,35 @@ +// BSD 3-Clause License +// +// Copyright (c) 2019, Guillaume Ballet +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build dragonfly darwin freebsd netbsd openbsd solaris + +package pcsc + +const PCSCDSockName string = "/var/run/pcscd/pcscd.comm" \ No newline at end of file diff --git a/vendor/github.com/gballet/go-libpcsclite/doc_linux.go b/vendor/github.com/gballet/go-libpcsclite/doc_linux.go new file mode 100644 index 0000000000..becbf16775 --- /dev/null +++ b/vendor/github.com/gballet/go-libpcsclite/doc_linux.go @@ -0,0 +1,35 @@ +// BSD 3-Clause License +// +// Copyright (c) 2019, Guillaume Ballet +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +build linux + +package pcsc + +const PCSCDSockName string = "/run/pcscd/pcscd.comm" \ No newline at end of file diff --git a/vendor/vendor.json b/vendor/vendor.json index 957a4d32ce..e4ae7e8479 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -135,10 +135,10 @@ "revisionTime": "2018-04-18T12:24:29Z" }, { - "checksumSHA1": "aG2cEBkWshLrW0snEymuR6vNZYs=", + "checksumSHA1": "eHo1jkpsFxpx+Lrr+IUSuAGvvcc=", "path": "github.com/gballet/go-libpcsclite", - "revision": "c11b1ec2c86bc1d38a95f14ae6662f23bf17bc37", - "revisionTime": "2019-05-17T11:38:18Z" + "revision": "5cd7d9d0621fe859226db72d0bf26c610c0207af", + "revisionTime": "2019-05-21T09:24:06Z" }, { "checksumSHA1": "gxV/cPPLkByTdY8y172t7v4qcZA=",