--- a/usr/src/doc/rad-dev/c-client-python.xml Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/doc/rad-dev/c-client-python.xml Fri Apr 13 19:52:01 2012 -0400
@@ -101,21 +101,6 @@
<funcprototype>
<funcdef>
<type>RadConnection</type>
- <function>connect_ssh</function>
- </funcdef>
- <paramdef>
- <type>string</type> <parameter>host</parameter>
- </paramdef>
- <paramdef>
- <type>string</type> <parameter>user</parameter>
- </paramdef>
- <paramdef>
- <type>string</type> <parameter>locale</parameter>
- </paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>
- <type>RadConnection</type>
<function>connect_ssl</function>
</funcdef>
<paramdef>
--- a/usr/src/doc/rad-dev/c-intro.xml Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/doc/rad-dev/c-intro.xml Fri Apr 13 19:52:01 2012 -0400
@@ -220,9 +220,6 @@
Secure remote access via <acronym>TLS</acronym> sockets.
</para></listitem>
<listitem><para>
- Secure remote access via an <acronym>SSH</acronym> connection.
-</para></listitem>
-<listitem><para>
Captive execution with access via a pipe.
</para></listitem>
<listitem><para>
--- a/usr/src/java/rad/com/oracle/solaris/rad/PrivateSSHTransport.java Thu Apr 12 17:24:55 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- */
-
-package com.oracle.solaris.rad;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-
-public class PrivateSSHTransport extends PrivateTransport {
-
- private String host;
- private String user;
-
- public PrivateSSHTransport(String host, String user, String root,
- List<String> modules, List<String> auxargs) throws IOException {
-
- super(root, modules, auxargs);
- this.host = host;
- this.user = user;
- }
-
- // Protected methods
-
- @Override
- protected List<String> getCommand() throws IOException {
-
- List<String> args = new LinkedList<String>();
-
- args.add("/usr/bin/ssh");
- args.add(host);
- args.add("-l");
- args.add(user);
- args.add("-q");
- args.add("-e");
- args.add("none");
- args.add("-o");
- args.add("BatchMode=yes");
- args.addAll(super.getCommand());
-
- return args;
- }
-}
--- a/usr/src/java/rad/com/oracle/solaris/rad/SSHTransport.java Thu Apr 12 17:24:55 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- */
-
-package com.oracle.solaris.rad;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-
-public class SSHTransport extends PipeTransport {
-
- private String host;
- private String user;
-
- public SSHTransport(String host, String user) throws IOException {
- this.host = host;
- this.user = user;
- }
-
- // PipeTransport methods
-
- @Override
- protected List<String> getCommand() throws IOException {
- List<String> args = new LinkedList<String>();
-
- args.add("/usr/bin/ssh");
- args.add("-q");
- args.add("-e");
- args.add("none");
- args.add("-o");
- args.add("BatchMode yes");
- args.add((user != null) ? user + "@" + host : host);
- args.add("/usr/lib/rad/radpipe");
-
- return args;
- }
-}
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/ClientProvider.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/ClientProvider.java Fri Apr 13 19:52:01 2012 -0400
@@ -42,12 +42,8 @@
return (new RadJMXSocketConnector(serviceURL, environment, true));
if (urlProto.equals(RadConnector.PROTOCOL_UNIX))
return (new RadJMXAFUnixConnector(serviceURL, environment));
- if (urlProto.equals(RadConnector.PROTOCOL_SSH))
- return (new RadJMXSSHConnector(serviceURL, environment));
if (urlProto.equals(RadConnector.PROTOCOL_PRIVATE))
return (new RadJMXPrivateConnector(serviceURL, environment));
- if (urlProto.equals(RadConnector.PROTOCOL_PRIVATE_SSH))
- return (new RadJMXPrivateSSHConnector(serviceURL, environment));
if (urlProto.equals(RadConnector.PROTOCOL_ZONESBRIDGE))
return (new RadJMXZonesBridgeConnector(serviceURL,
environment));
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -26,26 +26,24 @@
package com.oracle.solaris.rad.jmx;
/**
- * Utility routines/constants.
+ * Utility constants.
*/
public interface RadConnector {
- String PROTOCOL_TCP = "radtcp";
- String PROTOCOL_TLS = "radtls";
- String PROTOCOL_UNIX = "radunix";
- String PROTOCOL_SSH = "radssh";
- String PROTOCOL_PRIVATE = "radprivate";
- String PROTOCOL_PRIVATE_SSH = "radprivatessh";
- String PROTOCOL_ZONESBRIDGE = "radzone";
+ String PROTOCOL_TCP = "radtcp";
+ String PROTOCOL_TLS = "radtls";
+ String PROTOCOL_UNIX = "radunix";
+ String PROTOCOL_PRIVATE = "radprivate";
+ String PROTOCOL_ZONESBRIDGE = "radzone";
- String PSEUDO_DELEGATE = "com.oracle.solaris.rad.jmx.pseudodelegate";
+ String KEY_PSEUDO_DELEGATE = "com.oracle.solaris.rad.jmx.pseudodelegate";
- String KEY_TLS_TRUSTSTORE = "com.oracle.solaris.rad.jmx.truststore";
- String KEY_TLS_TRUSTPASS = "com.oracle.solaris.rad.jmx.trustpass";
- String KEY_TLS_RADMANAGER = "com.oracle.solaris.rad.jmx.radmanager";
- String KEY_ZONESBRIDGE_MXBEAN =
- "com.oracle.solaris.rad.jmx.zonesbridge-mxbean";
+ String KEY_TLS_TRUSTSTORE = "com.oracle.solaris.rad.jmx.tls:truststore";
+ String KEY_TLS_TRUSTPASS = "com.oracle.solaris.rad.jmx.tls:trustpass";
+ String KEY_TLS_RADMANAGER = "com.oracle.solaris.rad.jmx.tls:radmanager";
+ String KEY_ZONESBRIDGE_MXBEAN =
+ "com.oracle.solaris.rad.jmx.zonesbridge:mxbean";
- String PRIVATE_ROOT = "com.oracle.solaris.rad.jmx.private_root";
- String PRIVATE_MODULES = "com.oracle.solaris.rad.jmx.private_modules";
- String PRIVATE_AUXARGS = "com.oracle.solaris.rad.jmx.private_auxargs";
+ String KEY_PRIVATE_ROOT = "com.oracle.solaris.rad.jmx.private:root";
+ String KEY_PRIVATE_MODULES = "com.oracle.solaris.rad.jmx.private:modules";
+ String KEY_PRIVATE_AUXARGS = "com.oracle.solaris.rad.jmx.private:auxargs";
}
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXAFUnixConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXAFUnixConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -57,7 +57,7 @@
//
@Override
- Transport getTransport(Map<String, ?> env) throws IOException {
+ public Transport getTransport(Map<String, ?> env) throws IOException {
return new UnixTransport(path_);
}
}
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -74,7 +74,7 @@
// Constructors
//
- RadJMXConnector(JMXServiceURL url, Map<String, ?> env) {
+ public RadJMXConnector(JMXServiceURL url, Map<String, ?> env) {
env_ = env;
connectionid_ = makeConnectionId(url);
}
@@ -167,7 +167,8 @@
checkState();
if (mbsc_ == null)
mbsc_ = new RadMBeanServerConnection(this, client_,
- env_ != null && env_.containsKey(RadConnector.PSEUDO_DELEGATE));
+ env_ != null && env_.containsKey(
+ RadConnector.KEY_PSEUDO_DELEGATE));
return (mbsc_);
}
@@ -220,7 +221,8 @@
null, null));
}
- abstract Transport getTransport(Map<String, ?> env) throws IOException;
+ public abstract Transport getTransport(Map<String, ?> env)
+ throws IOException;
//
// Private methods
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXPrivateConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXPrivateConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -27,17 +27,10 @@
import java.io.IOException;
import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.management.remote.JMXProviderException;
-import javax.management.remote.JMXServiceURL;
-import com.oracle.solaris.rad.PrivateTransport;
-import com.oracle.solaris.rad.Transport;
+import java.util.*;
+import java.util.regex.*;
+import javax.management.remote.*;
+import com.oracle.solaris.rad.*;
public class RadJMXPrivateConnector extends RadJMXConnector {
//
@@ -50,7 +43,7 @@
// Constructors
//
- RadJMXPrivateConnector(JMXServiceURL url, Map<String, ?> env)
+ public RadJMXPrivateConnector(JMXServiceURL url, Map<String, ?> env)
throws MalformedURLException, JMXProviderException {
super(url, env);
@@ -67,7 +60,7 @@
//
@Override
- Transport getTransport(Map<String, ?> env) throws IOException {
+ public Transport getTransport(Map<String, ?> env) throws IOException {
return new PrivateTransport(getRoot(env), getModules(env),
getAuxlist(env));
}
@@ -77,7 +70,7 @@
protected List<String> getAuxlist(Map<String, ?> env) {
String auxargs[] = null;
if (env != null) {
- auxargs = (String[]) env.get(RadConnector.PRIVATE_AUXARGS);
+ auxargs = (String[])env.get(RadConnector.KEY_PRIVATE_AUXARGS);
}
if (auxargs == null || auxargs.length == 0) {
return Collections.emptyList();
@@ -90,7 +83,7 @@
String envmods[] = null;
if (env != null) {
- envmods = (String[]) env.get(RadConnector.PRIVATE_MODULES);
+ envmods = (String[])env.get(RadConnector.KEY_PRIVATE_MODULES);
}
List<String> modules = new LinkedList<String>();
@@ -110,7 +103,7 @@
protected String getRoot(Map<String, ?> env) {
return (env != null)
- ? (String) env.get(RadConnector.PRIVATE_ROOT) : null;
+ ? (String)env.get(RadConnector.KEY_PRIVATE_ROOT) : null;
}
protected void setModule(String module) {
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXPrivateSSHConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- */
-
-package com.oracle.solaris.rad.jmx;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.management.remote.JMXProviderException;
-import javax.management.remote.JMXServiceURL;
-import com.oracle.solaris.rad.PrivateSSHTransport;
-import com.oracle.solaris.rad.Transport;
-
-public class RadJMXPrivateSSHConnector extends RadJMXPrivateConnector {
- //
- // Instance data
- //
-
- private String host;
- private String user;
-
- //
- // Constructors
- //
-
- RadJMXPrivateSSHConnector(JMXServiceURL url, Map<String, ?> env)
- throws MalformedURLException, JMXProviderException {
-
- super(url, env);
- host = url.getHost();
-
- /*
- * JMX Service URLs don't permit user@host syntax, so we interpret
- * a URL's path (following the initial /) as the user & module.
- */
- Matcher matcher = Pattern.compile("/*([^/]+)/*(/.+)?").
- matcher(url.getURLPath());
- if (matcher.matches()) {
- user = matcher.group(1);
- setModule(matcher.group(2));
- }
- }
-
- //
- // RadJMXConnector methods
- //
-
- @Override
- Transport getTransport(Map<String, ?> env) throws IOException {
- return new PrivateSSHTransport(host, user, getRoot(env),
- getModules(env), getAuxlist(env));
- }
-}
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXSSHConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- */
-
-package com.oracle.solaris.rad.jmx;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-import javax.management.remote.JMXServiceURL;
-import com.oracle.solaris.rad.*;
-
-class RadJMXSSHConnector extends RadJMXConnector {
-
- //
- // Instance data
- //
-
- private String host_;
- private String user_;
-
- //
- // Constructors
- //
-
- RadJMXSSHConnector(JMXServiceURL url, Map<String, ?> env)
- throws MalformedURLException {
-
- super(url, env);
- host_ = url.getHost();
-
- /*
- * JMX Service URLs don't permit user@host syntax, so we interpret
- * a URL's path (following the initial /) as the user name.
- */
- String path = url.getURLPath();
- user_ = (path.length() < 2 || path.charAt(0) != '/') ? null :
- path.substring(1);
- }
-
- //
- // RadJMXConnector methods
- //
-
- @Override
- Transport getTransport(Map<String, ?> env) throws IOException {
- return new SSHTransport(host_, user_);
- }
-}
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXSocketConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXSocketConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -25,16 +25,12 @@
package com.oracle.solaris.rad.jmx;
-import java.io.FileInputStream;
-import java.io.IOException;
+import java.io.*;
import java.net.InetAddress;
import java.security.KeyStore;
import java.util.Map;
-import javax.management.remote.JMXProviderException;
-import javax.management.remote.JMXServiceURL;
-import com.oracle.solaris.rad.RadTrustManager;
-import com.oracle.solaris.rad.SocketTransport;
-import com.oracle.solaris.rad.Transport;
+import javax.management.remote.*;
+import com.oracle.solaris.rad.*;
class RadJMXSocketConnector extends RadJMXConnector {
@@ -63,7 +59,7 @@
}
@Override
- Transport getTransport(Map<String, ?> env) throws IOException {
+ public Transport getTransport(Map<String, ?> env) throws IOException {
InetAddress addr = InetAddress.getByName(host_);
if (!tls_)
--- a/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXZonesBridgeConnector.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/java/rad/com/oracle/solaris/rad/jmx/RadJMXZonesBridgeConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -29,7 +29,6 @@
import java.util.Map;
import javax.management.remote.*;
import com.oracle.solaris.rad.*;
-import com.oracle.solaris.rad.jmx.RadJMXConnector;
import com.oracle.solaris.rad.zonesbridge.IOMXBean;
class RadJMXZonesBridgeConnector extends RadJMXConnector {
@@ -64,7 +63,9 @@
//
@Override
- Transport getTransport(Map<String, ?> env) throws JMXProviderException {
+ public Transport getTransport(Map<String, ?> env)
+ throws JMXProviderException {
+
IOMXBean conn = null;
try {
conn = (IOMXBean)env.get(RadConnector.KEY_ZONESBRIDGE_MXBEAN);
--- a/usr/src/lib/pyrad/util.py Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/lib/pyrad/util.py Fri Apr 13 19:52:01 2012 -0400
@@ -133,17 +133,6 @@
return rad.RadConnection(ProcessPseudoSocket(p), locale = locale)
#
-# Connect to a remote rad daemon using SSH
-#
-def connect_ssh(host, user = None, locale = None):
- if user is not None:
- host = "%s@%s" % (user, host)
- p = subprocess.Popen(["/usr/bin/ssh", "-q", "-e", "none",
- "-o", "BatchMode yes", host, "/usr/lib/rad/radpipe" ],
- 0, None, subprocess.PIPE, subprocess.PIPE)
- return rad.RadConnection(ProcessPseudoSocket(p), locale = locale)
-
-#
# Connect to the local rad daemon via the standard unix domain socket
#
def connect_local(path = RAD_PATH_AFUNIX_AUTH, locale = None):
--- a/usr/src/test/Makefile.env Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/test/Makefile.env Fri Apr 13 19:52:01 2012 -0400
@@ -28,12 +28,11 @@
LOCAL_PORT_TLS = 12348
# Set to 'yes' to run tests
-REMOTE_TEST_IPV4 = no
+REMOTE_TEST_IPV4 = yes
REMOTE_TEST_IPV6 = no
-# Hosts must be either a) IP addresses or b) resolvable to the
-# appropriate type (v4/v6) of address. When in doubt, go with
-# (a) and test a link-local IPv6 address.
+# Hosts must be either a) IP addresses or b) resolvable to the appropriate type
+# (v4/v6) of address. When in doubt, go with (a).
REMOTE_HOST_IPV4 = 127.0.0.1
REMOTE_HOST_IPV6 = ::1
REMOTE_PORT_TCP = 12345
--- a/usr/src/test/java/build.xml Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/test/java/build.xml Fri Apr 13 19:52:01 2012 -0400
@@ -23,92 +23,91 @@
-->
<project name="test" default="build">
- <property environment="env" />
+ <property environment="env" />
- <property name="path.proto" location="${env.ROOT}" />
- <property name="path.radadrgen"
- location="${path.proto}/usr/bin/radadrgen" />
- <property name="path.lib" location="${path.proto}/usr/lib" />
- <property name="path.rad.java" location="${path.lib}/rad/java" />
- <property name="path.src" location="src" />
- <property name="path.build" location="build" />
- <property name="path.gen" location="${path.build}/gen" />
- <property name="path.apis" location="../../apis" />
+ <property name="path.proto" location="${env.ROOT}" />
+ <property name="path.radadrgen"
+ location="${path.proto}/usr/bin/radadrgen" />
+ <property name="path.lib" location="${path.proto}/usr/lib" />
+ <property name="path.rad.java" location="${path.lib}/rad/java" />
+ <property name="path.src" location="src" />
+ <property name="path.build" location="build" />
+ <property name="path.gen" location="${path.build}/gen" />
+ <property name="path.apis" location="../../apis" />
- <property name="path.adr" location="${path.rad.java}/adr.jar" />
- <property name="path.rad" location="${path.rad.java}/rad.jar" />
- <property name="path.util" location="${path.rad.java}/afunix.jar" />
- <property name="path.smf" location="${path.rad.java}/smf.jar" />
+ <property name="path.adr" location="${path.rad.java}/adr.jar" />
+ <property name="path.rad" location="${path.rad.java}/rad.jar" />
+ <property name="path.util" location="${path.rad.java}/afunix.jar" />
+ <property name="path.smf" location="${path.rad.java}/smf.jar" />
- <path id="srcroots">
- <pathelement location="${path.src}" />
- <pathelement location="${path.gen}" />
- </path>
+ <path id="srcroots">
+ <pathelement location="${path.src}" />
+ <pathelement location="${path.gen}" />
+ </path>
- <path id="classpath.javac">
- <pathelement location="${path.adr}" />
- <pathelement location="${path.rad}" />
- <pathelement location="${path.util}" />
- <pathelement location="${path.smf}" />
- <pathelement location="/usr/share/lib/java/junit.jar" />
- </path>
+ <path id="classpath.javac">
+ <pathelement location="${path.adr}" />
+ <pathelement location="${path.rad}" />
+ <pathelement location="${path.util}" />
+ <pathelement location="${path.smf}" />
+ <pathelement location="/usr/share/lib/java/junit.jar" />
+ </path>
- <macrodef name="generate.adr">
- <attribute name="api" />
- <sequential>
- <exec executable="${path.radadrgen}">
- <arg value="-j" />
- <arg value="${path.gen}" />
- <arg value="-i" />
- <arg value="${path.apis}/@{api}" />
- </exec>
- </sequential>
- </macrodef>
+ <macrodef name="generate.adr">
+ <attribute name="api" />
+ <sequential>
+ <exec executable="${path.radadrgen}">
+ <arg value="-j" />
+ <arg value="${path.gen}" />
+ <arg value="-i" />
+ <arg value="${path.apis}/@{api}" />
+ </exec>
+ </sequential>
+ </macrodef>
- <presetdef name="javac.default">
- <javac includeAntRuntime="no" destdir="${path.build}" debug="on"
- classpathref="classpath.javac">
- <src location="${path.src}" />
- <src location="${path.gen}" />
- <compilerarg value="-Xlint" />
- <compilerarg value="-Xlint:-serial" />
- </javac>
- </presetdef>
+ <presetdef name="javac.default">
+ <javac includeAntRuntime="no" destdir="${path.build}" debug="on"
+ classpathref="classpath.javac">
+ <src location="${path.src}" />
+ <src location="${path.gen}" />
+ <compilerarg value="-Xlint" />
+ <compilerarg value="-Xlint:-serial" />
+ </javac>
+ </presetdef>
- <target name="generate">
- <mkdir dir="${path.gen}" />
- <generate.adr api="test.xml" />
- <generate.adr api="test-unions.xml" />
- <generate.adr api="test-fallback-old.xml" />
- <generate.adr api="test-fallback-new.xml" />
- </target>
+ <target name="generate">
+ <mkdir dir="${path.gen}" />
+ <generate.adr api="test.xml" />
+ <generate.adr api="test-unions.xml" />
+ <generate.adr api="test-fallback-old.xml" />
+ <generate.adr api="test-fallback-new.xml" />
+ </target>
- <target name="build" depends="generate">
- <mkdir dir="${path.build}" />
- <javac.default />
- </target>
+ <target name="build" depends="generate">
+ <mkdir dir="${path.build}" />
+ <javac.default />
+ </target>
- <target name="test">
- <junit fork="yes" printsummary="withOutAndErr" showoutput="true"
- errorProperty="test.failed" failureProperty="test.failed"
- filtertrace="false">
- <env key="LD_LIBRARY_PATH" value="${path.lib}" />
- <classpath>
- <pathelement path="${path.build}" />
- <path refid="classpath.javac" />
- </classpath>
- <formatter type="brief" usefile="false" />
- <formatter type="xml" />
- <batchtest>
- <fileset dir="${path.build}">
- <include name="**/*Test.class" />
- </fileset>
- </batchtest>
- </junit>
+ <target name="test">
+ <junit fork="yes" printsummary="withOutAndErr" showoutput="true"
+ errorProperty="test.failed" failureProperty="test.failed"
+ filtertrace="false">
+ <env key="LD_LIBRARY_PATH" value="${path.lib}" />
+ <classpath>
+ <pathelement path="${path.build}" />
+ <path refid="classpath.javac" />
+ </classpath>
+ <formatter type="brief" usefile="false" />
+ <formatter type="xml" />
+ <batchtest>
+ <fileset dir="${path.build}">
+ <include name="**/*Test.class" />
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
- </target>
-
- <target name="clean">
- <delete dir="${path.build}" />
- </target>
+ <target name="clean">
+ <delete dir="${path.build}" />
+ </target>
</project>
--- a/usr/src/test/java/src/client/ConnectTest.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/test/java/src/client/ConnectTest.java Fri Apr 13 19:52:01 2012 -0400
@@ -25,17 +25,18 @@
package client;
-import java.io.*;
-import java.net.ServerSocket;
-import java.security.KeyStore;
-import java.security.cert.*;
-import java.util.*;
-import javax.management.MBeanServerConnection;
-import javax.management.remote.*;
import com.oracle.solaris.adr.Stability;
import com.oracle.solaris.rad.jmx.*;
import com.oracle.solaris.rad.pam.AuthenticationMXBean;
import common.MBeanTestCommon;
+import common.radsshprivate.RadJMXSSHPrivateConnector;
+import java.io.*;
+import java.net.ServerSocket;
+import java.security.cert.*;
+import java.security.KeyStore;
+import java.util.*;
+import javax.management.MBeanServerConnection;
+import javax.management.remote.*;
import org.junit.*;
import testutil.Desc;
@@ -263,7 +264,8 @@
};
// Set up server.
- setUpCommon("service:jmx:" + RadConnector.PROTOCOL_PRIVATE_SSH +
+ setUpCommon("service:jmx:" +
+ RadJMXSSHPrivateConnector.PROTOCOL_SSH_PRIVATE +
"://" + host + "/" + System.getProperty("user.name"),
getRemoteTestDir().getAbsolutePath(), auxargs, modules);
testConnection(getMBSC());
@@ -294,7 +296,8 @@
};
// Set up server.
- setUpCommon("service:jmx:" + RadConnector.PROTOCOL_PRIVATE_SSH +
+ setUpCommon("service:jmx:" +
+ RadJMXSSHPrivateConnector.PROTOCOL_SSH_PRIVATE +
"://" + host + "/" + System.getProperty("user.name"),
getRemoteTestDir().getAbsolutePath(), auxargs, modules);
testConnection(getMBSC());
@@ -349,7 +352,8 @@
};
// Set up server.
- setUpCommon("service:jmx:" + RadConnector.PROTOCOL_PRIVATE_SSH +
+ setUpCommon("service:jmx:" +
+ RadJMXSSHPrivateConnector.PROTOCOL_SSH_PRIVATE +
"://" + host + "/" + System.getProperty("user.name"),
getRemoteTestDir().getAbsolutePath(), auxargs, modules);
testConnection(getMBSC());
--- a/usr/src/test/java/src/common/MBeanTestCommon.java Thu Apr 12 17:24:55 2012 -0400
+++ b/usr/src/test/java/src/common/MBeanTestCommon.java Fri Apr 13 19:52:01 2012 -0400
@@ -26,21 +26,32 @@
package common;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
+import java.util.*;
+import javax.management.*;
+import javax.management.remote.*;
import com.oracle.solaris.rad.jmx.RadConnector;
public class MBeanTestCommon extends RootCommon {
+ //
+ // Static data
+ //
+
+ // radssh/radsshprivate ClientProvider classes live in the
+ // <thispkg>.<protocol> package
+ public static final String PROTOCOL_PROVIDER_PACKAGES =
+ MBeanTestCommon.class.getPackage().getName();
+
+ //
+ // Instance data
+ //
private JMXConnector conn_ = null;
private MBeanServerConnection mbsc_ = null;
+ //
+ // MBeanTestCommon methods
+ //
+
protected MBeanServerConnection getMBSC() {
return mbsc_;
}
@@ -66,14 +77,21 @@
protected void setUpCommon(String url, String root, String[] auxargs,
String... modules) throws Exception {
+ Map<String, Object> env = new HashMap<String, Object>();
+
+ // For radssh, radsshprivate
+ env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
+ PROTOCOL_PROVIDER_PACKAGES);
+
+ env.put(RadConnector.KEY_PRIVATE_MODULES, modules);
+ if (root != null) {
+ env.put(RadConnector.KEY_PRIVATE_ROOT, root);
+ }
+ if (auxargs != null && auxargs.length > 0) {
+ env.put(RadConnector.KEY_PRIVATE_AUXARGS, auxargs);
+ }
+
try {
- Map<String, Object> env = new HashMap<String, Object>();
- env.put(RadConnector.PRIVATE_MODULES, modules);
- if (root != null)
- env.put(RadConnector.PRIVATE_ROOT, root);
- if (auxargs != null && auxargs.length > 0)
- env.put(RadConnector.PRIVATE_AUXARGS, auxargs);
-
conn_ = JMXConnectorFactory.connect(new JMXServiceURL(url), env);
mbsc_ = conn_.getMBeanServerConnection();
} catch (IOException e) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/test/java/src/common/radssh/ClientProvider.java Fri Apr 13 19:52:01 2012 -0400
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package common.radssh;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+import javax.management.remote.*;
+
+public class ClientProvider implements JMXConnectorProvider {
+ //
+ // JMXConnectorProvider methods
+ //
+
+ @Override
+ public JMXConnector newJMXConnector(JMXServiceURL url, Map<String, ?> env)
+ throws IOException {
+
+ String proto = url.getProtocol();
+ if (proto.equals(RadJMXSSHConnector.PROTOCOL_SSH)) {
+ return new RadJMXSSHConnector(url, env);
+ }
+
+ throw new MalformedURLException("unrecognized protocol: " + proto);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/test/java/src/common/radssh/RadJMXSSHConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package common.radssh;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+import javax.management.remote.JMXServiceURL;
+import com.oracle.solaris.rad.Transport;
+import com.oracle.solaris.rad.jmx.RadJMXConnector;
+
+class RadJMXSSHConnector extends RadJMXConnector {
+ //
+ // Static methods
+ //
+
+ public static final String PROTOCOL_SSH = "radssh";
+
+ //
+ // Instance data
+ //
+
+ private String host;
+ private String user;
+
+ //
+ // Constructors
+ //
+
+ public RadJMXSSHConnector(JMXServiceURL url, Map<String, ?> env)
+ throws MalformedURLException {
+
+ super(url, env);
+ host = url.getHost();
+
+ /*
+ * JMX Service URLs don't permit user@host syntax, so we interpret
+ * a URL's path (following the initial /) as the user name.
+ */
+ String path = url.getURLPath();
+ user = (path.length() < 2 || path.charAt(0) != '/') ? null :
+ path.substring(1);
+ }
+
+ //
+ // RadJMXConnector methods
+ //
+
+ @Override
+ public Transport getTransport(Map<String, ?> env) throws IOException {
+ return new SSHTransport(host, user);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/test/java/src/common/radssh/SSHTransport.java Fri Apr 13 19:52:01 2012 -0400
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package common.radssh;
+
+import java.io.IOException;
+import java.util.*;
+import com.oracle.solaris.rad.PipeTransport;
+
+public class SSHTransport extends PipeTransport {
+ //
+ // Instance data
+ //
+
+ private String host;
+ private String user;
+
+ //
+ // Constructors
+ //
+
+ public SSHTransport(String host, String user) throws IOException {
+ this.host = host;
+ this.user = user;
+ }
+
+ //
+ // PipeTransport methods
+ //
+
+ @Override
+ protected List<String> getCommand() throws IOException {
+ List<String> args = new LinkedList<String>();
+ args.add("/usr/bin/ssh");
+ args.add("-q");
+ args.add("-e");
+ args.add("none");
+ args.add("-o");
+ args.add("BatchMode yes");
+ args.add(user != null ? user + "@" + host : host);
+ args.add("/usr/lib/rad/radpipe");
+
+ return args;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/test/java/src/common/radsshprivate/ClientProvider.java Fri Apr 13 19:52:01 2012 -0400
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package common.radsshprivate;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+import javax.management.remote.*;
+
+public class ClientProvider implements JMXConnectorProvider {
+ //
+ // JMXConnectorProvider methods
+ //
+
+ @Override
+ public JMXConnector newJMXConnector(JMXServiceURL url, Map<String, ?> env)
+ throws IOException {
+
+ String proto = url.getProtocol();
+ if (proto.equals(RadJMXSSHPrivateConnector.PROTOCOL_SSH_PRIVATE)) {
+ return new RadJMXSSHPrivateConnector(url, env);
+ }
+
+ throw new MalformedURLException("unrecognized protocol: " + proto);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/test/java/src/common/radsshprivate/RadJMXSSHPrivateConnector.java Fri Apr 13 19:52:01 2012 -0400
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package common.radsshprivate;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+import java.util.regex.*;
+import javax.management.remote.*;
+import com.oracle.solaris.rad.Transport;
+import com.oracle.solaris.rad.jmx.RadJMXPrivateConnector;
+
+public class RadJMXSSHPrivateConnector extends RadJMXPrivateConnector {
+ //
+ // Static data
+ //
+
+ public static final String PROTOCOL_SSH_PRIVATE = "radsshprivate";
+
+ //
+ // Instance data
+ //
+
+ private String host;
+ private String user;
+
+ //
+ // Constructors
+ //
+
+ public RadJMXSSHPrivateConnector(JMXServiceURL url, Map<String, ?> env)
+ throws MalformedURLException, JMXProviderException {
+
+ super(url, env);
+ host = url.getHost();
+
+ /*
+ * JMX Service URLs don't permit user@host syntax, so we interpret
+ * a URL's path (following the initial /) as the user & module.
+ */
+ Matcher matcher = Pattern.compile("/*([^/]+)/*(/.+)?").
+ matcher(url.getURLPath());
+ if (matcher.matches()) {
+ user = matcher.group(1);
+ setModule(matcher.group(2));
+ }
+ }
+
+ //
+ // RadJMXConnector methods
+ //
+
+ @Override
+ public Transport getTransport(Map<String, ?> env) throws IOException {
+ return new SSHPrivateTransport(host, user, getRoot(env),
+ getModules(env), getAuxlist(env));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/test/java/src/common/radsshprivate/SSHPrivateTransport.java Fri Apr 13 19:52:01 2012 -0400
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package common.radsshprivate;
+
+import java.io.IOException;
+import java.util.*;
+import com.oracle.solaris.rad.PrivateTransport;
+
+public class SSHPrivateTransport extends PrivateTransport {
+ //
+ // Instance data
+ //
+
+ private String host;
+ private String user;
+
+ //
+ // Constructors
+ //
+
+ public SSHPrivateTransport(String host, String user, String root,
+ List<String> modules, List<String> auxargs) throws IOException {
+
+ super(root, modules, auxargs);
+ this.host = host;
+ this.user = user;
+ }
+
+ //
+ // PipeTransport methods
+ //
+
+ @Override
+ protected List<String> getCommand() throws IOException {
+ List<String> args = new LinkedList<String>();
+ args.add("/usr/bin/ssh");
+ args.add(host);
+ args.add("-l");
+ args.add(user);
+ args.add("-q");
+ args.add("-e");
+ args.add("none");
+ args.add("-o");
+ args.add("BatchMode=yes");
+ args.addAll(super.getCommand());
+
+ return args;
+ }
+}