jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java
changeset 23582 d5fa3327ab3a
parent 23010 6dadb192ad81
equal deleted inserted replaced
23581:0ca496340112 23582:d5fa3327ab3a
    48 import sun.misc.HexDumpEncoder;
    48 import sun.misc.HexDumpEncoder;
    49 import sun.security.provider.certpath.X509CertificatePair;
    49 import sun.security.provider.certpath.X509CertificatePair;
    50 import sun.security.util.Cache;
    50 import sun.security.util.Cache;
    51 import sun.security.util.Debug;
    51 import sun.security.util.Debug;
    52 import sun.security.x509.X500Name;
    52 import sun.security.x509.X500Name;
    53 import sun.security.action.GetBooleanAction;
       
    54 import sun.security.action.GetPropertyAction;
       
    55 
    53 
    56 /**
    54 /**
    57  * A <code>CertStore</code> that retrieves <code>Certificates</code> and
    55  * A <code>CertStore</code> that retrieves <code>Certificates</code> and
    58  * <code>CRL</code>s from an LDAP directory, using the PKIX LDAP V2 Schema
    56  * <code>CRL</code>s from an LDAP directory, using the PKIX LDAP V2 Schema
    59  * (RFC 2587):
    57  * (RFC 2587):
   144     private final static String PROP_DISABLE_APP_RESOURCE_FILES =
   142     private final static String PROP_DISABLE_APP_RESOURCE_FILES =
   145         "sun.security.certpath.ldap.disable.app.resource.files";
   143         "sun.security.certpath.ldap.disable.app.resource.files";
   146 
   144 
   147     static {
   145     static {
   148         String s = AccessController.doPrivileged(
   146         String s = AccessController.doPrivileged(
   149                                 new GetPropertyAction(PROP_LIFETIME));
   147             (PrivilegedAction<String>) () -> System.getProperty(PROP_LIFETIME));
   150         if (s != null) {
   148         if (s != null) {
   151             LIFETIME = Integer.parseInt(s); // throws NumberFormatException
   149             LIFETIME = Integer.parseInt(s); // throws NumberFormatException
   152         } else {
   150         } else {
   153             LIFETIME = DEFAULT_CACHE_LIFETIME;
   151             LIFETIME = DEFAULT_CACHE_LIFETIME;
   154         }
   152         }
   247                 "com.sun.jndi.ldap.LdapCtxFactory");
   245                 "com.sun.jndi.ldap.LdapCtxFactory");
   248         env.put(Context.PROVIDER_URL, url);
   246         env.put(Context.PROVIDER_URL, url);
   249 
   247 
   250         // If property is set to true, disable application resource file lookup.
   248         // If property is set to true, disable application resource file lookup.
   251         boolean disableAppResourceFiles = AccessController.doPrivileged(
   249         boolean disableAppResourceFiles = AccessController.doPrivileged(
   252             new GetBooleanAction(PROP_DISABLE_APP_RESOURCE_FILES));
   250             (PrivilegedAction<Boolean>) () -> Boolean.getBoolean(PROP_DISABLE_APP_RESOURCE_FILES));
   253         if (disableAppResourceFiles) {
   251         if (disableAppResourceFiles) {
   254             if (debug != null) {
   252             if (debug != null) {
   255                 debug.println("LDAPCertStore disabling app resource files");
   253                 debug.println("LDAPCertStore disabling app resource files");
   256             }
   254             }
   257             env.put("com.sun.naming.disable.app.resource.files", "true");
   255             env.put("com.sun.naming.disable.app.resource.files", "true");