diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
commit | 2127637945ea6b763966398130e0770fa993c860 (patch) | |
tree | c976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/java/security | |
parent | bcb36c3e02e3bd2843aad1b9888513dfb5d6e337 (diff) | |
download | gcc-2127637945ea6b763966398130e0770fa993c860.zip gcc-2127637945ea6b763966398130e0770fa993c860.tar.gz gcc-2127637945ea6b763966398130e0770fa993c860.tar.bz2 |
Imported GNU Classpath 0.20
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include.
* java/nio/charset/spi/CharsetProvider.java: New override file.
* java/security/Security.java: Likewise.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r109831
Diffstat (limited to 'libjava/classpath/java/security')
-rw-r--r-- | libjava/classpath/java/security/MessageDigest.java | 5 | ||||
-rw-r--r-- | libjava/classpath/java/security/Security.java | 26 |
2 files changed, 25 insertions, 6 deletions
diff --git a/libjava/classpath/java/security/MessageDigest.java b/libjava/classpath/java/security/MessageDigest.java index 8684f20..8a6af64 100644 --- a/libjava/classpath/java/security/MessageDigest.java +++ b/libjava/classpath/java/security/MessageDigest.java @@ -1,5 +1,5 @@ /* MessageDigest.java --- The message digest interface. - Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -167,6 +167,9 @@ public abstract class MessageDigest extends MessageDigestSpi public static MessageDigest getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + if (provider != null) + provider = provider.trim(); + if (provider == null || provider.length() == 0) throw new IllegalArgumentException("Illegal provider"); diff --git a/libjava/classpath/java/security/Security.java b/libjava/classpath/java/security/Security.java index fd51d05..d26d049 100644 --- a/libjava/classpath/java/security/Security.java +++ b/libjava/classpath/java/security/Security.java @@ -1,5 +1,6 @@ /* Security.java --- Java base security class implementation - Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,6 +42,7 @@ package java.security; import gnu.classpath.SystemProperties; import gnu.classpath.Configuration; +import gnu.classpath.VMStackWalker; import java.io.IOException; import java.io.InputStream; @@ -354,6 +356,14 @@ public final class Security */ public static Provider getProvider(String name) { + if (name == null) + return null; + else + { + name = name.trim(); + if (name.length() == 0) + return null; + } Provider p; int max = providers.size (); for (int i = 0; i < max; i++) @@ -383,8 +393,11 @@ public final class Security */ public static String getProperty(String key) { + // XXX To prevent infinite recursion when the SecurityManager calls us, + // don't do a security check if the caller is trusted (by virtue of having + // been loaded by the bootstrap class loader). SecurityManager sm = System.getSecurityManager(); - if (sm != null) + if (sm != null && VMStackWalker.getCallingClassLoader() != null) sm.checkSecurityAccess("getProperty." + key); return secprops.getProperty(key); @@ -399,20 +412,23 @@ public final class Security * </p> * * @param key the name of the property to be set. - * @param datnum the value of the property to be set. + * @param datum the value of the property to be set. * @throws SecurityException if a security manager exists and its * {@link SecurityManager#checkPermission(Permission)} method denies access * to set the specified security property value. * @see #getProperty(String) * @see SecurityPermission */ - public static void setProperty(String key, String datnum) + public static void setProperty(String key, String datum) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkSecurityAccess("setProperty." + key); - secprops.put(key, datnum); + if (datum == null) + secprops.remove(key); + else + secprops.put(key, datum); } /** |