Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org> Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. From-SVN: r116139
This commit is contained in:
parent
abab460491
commit
ac1ed908de
1294 changed files with 99479 additions and 35933 deletions
|
@ -137,7 +137,7 @@ public class ConsoleCallbackHandler extends AbstractCallbackHandler
|
|||
{
|
||||
if (choices[i].equals(replies[j]))
|
||||
{
|
||||
indices.add(new Integer(i));
|
||||
indices.add(Integer.valueOf(i));
|
||||
}
|
||||
}
|
||||
if (indices.size() == 0)
|
||||
|
|
|
@ -38,12 +38,15 @@ exception statement from your version. */
|
|||
|
||||
package gnu.javax.security.auth.login;
|
||||
|
||||
import gnu.java.security.Configuration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.security.auth.login.AppConfigurationEntry;
|
||||
|
||||
|
@ -88,26 +91,12 @@ import javax.security.auth.login.AppConfigurationEntry;
|
|||
*/
|
||||
public final class ConfigFileParser
|
||||
{
|
||||
// Constants and fields
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private static final void debug(String m) {if (DEBUG) System.err.println(m);};
|
||||
|
||||
private static final Logger log = Logger.getLogger(ConfigFileParser.class.getName());
|
||||
private ConfigFileTokenizer cft;
|
||||
private Map map = new HashMap();
|
||||
|
||||
// Constructor(s)
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// default 0-arguments constructor
|
||||
|
||||
// Class methods
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Instance methods
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns the parse result as a {@link Map} where the keys are application
|
||||
* names, and the entries are {@link List}s of {@link AppConfigurationEntry}
|
||||
|
@ -161,7 +150,8 @@ public final class ConfigFileParser
|
|||
}
|
||||
|
||||
String appName = cft.sval;
|
||||
debug("DEBUG: APP_NAME_OR_OTHER = " + appName);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("APP_NAME_OR_OTHER = " + appName);
|
||||
if (cft.nextToken() != '{')
|
||||
abort("Missing '{' after APP_NAME_OR_OTHER");
|
||||
|
||||
|
@ -202,13 +192,15 @@ public final class ConfigFileParser
|
|||
}
|
||||
|
||||
String clazz = validateClassName(cft.sval);
|
||||
debug("DEBUG: MODULE_CLASS = " + clazz);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("MODULE_CLASS = " + clazz);
|
||||
|
||||
if (cft.nextToken() != ConfigFileTokenizer.TT_WORD)
|
||||
abort("Was expecting FLAG but found none");
|
||||
|
||||
String flag = cft.sval;
|
||||
debug("DEBUG: FLAG = " + flag);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("DEBUG: FLAG = " + flag);
|
||||
AppConfigurationEntry.LoginModuleControlFlag f = null;
|
||||
if (flag.equalsIgnoreCase("required"))
|
||||
f = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
|
||||
|
@ -230,32 +222,39 @@ public final class ConfigFileParser
|
|||
abort("Was expecting PARAM_NAME but got '" + ((char) c) + "'");
|
||||
|
||||
paramName = cft.sval;
|
||||
debug("DEBUG: PARAM_NAME = " + paramName);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("PARAM_NAME = " + paramName);
|
||||
if (cft.nextToken() != '=')
|
||||
abort("Missing '=' after PARAM_NAME");
|
||||
|
||||
c = cft.nextToken();
|
||||
if (c != '"' && c != '\'')
|
||||
debug(" WARN: Was expecting a quoted string but got no quote " +
|
||||
"character. Assume unquoted string");
|
||||
|
||||
{
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("Was expecting a quoted string but got no quote character."
|
||||
+ " Assume unquoted string");
|
||||
}
|
||||
paramValue = expandParamValue(cft.sval);
|
||||
debug("DEBUG: PARAM_VALUE = " + paramValue);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("PARAM_VALUE = " + paramValue);
|
||||
options.put(paramName, paramValue);
|
||||
|
||||
c = cft.nextToken();
|
||||
}
|
||||
|
||||
AppConfigurationEntry ace = new AppConfigurationEntry(clazz, f, options);
|
||||
debug("DEBUG: LOGIN_MODULE_ENTRY = " + ace);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("LOGIN_MODULE_ENTRY = " + ace);
|
||||
listOfACEs.add(ace);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void abort(String m) throws IOException
|
||||
{
|
||||
debug("ERROR: " + m);
|
||||
debug("DEBUG: Map (so far) = " + String.valueOf(map));
|
||||
if (Configuration.DEBUG)
|
||||
{
|
||||
log.fine(m);
|
||||
log.fine("Map (so far) = " + String.valueOf(map));
|
||||
}
|
||||
throw new IOException(m);
|
||||
}
|
||||
|
||||
|
@ -264,12 +263,13 @@ public final class ConfigFileParser
|
|||
if (cn.startsWith(".") || cn.endsWith("."))
|
||||
abort("MODULE_CLASS MUST NOT start or end with a '.'");
|
||||
|
||||
String[] tokens = cn.split(".");
|
||||
String[] tokens = cn.split("\\.");
|
||||
for (int i = 0; i < tokens.length; i++)
|
||||
{
|
||||
String t = tokens[i];
|
||||
if (Character.isJavaIdentifierStart(cn.toCharArray()[0]))
|
||||
abort("");
|
||||
if (! Character.isJavaIdentifierStart(t.charAt(0)))
|
||||
abort("Class name [" + cn
|
||||
+ "] contains an invalid sub-package identifier: " + t);
|
||||
|
||||
// we dont check the rest of the characters for isJavaIdentifierPart()
|
||||
// because that's what the tokenizer does.
|
||||
|
@ -311,14 +311,17 @@ public final class ConfigFileParser
|
|||
int j = s.indexOf("}", i + 2);
|
||||
if (j == -1)
|
||||
{
|
||||
debug(" WARN: Found a ${ prefix with no } suffix. Ignore");
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("Found a ${ prefix with no } suffix. Ignore");
|
||||
break;
|
||||
}
|
||||
|
||||
String sysPropName = s.substring(i + 2, j);
|
||||
debug("DEBUG: Found a reference to System property " + sysPropName);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("Found a reference to System property " + sysPropName);
|
||||
String sysPropValue = System.getProperty(sysPropName);
|
||||
debug("DEBUG: Resolved " + sysPropName + " to '" + sysPropValue + "'");
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("Resolved " + sysPropName + " to '" + sysPropValue + "'");
|
||||
if (sysPropValue != null)
|
||||
{
|
||||
result = s.substring(0, i) + sysPropValue + s.substring(j + 1);
|
||||
|
@ -330,7 +333,8 @@ public final class ConfigFileParser
|
|||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
debug(" WARN: Exception while expanding " + s + ". Ignore: " + x);
|
||||
if (Configuration.DEBUG)
|
||||
log.fine("Exception (ignored) while expanding " + s + ": " + x);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -38,14 +38,17 @@ exception statement from your version. */
|
|||
|
||||
package gnu.javax.security.auth.login;
|
||||
|
||||
import gnu.java.security.Configuration;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* A UTF-8 friendly, JAAS Login Module Configuration file tokenizer written in
|
||||
* the deault syntax. This class emulates, to a certain extent, the behavior of
|
||||
* a {@link java.io.SrteamTokenizer} instance <code>st</code>, when set as
|
||||
* a {@link java.io.StreamTokenizer} instance <code>st</code>, when set as
|
||||
* follows:
|
||||
*
|
||||
* <pre>
|
||||
|
@ -76,12 +79,7 @@ import java.io.Reader;
|
|||
*/
|
||||
public class ConfigFileTokenizer
|
||||
{
|
||||
// Constants and fields
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private static final void debug(String m) {if (DEBUG) System.err.println(m);};
|
||||
|
||||
private static final Logger log = Logger.getLogger(ConfigFileParser.class.getName());
|
||||
/** A constant indicating that the end of the stream has been read. */
|
||||
public static final int TT_EOF = -1;
|
||||
/** A constant indicating that a word token has been read. */
|
||||
|
@ -235,9 +233,12 @@ public class ConfigFileTokenizer
|
|||
|
||||
private void abort(String m) throws IOException
|
||||
{
|
||||
debug("DEBUG: " + m);
|
||||
debug("DEBUG: sb = " + sb);
|
||||
debug("DEBUG: sbNdx = " + sbNdx);
|
||||
if (Configuration.DEBUG)
|
||||
{
|
||||
log.fine(m);
|
||||
log.fine("sb = " + sb);
|
||||
log.fine("sbNdx = " + sbNdx);
|
||||
}
|
||||
throw new IOException(m);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.security.auth.AuthPermission;
|
||||
import javax.security.auth.login.AppConfigurationEntry;
|
||||
|
@ -127,12 +128,7 @@ import javax.security.auth.login.Configuration;
|
|||
*/
|
||||
public final class GnuConfiguration extends Configuration
|
||||
{
|
||||
// Constants and fields
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
private static final boolean DEBUG = true;
|
||||
private static final void debug(String m) {if (DEBUG) System.err.println(m);};
|
||||
|
||||
private static final Logger log = Logger.getLogger(GnuConfiguration.class.getName());
|
||||
/**
|
||||
* The internal map of login modules keyed by application name. Each entry in
|
||||
* this map is a {@link List} of {@link AppConfigurationEntry}s for that
|
||||
|
@ -179,7 +175,8 @@ public final class GnuConfiguration extends Configuration
|
|||
if (loginModules == null || loginModules.size() == 0)
|
||||
return null;
|
||||
|
||||
debug("DEBUG: " + appName + " -> " + loginModules.size() + " entry(ies)");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine(appName + " -> " + loginModules.size() + " entry(ies)");
|
||||
return (AppConfigurationEntry[]) loginModules.toArray(new AppConfigurationEntry[0]);
|
||||
}
|
||||
|
||||
|
@ -193,7 +190,7 @@ public final class GnuConfiguration extends Configuration
|
|||
* @throws SecurityException if the caller does not have an
|
||||
* {@link AuthPermission} for the action named
|
||||
* <code>refreshLoginConfiguration</code>.
|
||||
* @see {@link AuthPermission}
|
||||
* @see AuthPermission
|
||||
*/
|
||||
public void refresh()
|
||||
{
|
||||
|
@ -215,13 +212,25 @@ public final class GnuConfiguration extends Configuration
|
|||
private void init()
|
||||
{
|
||||
if (processSecurityProperties())
|
||||
debug(" INFO: Using login configuration defined by Security property(ies)");
|
||||
{
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Using login configuration defined by Security property(ies)");
|
||||
}
|
||||
else if (processSystemProperty())
|
||||
debug(" INFO: Using login configuration defined by System property");
|
||||
{
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Using login configuration defined by System property");
|
||||
}
|
||||
else if (processUserHome())
|
||||
debug(" INFO: Using login configuration defined in ${user.home}");
|
||||
{
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Using login configuration defined in ${user.home}");
|
||||
}
|
||||
else
|
||||
debug(" WARN: No login configuration file found");
|
||||
{
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("No login configuration file found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,16 +258,18 @@ public final class GnuConfiguration extends Configuration
|
|||
s = s.trim();
|
||||
if (s.length() != 0)
|
||||
{
|
||||
debug("DEBUG: java.security.auth.login.config.url." + counter
|
||||
+ " = " + s);
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("java.security.auth.login.config.url." + counter
|
||||
+ " = " + s);
|
||||
parseConfig(getInputStreamFromURL(s));
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
debug(" WARN: Exception while handling Security property at #"
|
||||
+ counter + ". Continue: " + t);
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Exception while handling Security property at #"
|
||||
+ counter + ". Continue: " + t);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -287,7 +298,8 @@ public final class GnuConfiguration extends Configuration
|
|||
}
|
||||
catch (MalformedURLException x)
|
||||
{
|
||||
debug(" WARN: Failed opening as URL: " + s + ". Will try as File");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Failed opening as URL: " + s + ". Will try as File");
|
||||
result = new FileInputStream(s);
|
||||
}
|
||||
return result;
|
||||
|
@ -311,7 +323,8 @@ public final class GnuConfiguration extends Configuration
|
|||
s = s.trim();
|
||||
if (s.length() != 0)
|
||||
{
|
||||
debug("DEBUG: java.security.auth.login.config = " + s);
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("java.security.auth.login.config = " + s);
|
||||
parseConfig(getInputStreamFromURL(s));
|
||||
result = true;
|
||||
}
|
||||
|
@ -319,7 +332,8 @@ public final class GnuConfiguration extends Configuration
|
|||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
debug(" WARN: Exception while handling System property. Continue: " + t);
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Exception while handling System property. Continue: " + t);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -349,8 +363,9 @@ public final class GnuConfiguration extends Configuration
|
|||
|
||||
if (jaasFile == null)
|
||||
{
|
||||
debug(" WARN: Login Configuration file, in " + userHome
|
||||
+ ", does not exist or is inaccessible");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Login Configuration file, in " + userHome
|
||||
+ ", does not exist or is inaccessible");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -360,7 +375,8 @@ public final class GnuConfiguration extends Configuration
|
|||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
debug(" WARN: Exception while handling ${user.home}: " + t);
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("Exception (ignored) while handling ${user.home}: " + t);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -397,54 +413,54 @@ public final class GnuConfiguration extends Configuration
|
|||
String uh = System.getProperty("user.home");
|
||||
if (uh == null || uh.trim().length() == 0)
|
||||
{
|
||||
debug(" WARN: User home path is not set or is empty");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("User home path is not set or is empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
uh = uh.trim();
|
||||
File result = new File(uh);
|
||||
if (!result.exists())
|
||||
if (! result.exists())
|
||||
{
|
||||
debug(" WARN: User home '" + uh + "' does not exist");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("User home '" + uh + "' does not exist");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!result.isDirectory())
|
||||
if (! result.isDirectory())
|
||||
{
|
||||
debug(" WARN: User home '" + uh + "' is not a directory");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("User home '" + uh + "' is not a directory");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!result.canRead())
|
||||
if (! result.canRead())
|
||||
{
|
||||
debug(" WARN: User home '" + uh + "' is not readable");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("User home '" + uh + "' is not readable");
|
||||
return null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private File getConfigFromUserHome(File userHome, String fileName)
|
||||
{
|
||||
File result = new File(userHome, fileName);
|
||||
if (!result.exists())
|
||||
if (! result.exists())
|
||||
{
|
||||
debug(" WARN: File '" + fileName + "' does not exist in user's home");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("File '" + fileName + "' does not exist in user's home");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!result.isFile())
|
||||
if (! result.isFile())
|
||||
{
|
||||
debug(" WARN: File '" + fileName + "' in user's home is not a file");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("File '" + fileName + "' in user's home is not a file");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!result.canRead())
|
||||
if (! result.canRead())
|
||||
{
|
||||
debug(" WARN: File '" + fileName + "' in user's home is not readable");
|
||||
if (gnu.java.security.Configuration.DEBUG)
|
||||
log.fine("File '" + fileName + "' in user's home is not readable");
|
||||
return null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue