Blob Blame History Raw
# 8009550, RH910107: PlatformPCSC should load versioned so
# Author: Andrew Hughes <gnu.andrew@redhat.com>
# Copyright 2019 Red Hat, Inc.

diff --git openjdk.orig///src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java openjdk///src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
--- openjdk.orig/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
+++ openjdk/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
@@ -48,9 +48,13 @@
 
     private final static String PROP_NAME = "sun.security.smartcardio.library";
 
-    private final static String LIB1 = "/usr/$LIBISA/libpcsclite.so";
-    private final static String LIB2 = "/usr/local/$LIBISA/libpcsclite.so";
-    private final static String PCSC_FRAMEWORK = "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC";
+    private final static String[] SYSTEM_LIBS = {
+        "/usr/$LIBISA/libpcsclite.so",
+        "/usr/local/$LIBISA/libpcsclite.so",
+        "/usr/$LIBISA/libpcsclite.so.1",
+        "/usr/local/$LIBISA/libpcsclite.so.1",
+        "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC"
+    };
 
     PlatformPCSC() {
         // empty
@@ -104,20 +108,12 @@
         if (lib.length() != 0) {
             return lib;
         }
-        lib = expand(LIB1);
-        if (new File(lib).isFile()) {
-            // if LIB1 exists, use that
-            return lib;
-        }
-        lib = expand(LIB2);
-        if (new File(lib).isFile()) {
-            // if LIB2 exists, use that
-            return lib;
-        }
-        lib = PCSC_FRAMEWORK;
-        if (new File(lib).isFile()) {
-            // if PCSC.framework exists, use that
-            return lib;
+        for (String sysLib : SYSTEM_LIBS) {
+            lib = expand(sysLib);
+            if (new File(lib).isFile()) {
+                // if sysLib exists, use that
+                return lib;
+            }
         }
         throw new IOException("No PC/SC library found on this system");
     }