Skip to content

Commit

Permalink
Reverting go-piv#51
Browse files Browse the repository at this point in the history
  • Loading branch information
ava1ar committed Jan 10, 2021
1 parent 4ef2678 commit 90632f9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
2 changes: 1 addition & 1 deletion piv/pcsc_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c *scContext) Connect(reader string) (*scHandle, error) {
activeProtocol C.DWORD
)
rc := C.SCardConnect(c.ctx, C.CString(reader),
C.SCARD_SHARE_EXCLUSIVE, C.SCARD_PROTOCOL_T1,
C.SCARD_SHARE_SHARED, C.SCARD_PROTOCOL_T1,
&handle, &activeProtocol)
if err := scCheck(rc); err != nil {
return nil, err
Expand Down
38 changes: 0 additions & 38 deletions piv/piv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,44 +105,6 @@ func TestNewYubiKey(t *testing.T) {
defer close()
}

func TestMultipleConnections(t *testing.T) {
cards, err := Cards()
if err != nil {
t.Fatalf("listing cards: %v", err)
}
for _, card := range cards {
if !strings.Contains(strings.ToLower(card), "yubikey") {
continue
}
if !canModifyYubiKey {
t.Skip("not running test that accesses yubikey, provide --wipe-yubikey flag")
}
yk, err := Open(card)
if err != nil {
t.Fatalf("getting new yubikey: %v", err)
}
defer func() {
if err := yk.Close(); err != nil {
t.Errorf("closing yubikey: %v", err)
}
}()

_, oerr := Open(card)
if oerr == nil {
t.Fatalf("expected second open operation to fail")
}
var e *scErr
if !errors.As(oerr, &e) {
t.Fatalf("expected scErr, got %v", oerr)
}
if e.rc != 0x8010000B {
t.Fatalf("expected return code 0x8010000B, got 0x%x", e.rc)
}
return
}
t.Skip("no yubikeys detected, skipping")
}

func TestYubiKeySerial(t *testing.T) {
yk, close := newTestYubiKey(t)
defer close()
Expand Down

0 comments on commit 90632f9

Please sign in to comment.