9926 idmap: initial integration
authorStephen Talley <stephen.talley@sun.com>
Wed, 08 Jul 2009 15:51:56 -0400
changeset 322 838d56f9f958
parent 321 07d6786dc468
child 323 497a785649eb
9926 idmap: initial integration
usr/src/Makefile.env
usr/src/cmd/applications/Makefile
usr/src/cmd/applications/vp-idmap.desktop
usr/src/java/vpanels/panels/idmap/build.xml
usr/src/java/vpanels/panels/idmap/nbproject/project.xml
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/DeleteMapRuleAction.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/IdmapPanelDescriptor.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/MapRuleEditControl.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/MapRuleEditPanel.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/MapRuleManagedObject.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/PropInfo.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/PropertiesPanel.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/PropertiesTab.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/RulesPanel.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/RulesTab.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap-16.png
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap-24.png
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap-48.png
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap_dir_bioff.png
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap_dir_lroff.png
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap_dir_rloff.png
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/resources/Resources.properties
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapException.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapMXBean.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapProperties.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapRuntimeException.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapUtil.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/MapRule.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/Idmap.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/Idmap.rootacl.properties
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/IdmapGenerator.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/IdmapModule.java
usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/module:idmap.xml
usr/src/lib/Makefile
usr/src/lib/libidmap_jni/Idmap.c
usr/src/lib/libidmap_jni/Makefile
usr/src/lib/libidmap_jni/Makefile.com
usr/src/lib/libidmap_jni/Makefile.env
usr/src/lib/libidmap_jni/amd64/Makefile
usr/src/lib/libidmap_jni/common.h
usr/src/lib/libidmap_jni/i386/Makefile
usr/src/lib/libidmap_jni/idmap_idmap.c
usr/src/lib/libidmap_jni/idmap_idmap.h
usr/src/lib/libidmap_jni/idmap_scf.c
usr/src/lib/libidmap_jni/idmap_scf.h
usr/src/lib/libidmap_jni/osol-deps/Makefile
usr/src/lib/libidmap_jni/osol-deps/smbsrv/Makefile
usr/src/lib/libidmap_jni/osol-deps/sqlite/Makefile
usr/src/lib/libidmap_jni/sparcv7/Makefile
usr/src/lib/libidmap_jni/sparcv9/Makefile
usr/src/pkgdefs/OSOL0vpanels-idmap/Makefile
usr/src/pkgdefs/OSOL0vpanels-idmap/depend
usr/src/pkgdefs/OSOL0vpanels-idmap/pkginfo
usr/src/pkgdefs/OSOL0vpanels-idmap/prototype_com
usr/src/pkgdefs/OSOL0vpanels-idmap/prototype_i386
usr/src/pkgdefs/OSOL0vpanels-idmap/prototype_sparc
usr/src/pkgdefs/OSOLvpin-idmap/Makefile
usr/src/pkgdefs/OSOLvpin-idmap/copyright
usr/src/pkgdefs/OSOLvpin-idmap/pkginfo
usr/src/pkgdefs/OSOLvpin-idmap/prototype_com
usr/src/pkgdefs/OSOLvpin-idmap/prototype_i386
usr/src/pkgdefs/OSOLvpin-idmap/prototype_sparc
usr/src/pkgdefs/OSOLvpin/prototype_com
usr/src/pkgdefs/publish.ksh
--- a/usr/src/Makefile.env	Fri Jun 26 16:06:20 2009 -0400
+++ b/usr/src/Makefile.env	Wed Jul 08 15:51:56 2009 -0400
@@ -68,20 +68,21 @@
 	$(RM) -- $@; $(INS) -s -m $(FILEMODE) -f $(@D) $(@F)
 
 # Tools and dependencies used at build time
+CHMOD = /usr/bin/chmod
 CP = /usr/bin/cp
-CHMOD = /usr/bin/chmod
+EGREP = /usr/bin/egrep
 FIND = /usr/bin/find
 GREP = /usr/bin/grep
-EGREP = /usr/bin/egrep
+GTAR = /usr/sfw/bin/gtar
 HEAD = /usr/bin/head
 INS = /usr/sbin/install
 LS = /usr/bin/ls
+PWDCMD = /usr/bin/pwd
 SED = /usr/bin/sed
 SORT = /usr/bin/sort
-GTAR = /usr/sfw/bin/gtar
 TAR = /usr/bin/tar
+WGET = /usr/bin/wget
 XARGS = /usr/bin/xargs
-PWDCMD = /usr/bin/pwd
 
 # Set here explicitly to avoid compiling with newer class version
 JAVAC = /usr/bin/javac
--- a/usr/src/cmd/applications/Makefile	Fri Jun 26 16:06:20 2009 -0400
+++ b/usr/src/cmd/applications/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -31,6 +31,7 @@
 	vp-coreadm.desktop \
 	vp-firewall.desktop \
 	vp-mysql.desktop \
+	vp-idmap.desktop \
 	vp-shares.desktop \
 	vp-smf.desktop \
 	vp-time.desktop
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/applications/vp-idmap.desktop	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=Identity Mapping
+Comment=Configure Identity Mapping
+Exec=java -client -jar /usr/share/vpanels/vpanels-client.jar -D vpanels.ui.navbar idmap
+Icon=/usr/share/gnome-system-tools/pixmaps/nameresolution_id.png
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;Application;System;Settings;
+StartupNotify=true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/build.xml	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,43 @@
+<?xml version="1.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 2009 Sun Microsystems, Inc.  All rights reserved.
+  Use is subject to license terms.
+-->
+
+<project name="vpanels-panels-idmap" default="jar">
+	<import file="../build-panels.xml" />
+
+	<path id="classpath.javac">
+		<fileset refid="ws.extlibs" />
+		<path refid="classpath.panels" />
+		<pathelement location="${abs.cacao}/lib/cacao_cacao.jar" />
+	</path>
+
+	<property name="panel.panel" value="idmap" />
+	<property name="panel.class"
+	    value="org.opensolaris.os.vp.panels.idmap.client.swing.IdmapPanelDescriptor" />
+	<property name="panel.name" value="Identity Mapping" />
+
+	<target name="generate_project" depends="panelsdef.generate_project">
+		<generate.cacaoxml />
+	</target>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/nbproject/project.xml	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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 2009 Sun Microsystems, Inc.  All rights reserved.
+  Use is subject to license terms.
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.ant.freeform</type>
+    <configuration>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+            <name>vpanels-panels-idmap</name>
+        </general-data>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
+            <!-- Do not use Project Properties customizer when editing this file manually. -->
+            <name>vpanels-panels-idmap</name>
+            <properties/>
+            <folders>
+                <source-folder>
+                    <label>Source Packages</label>
+                    <location>.</location>
+                    <includes>org/</includes>
+                    <encoding>UTF-8</encoding>
+                </source-folder>
+                <source-folder>
+                    <label>Source Packages</label>
+                    <type>java</type>
+                    <location>.</location>
+                    <includes>org/</includes>
+                    <encoding>UTF-8</encoding>
+                </source-folder>
+                <source-folder>
+                    <label>build/gen</label>
+                    <type>java</type>
+                    <location>build/gen</location>
+                    <includes>org/</includes>
+                    <encoding>UTF-8</encoding>
+                </source-folder>
+            </folders>
+            <ide-actions>
+                <action name="build">
+                    <target>jar</target>
+                </action>
+                <action name="clean">
+                    <target>clobber</target>
+                </action>
+                <action name="javadoc">
+                    <target>javadoc</target>
+                </action>
+                <action name="rebuild">
+                    <target>clobber</target>
+                    <target>jar</target>
+                </action>
+            </ide-actions>
+            <export>
+                <type>jar</type>
+                <location>vpanels-panels-idmap.jar</location>
+                <build-target>jar</build-target>
+            </export>
+            <view>
+                <items>
+                    <source-folder style="packages">
+                        <label>Source Packages</label>
+                        <location>.</location>
+                        <includes>org/</includes>
+                    </source-folder>
+                    <source-folder style="packages">
+                        <label>build/gen</label>
+                        <location>build/gen</location>
+                        <includes>org/</includes>
+                    </source-folder>
+                    <source-file>
+                        <location>build.xml</location>
+                    </source-file>
+                </items>
+                <context-menu>
+                    <ide-action name="build"/>
+                    <ide-action name="rebuild"/>
+                    <ide-action name="clean"/>
+                    <ide-action name="javadoc"/>
+                </context-menu>
+            </view>
+            <subprojects/>
+        </general-data>
+        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
+            <compilation-unit>
+                <package-root>.</package-root>
+                <package-root>build/gen</package-root>
+                <classpath mode="compile">../../../scf/common/scf-common.jar:../../../util/vpanels-util.jar:../../common/vpanels-common.jar:../../panel/vpanels-panel.jar:../../server/vpanels-server.jar:/usr/lib/cacao/lib/cacao_cacao.jar</classpath>
+                <built-to>vpanels-panels-idmap.jar</built-to>
+                <source-level>1.5</source-level>
+            </compilation-unit>
+        </java-data>
+    </configuration>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/DeleteMapRuleAction.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,115 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.Component;
+import java.util.*;
+import javax.swing.JOptionPane;
+import org.opensolaris.os.vp.panel.common.action.*;
+import org.opensolaris.os.vp.panel.swing.action.DeleteManagedObjectAction;
+import org.opensolaris.os.vp.panels.idmap.common.MapRule;
+import org.opensolaris.os.vp.util.misc.Finder;
+import org.opensolaris.os.vp.util.swing.GUIUtil;
+
+@SuppressWarnings({"serial"})
+public class DeleteMapRuleAction extends DeleteManagedObjectAction <
+        MapRuleManagedObject,
+        DeleteMapRuleAction.DeleteData,
+        List<MapRuleManagedObject>> {
+
+    private RulesTab control;
+
+    public static class DeleteData {
+        public List<MapRuleManagedObject> maps =
+                new ArrayList<MapRuleManagedObject>();
+    }
+
+    public DeleteMapRuleAction(RulesTab control) {
+        super(TEXT, ICONS, control);
+
+        this.control = control;
+    }
+
+    @Override
+    public DeleteData getRuntimeInput(List<MapRuleManagedObject> selection,
+        DeleteData data)
+        throws ActionAbortedException {
+
+        if (null == data) {
+            data = new DeleteData();
+            for (MapRuleManagedObject object : selection) {
+                data.maps.add(object);
+            }
+        }
+
+        int nMaps = data.maps.size();
+        if (nMaps > 0) {
+            Component component = getHasComponent().getComponent();
+            Object args[] = new Object[] {
+                new Integer(nMaps)
+            };
+	    String message = Finder.getString("panel.idmap.rule.remove", args);
+            int response = GUIUtil.showConfirmation(component, null,
+                message, JOptionPane.YES_NO_OPTION);
+            if (JOptionPane.YES_OPTION == response) {
+                return data;
+            }
+        }
+
+        throw new ActionAbortedException();
+    }
+
+    @Override
+    public List<MapRuleManagedObject> workBusy(
+        List<MapRuleManagedObject> selections,
+        DeleteData data) throws ActionAbortedException, ActionFailedException,
+        ActionUnauthorizedException
+    {
+        List<MapRuleManagedObject> deleted =
+                new ArrayList<MapRuleManagedObject>();
+
+        for (MapRuleManagedObject managedObject : data.maps) {
+            MapRule rule = managedObject.getMapRule();
+            try {
+                if (control.removeMapRule(rule)) {
+                    deleted.add(managedObject);
+                }
+            } catch (ActionUnauthorizedException e) {
+                    throw new ActionUnauthorizedException(e);
+            }
+        }
+
+        int nMaps = deleted.size();
+        MapRuleManagedObject[] gArray = deleted.toArray(
+                new MapRuleManagedObject[nMaps]);
+
+        // remove from panel's list
+        control.removeChildren(gArray);
+
+        return deleted;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/IdmapPanelDescriptor.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,148 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.io.IOException;
+import java.util.List;
+import javax.management.JMX;
+import javax.swing.*;
+import org.opensolaris.os.vp.panel.common.*;
+import org.opensolaris.os.vp.panel.common.control.*;
+import org.opensolaris.os.vp.panel.common.model.*;
+import org.opensolaris.os.vp.panel.swing.control.TabbedControl;
+import org.opensolaris.os.vp.panel.swing.model.AbstractSwingPanelDescriptor;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+import org.opensolaris.os.vp.util.misc.*;
+
+@SuppressWarnings({"serial"})
+public class IdmapPanelDescriptor
+    extends AbstractSwingPanelDescriptor<ManagedObject>
+    implements ConnectionListener {
+
+    //
+    // Static data
+    //
+
+    protected static final List<ImageIcon> icons = IconFinder.getIcons(
+	new String[] {
+	    "images/idmap-16.png",
+	    "images/idmap-24.png",
+	    "images/idmap-48.png"
+	});
+
+    //
+    // Instance data
+    //
+
+    private DefaultControl control;
+    private IdmapMXBean idmapbean;
+    private boolean hasFullPrivs;
+
+    //
+    // Constructors
+    //
+
+    public IdmapPanelDescriptor(String id, ClientContext context) {
+	super(id, context);
+
+	setIdmapBean(context.getConnectionInfo());
+	context.addConnectionListener(this);
+
+	control = new TabbedControl<IdmapPanelDescriptor>(this);
+	control.addChildren(new PropertiesTab(this), new RulesTab(this));
+
+        refresh();
+    }
+
+    //
+    // ConnectionListener methods
+    //
+
+    @Override
+    public void connectionChanged(ConnectionEvent event) {
+	setIdmapBean(event.getConnectionInfo());
+    }
+
+    //
+    // HasIcons methods
+    //
+
+    @Override
+    public List<? extends Icon> getIcons() {
+	return icons;
+    }
+
+    //
+    // ManagedObject methods
+    //
+
+    @Override
+    public String getName() {
+	return Finder.getString("panel.idmap.name");
+    }
+
+    //
+    // PanelDescriptor methods
+    //
+
+    @Override
+    public Control getControl() {
+	return control;
+    }
+
+    @Override
+    public boolean getHasFullPrivileges() {
+	return hasFullPrivs;
+    }
+
+    private void refresh() {
+    }
+
+    //
+    // IdmapPanelDescriptor methods
+    //
+
+    protected IdmapMXBean getIdmapBean() {
+	return idmapbean;
+    }
+
+    //
+    // Private methods
+    //
+
+    private void setIdmapBean(ConnectionInfo info) {
+
+	try {
+	    idmapbean = JMX.newMXBeanProxy(
+		info.getConnector().getMBeanServerConnection(),
+		IdmapUtil.OBJECT_NAME, IdmapMXBean.class);
+	    hasFullPrivs = idmapbean.isSufficientlyPrivileged();
+	} catch (IOException e) {
+	    idmapbean = null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/MapRuleEditControl.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,134 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.util.Map;
+import org.opensolaris.os.vp.common.panel.auth.UnauthorizedException;
+import org.opensolaris.os.vp.panel.common.action.*;
+import org.opensolaris.os.vp.panel.common.control.*;
+import org.opensolaris.os.vp.panel.swing.control.SwingSettingsControl;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+
+public class MapRuleEditControl
+    extends SwingSettingsControl<IdmapPanelDescriptor, MapRuleEditPanel> {
+
+
+    public static final String ID = "edit";
+    public static final String PARAM_MAP_RULE = "rule";
+
+    //
+    // Instance data
+    //
+    private MapRuleManagedObject mapRule;
+    private RulesTab tab;
+    private IdmapPanelDescriptor descriptor;
+
+    public MapRuleEditControl(IdmapPanelDescriptor descriptor, RulesTab tab) {
+	super(ID, null, descriptor);
+        this.tab = tab;
+        this.descriptor = descriptor;
+    }
+
+    //
+    // Control methods
+    //
+
+    @Override
+    public boolean isBrowsable() {
+	return false;
+    }
+
+    @Override
+    public void start(Navigator navigator, Map<String, String> parameters)
+	throws NavigationAbortedException, InvalidParameterException {
+
+	String param = parameters.get(PARAM_MAP_RULE);
+	if (param == null) {
+	    throw new MissingParameterException(getId(), PARAM_MAP_RULE);
+	}
+
+        mapRule = tab.getMapRuleManagedObject(param);
+
+	super.start(navigator, parameters);
+    }
+
+    @Override
+    public void stop(boolean isCancel) throws NavigationAbortedException {
+	super.stop(isCancel);
+	mapRule = null;
+    }
+
+    @Override
+    protected void save() throws ActionAbortedException, ActionFailedException,
+	ActionUnauthorizedException {
+
+	MapRuleEditPanel panel = getComponent();
+        MapRule updatedRule = new MapRule(
+            panel.getWinDomain(),
+            panel.getWinEntity(),
+            panel.getWinType(),
+            panel.getUnixEntity(),
+            panel.getUnixType(),
+            panel.getRuleType());
+
+        try {
+
+            MapRule oldRule = mapRule.getMapRule();
+            descriptor.getIdmapBean().editMapRules(oldRule, updatedRule);
+
+        } catch (SecurityException e) {
+                throw new ActionUnauthorizedException(e);
+        } catch (UnauthorizedException e) {
+                throw new ActionUnauthorizedException(e);
+        } catch (IdmapException e) {
+                throw new ActionFailedException(e.getMessage());
+        }
+
+        mapRule.update(updatedRule);
+
+	super.save();
+    }
+
+    //
+    // SwingControl methods
+    //
+
+    @Override
+    protected MapRuleEditPanel createComponent() {
+	MapRuleEditPanel panel = new MapRuleEditPanel();
+
+	addDefaultCancelAction(panel, false);
+	addDefaultOkayAction(panel, false);
+
+	return panel;
+    }
+
+    @Override
+    protected void initComponent() {
+        getComponent().init(mapRule);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/MapRuleEditPanel.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,295 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.EventQueue;
+import javax.swing.*;
+import org.opensolaris.os.vp.panel.swing.view.*;
+import org.opensolaris.os.vp.util.misc.*;
+import org.opensolaris.os.vp.util.misc.property.*;
+import org.opensolaris.os.vp.util.swing.*;
+import org.opensolaris.os.vp.util.swing.layout.*;
+import org.opensolaris.os.vp.util.swing.property.*;
+
+public class MapRuleEditPanel extends SettingsPanel {
+
+        public static class EntityType extends NameValue<Boolean> {
+
+            public EntityType(String desc, Boolean value) {
+                super(desc, value);
+            }
+            public EntityType(Boolean value) {
+                this(getDescription(value), value);
+            }
+            private static String getDescription(Boolean value) {
+                return ((value)
+                    ? Finder.getString("panel.idmap.rule.entity.type.user")
+                    : Finder.getString("panel.idmap.rule.entity.type.group"));
+            }
+        }
+
+        public static class RuleType extends NameValue<Integer> {
+
+            public RuleType(String desc, Integer value) {
+                super(desc, value);
+            }
+            public RuleType(Integer value) {
+                this(getDescription(value), value);
+            }
+
+            private static String getDescription(Integer value) {
+                String description;
+                switch (value) {
+                    case 0:
+                        description = Finder.getString("panel.idmap.rule.bi");
+                        break;
+                    case 1:
+                        description = Finder.getString("panel.idmap.rule.w2u");
+                        break;
+                    case 2:
+                        description = Finder.getString("panel.idmap.rule.u2w");
+                        break;
+                    default:
+                        description = "";
+                }
+                return description;
+            }
+        }
+
+        private MapRuleManagedObject mapRule;
+        private StringProperty winDomainProp = new StringProperty();
+        private StringProperty winEntityProp = new StringProperty();
+        private MutableProperty<Boolean> winTypeProp =
+            new BasicMutableProperty<Boolean>();
+        private MutableProperty<Integer> ruleTypeProp
+            = new BasicMutableProperty<Integer>();
+        private StringProperty unixEntityProp = new StringProperty();
+        private MutableProperty<Boolean> unixTypeProp
+            = new BasicMutableProperty<Boolean>();
+        private JComboBox winTypeBox;
+        private JComboBox unixTypeBox;
+
+        public MapRuleEditPanel() {}
+
+        /**
+         * Windows Domain/Entity
+         * Rule Type
+         *  Map Windows identity to Unix
+         *  Map bi-directionally
+         *  Map Unix identity to Windows
+         *  Block Windows identity mapping
+         *  Block Unix identity mapping
+         *
+         * Unix Entity
+         * Unix Entity Type
+         *  User
+         *  Group
+         *
+         * @return
+         */
+        protected JPanel createForm() {
+
+            JPanel formPanel = new JPanel();
+            formPanel.setOpaque(false);
+            Form form = new Form(formPanel, VerticalAnchor.TOP);
+
+            int gap = GUIUtil.getHalfGap();
+            int vGap = GUIUtil.getGap();
+
+            ColumnLayoutConstraint c = new ColumnLayoutConstraint(
+                HorizontalAnchor.FILL, gap);
+            ColumnLayoutConstraint colConstraint = new ColumnLayoutConstraint(
+                HorizontalAnchor.FILL, vGap);
+
+            RowLayoutConstraint r = new RowLayoutConstraint(
+                VerticalAnchor.TOP, gap);
+            r.setLayoutIfInvisible(true);
+            SimpleHasAnchors a = new SimpleHasAnchors(
+                    HorizontalAnchor.LEFT, VerticalAnchor.CENTER);
+            SimpleHasAnchors b = new SimpleHasAnchors(
+                    HorizontalAnchor.RIGHT, VerticalAnchor.CENTER);
+
+            // -----------------------------------------------------------------
+            JLabel winDomainLabel = new JLabel(Finder.getString(
+                    "panel.idmap.rule.domain"));
+            final JTextField winDomain = new JTextField(20);
+            new TextComponentPropertySynchronizer<String, JTextField>(
+                winDomainProp, winDomain, false);
+            ChangeIndicator winDomainChange = new ChangeIndicator();
+            winDomainProp.addChangeListener(winDomainChange);
+            winDomainProp.save();
+            getChangeableAggregator().addChangeables(winDomainProp);
+
+            // -----------------------------------------------------------------
+            JLabel winEntityLabel = new JLabel(Finder.getString(
+                    "panel.idmap.rule.win.entity"));
+            final JTextField winEntity = new JTextField(20);
+            new TextComponentPropertySynchronizer<String, JTextField>(
+                winEntityProp, winEntity, false);
+            ChangeIndicator winEntityChange = new ChangeIndicator();
+            winEntityProp.addChangeListener(winEntityChange);
+            winEntityProp.save();
+            getChangeableAggregator().addChangeables(winEntityProp);
+
+            // -----------------------------------------------------------------
+            JLabel winTypeLabel = new JLabel(Finder.getString(
+                    "panel.idmap.rule.entity.type"));
+            winTypeBox = new JComboBox(
+                new EntityType[] {
+                    new EntityType(true),
+                    new EntityType(false)
+               });
+            new NVComboBoxPropertySynchronizer<Boolean>(winTypeProp,
+                winTypeBox);
+            ChangeIndicator winTypeChange = new ChangeIndicator();
+            winTypeProp.addChangeListener(winTypeChange);
+            winTypeProp.save();
+            getChangeableAggregator().addChangeables(winTypeProp);
+
+            // -----------------------------------------------------------------
+            JLabel ruleTypeLabel = new JLabel(Finder.getString(
+                    "panel.idmap.rule.type"));
+            JComboBox cbox = new JComboBox(
+                new Object[] {
+                    new RuleType(0),
+                    new RuleType(1),
+                    new RuleType(2)
+                });
+            new NVComboBoxPropertySynchronizer<Integer>(ruleTypeProp, cbox);
+            ChangeIndicator ruleTypeChange = new ChangeIndicator();
+            ruleTypeProp.addChangeListener(ruleTypeChange);
+            ruleTypeProp.save();
+
+            // -----------------------------------------------------------------
+            JLabel unixEntityLabel = new JLabel(Finder.getString(
+                "panel.idmap.rule.unix.entity"));
+            final JTextField unixEntity = new JTextField(20);
+            new TextComponentPropertySynchronizer<String, JTextField>(
+                unixEntityProp, unixEntity, false);
+            ChangeIndicator unixEntityChange = new ChangeIndicator();
+            unixEntityProp.addChangeListener(unixEntityChange);
+            unixEntityProp.save();
+            getChangeableAggregator().addChangeables(unixEntityProp);
+
+            // -----------------------------------------------------------------
+            JLabel unixTypeLabel = new JLabel(Finder.getString(
+                "panel.idmap.rule.entity.type"));
+            unixTypeBox = new JComboBox(
+                new Object[] {
+                    new EntityType(true),
+                    new EntityType(false)
+                });
+            new NVComboBoxPropertySynchronizer<Boolean>(unixTypeProp,
+                unixTypeBox);
+            ChangeIndicator unixTypeChange = new ChangeIndicator();
+            unixTypeProp.addChangeListener(unixTypeChange);
+            unixTypeProp.save();
+            getChangeableAggregator().addChangeables(unixTypeProp);
+
+            // -----------------------------------------------------------------
+            form.addTable(3, gap, gap, HorizontalAnchor.CENTER, colConstraint);
+            form.add(new Spacer(), b);
+            form.add(new Spacer(), b);
+            form.add(new Spacer(), a);
+
+            form.add(winDomainChange, b);
+            form.add(winDomainLabel, b);
+            form.add(winDomain, a);
+
+            form.add(winEntityChange, b);
+            form.add(winEntityLabel, b);
+            form.add(winEntity, a);
+
+            form.add(winTypeChange, b);
+            form.add(winTypeLabel, b);
+            form.add(winTypeBox, a);
+
+            form.add(ruleTypeChange, b);
+            form.add(ruleTypeLabel, b);
+            form.add(cbox, a);
+
+            form.add(unixEntityChange, b);
+            form.add(unixEntityLabel, b);
+            form.add(unixEntity, a);
+
+            form.add(unixTypeChange, b);
+            form.add(unixTypeLabel, b);
+            form.add(unixTypeBox, a);
+
+            return formPanel;
+        }
+
+        public String getWinEntity() {
+            return winEntityProp.getValue();
+        }
+
+        public String getUnixEntity() {
+            return unixEntityProp.getValue();
+        }
+
+        public String getWinDomain() {
+            return winDomainProp.getValue();
+        }
+
+        public boolean getWinType() {
+            return winTypeProp.getValue();
+        }
+
+        public boolean getUnixType() {
+            return unixTypeProp.getValue();
+        }
+
+        public int getRuleType() {
+            return ruleTypeProp.getValue();
+        }
+
+        public void init(MapRuleManagedObject mapRule) {
+
+            assert EventQueue.isDispatchThread();
+
+
+            JPanel form = createForm();
+            setContent(form);
+
+            this.mapRule = mapRule;
+            if (null != mapRule) {
+                winDomainProp.update(mapRule.getWinDomain(), false);
+                winEntityProp.update(mapRule.getWinEntity(), false);
+                winTypeProp.update(mapRule.getWinType(), false);
+                unixEntityProp.update(mapRule.getUnixEntity(), false);
+                unixTypeProp.update(mapRule.getUnixType(), false);
+                ruleTypeProp.update(mapRule.getDirection(), false);
+            } else {
+                // Set default values
+                winTypeProp.update(true, false);
+                unixTypeProp.update(true, false);
+                ruleTypeProp.update(2, false);
+            }
+
+            validate();
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/MapRuleManagedObject.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,137 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import org.opensolaris.os.vp.panel.common.model.ManagedObject;
+import org.opensolaris.os.vp.panel.swing.model.AbstractSwingManagedObject;
+import org.opensolaris.os.vp.panels.idmap.common.MapRule;
+import org.opensolaris.os.vp.util.misc.Finder;
+
+public class MapRuleManagedObject
+        extends AbstractSwingManagedObject<ManagedObject> {
+
+    private MapRule rule;
+    private String id;
+
+    public MapRuleManagedObject(MapRule rule) {
+
+        this.rule = rule;
+        setId();
+    }
+
+    private void setId() {
+
+        StringBuilder buf = new StringBuilder();
+        buf.append(rule.getDomain()).append(rule.getWinEntity());
+        buf.append(rule.isWinType()).append(rule.getUnixEntity());
+        buf.append(rule.isUnixType()).append(rule.isUnixType());
+
+        id = buf.toString();
+    }
+
+    public MapRuleManagedObject(String id) {
+        this.rule = new MapRule("", "", false, "", false, -1);
+        this.id = id;
+    }
+
+    @Override
+    public String getId() {
+	return id;
+    }
+
+    public String getWinEntity() {
+        return rule.getWinEntity();
+    }
+
+    public String getWinDomain() {
+        return rule.getDomain();
+    }
+
+    public String getWinTypeString() {
+        return getEntityTypeString(rule.isWinType());
+    }
+
+    public boolean getWinType() {
+        return rule.isWinType();
+    }
+
+    public String getUnixEntity() {
+        return rule.getUnixEntity();
+    }
+
+    public String getUnixTypeString() {
+        return getEntityTypeString(rule.isUnixType());
+    }
+
+    public boolean getUnixType() {
+        return rule.isUnixType();
+    }
+
+    public int getDirection() {
+        return rule.getDirection();
+    }
+
+    private String getEntityTypeString(boolean type) {
+        return (type)
+            ? Finder.getString("panel.idmap.rule.entity.type.user")
+            : Finder.getString("panel.idmap.rule.entity.type.group");
+    }
+
+    public void update(String winDomain, String winEntity, boolean winType,
+        String unixEntity, boolean unixType, int direction) {
+
+        rule.update(winDomain, winEntity, winType, unixEntity,
+                unixType, direction);
+        setId();
+    }
+
+    public void update(MapRule rule) {
+        this.rule = rule;
+        setId();
+    }
+
+    public MapRule getMapRule() {
+        return (MapRule)rule.clone();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+
+        if (null == obj) {
+            return false;
+        }
+        if (obj instanceof MapRuleManagedObject) {
+            return getId().equals(((MapRuleManagedObject)obj).getId());
+        }
+	return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return getId().hashCode();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/PropInfo.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,180 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.Component;
+import javax.swing.*;
+import javax.swing.table.*;
+import org.opensolaris.os.vp.panel.common.model.ManagedObject;
+import org.opensolaris.os.vp.panel.swing.model.AbstractSwingPropInfo;
+import org.opensolaris.os.vp.util.misc.Finder;
+
+public class PropInfo {
+
+    private static Icon icon_bi;
+    private static Icon icon_w2u;
+    private static Icon icon_u2w;
+
+    static {
+        icon_bi = Finder.getIcon("images/idmap_dir_bioff.png");
+        icon_w2u = Finder.getIcon("images/idmap_dir_lroff.png");
+        icon_u2w = Finder.getIcon("images/idmap_dir_rloff.png");
+    }
+
+    public static class WindowsDomainPropInfo<M extends ManagedObject>
+            extends AbstractSwingPropInfo<M, String> {
+
+            public WindowsDomainPropInfo() {
+                super(Finder.getString("panel.idmap.prop.info.domain"), null,
+                    false, false);
+            }
+            @Override
+            public String getValue(M obj) {
+                if (obj instanceof MapRuleManagedObject) {
+                    return ((MapRuleManagedObject)obj).getWinDomain();
+                } else {
+                    return "";
+                }
+            }
+    }
+
+    public static class WinEntityPropInfo<M extends ManagedObject>
+            extends AbstractSwingPropInfo<M, String> {
+
+            public WinEntityPropInfo() {
+                super(Finder.getString("panel.idmap.prop.info.win.entity"),
+                        null, false, false);
+            }
+            @Override
+            public String getValue(M obj) {
+                if (obj instanceof MapRuleManagedObject) {
+                    return ((MapRuleManagedObject)obj).getWinEntity();
+                } else {
+                    return "";
+                }
+            }
+    }
+
+    public static class WinTypePropInfo<M extends ManagedObject>
+            extends AbstractSwingPropInfo<M, String> {
+            public WinTypePropInfo() {
+                super(Finder.getString("panel.idmap.prop.info.win.type"), null,
+                        false, false);
+            }
+            public String getValue(M obj) {
+
+                if (obj instanceof MapRuleManagedObject) {
+                    return ((MapRuleManagedObject)obj).getWinTypeString();
+                } else {
+                    return "";
+                }
+            }
+    }
+
+    public static class RuleTypePropInfo<M extends ManagedObject>
+            extends AbstractSwingPropInfo<M, Integer> {
+
+        public RuleTypePropInfo() {
+                super(Finder.getString("panel.idmap.prop.info.rule.type"), null,
+                        false, false);
+            }
+
+        @Override
+        public Integer getValue(M obj) {
+            if (obj instanceof MapRuleManagedObject) {
+                return ((MapRuleManagedObject)obj).getDirection();
+            } else {
+                return -1;
+            }
+        }
+
+        @Override
+        public TableCellRenderer getTableCellRenderer() {
+            return renderer;
+        }
+    }
+
+    public static class UnixEntityPropInfo<M extends ManagedObject>
+            extends AbstractSwingPropInfo<M, String> {
+
+            public UnixEntityPropInfo() {
+                super(Finder.getString("panel.idmap.prop.info.unix.entity"),
+                        null, false, false);
+            }
+            public String getValue(M obj) {
+                if (obj instanceof MapRuleManagedObject) {
+                    return ((MapRuleManagedObject)obj).getUnixEntity();
+                } else {
+                    return "";
+                }
+            }
+    }
+
+    public static class UnixTypePropInfo<M extends ManagedObject>
+            extends AbstractSwingPropInfo<M, String> {
+
+            public UnixTypePropInfo() {
+                super(Finder.getString("panel.idmap.prop.info.unix.type"),
+                        null, false, false);
+            }
+
+            public String getValue(M obj) {
+                if (null != obj &&
+                    obj instanceof MapRuleManagedObject) {
+                        return ((MapRuleManagedObject)obj).getUnixTypeString();
+                }
+                return "";
+            }
+    }
+
+    @SuppressWarnings({"serial"})
+    private static TableCellRenderer renderer =
+	new DefaultTableCellRenderer() {
+	    @Override
+	    public Component getTableCellRendererComponent(
+		JTable table, Object value, boolean isSelected,
+		boolean hasFocus, int row, int column) {
+
+                Icon icon = icon_bi;
+                if (value instanceof Integer) {
+                    switch (((Integer)value).intValue()) {
+                        case 0: icon = icon_bi; break;
+                        case 1: icon = icon_w2u; break;
+                        case 2: icon = icon_u2w; break;
+                    }
+                }
+
+		JLabel label = (JLabel)super.getTableCellRendererComponent(
+		    table, "", isSelected, hasFocus, row, column);
+
+                label.setIcon(icon);
+                label.setHorizontalAlignment(SwingConstants.CENTER);
+
+		return label;
+	    }
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/PropertiesPanel.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,174 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.EventQueue;
+import javax.swing.*;
+import javax.swing.event.*;
+import org.opensolaris.os.vp.panel.swing.view.*;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+import org.opensolaris.os.vp.util.misc.Finder;
+import org.opensolaris.os.vp.util.misc.property.*;
+import org.opensolaris.os.vp.util.swing.*;
+import org.opensolaris.os.vp.util.swing.layout.*;
+import org.opensolaris.os.vp.util.swing.property.*;
+
+public class PropertiesPanel extends SettingsPanel {
+
+    private BooleanProperty enabledProp = new BooleanProperty();
+    private StringProperty unixUserNameProp = new StringProperty();
+    private StringProperty unixGroupNameProp = new StringProperty();
+    private StringProperty windowsUserNameProp = new StringProperty();
+    private static int COLUMNS = 20;
+
+    public PropertiesPanel() {
+        JPanel form = createForm();
+        setContent(form, true, false);
+    }
+
+    private JPanel createForm() {
+
+        JPanel formPanel = new JPanel();
+        formPanel.setOpaque(false);
+
+	final JCheckBox enabledCheckBox
+                = new JCheckBox(Finder.getString("panel.idmap.prop.enabled"));
+	new CheckBoxPropertySynchronizer(enabledProp, enabledCheckBox);
+	ChangeIndicator enabledChange = new ChangeIndicator();
+	enabledProp.addChangeListener(enabledChange);
+        enabledProp.save();
+	getChangeableAggregator().addChangeables(enabledProp);
+
+        JLabel unixUserNameLabel =
+                new JLabel(Finder.getString("panel.idmap.prop.unix.user"));
+        final JTextField unixUserName = new JTextField(COLUMNS);
+	new TextComponentPropertySynchronizer<String, JTextField>(
+	    unixUserNameProp, unixUserName, false);
+	ChangeIndicator unixUserNameChange = new ChangeIndicator();
+	unixUserNameProp.addChangeListener(unixUserNameChange);
+	unixUserNameProp.save();
+	getChangeableAggregator().addChangeables(unixUserNameProp);
+
+        JLabel unixGroupNameLabel =
+                new JLabel(Finder.getString("panel.idmap.prop.unix.group"));
+        final JTextField unixGroupName = new JTextField(COLUMNS);
+	new TextComponentPropertySynchronizer<String, JTextField>(
+	    unixGroupNameProp, unixGroupName, false);
+	ChangeIndicator unixGroupNameChange = new ChangeIndicator();
+	unixGroupNameProp.addChangeListener(unixGroupNameChange);
+	unixGroupNameProp.save();
+	getChangeableAggregator().addChangeables(unixGroupNameProp);
+
+        JLabel windowsUserNameLabel =
+                new JLabel(Finder.getString("panel.idmap.prop.win.user"));
+        final JTextField windowsUserName = new JTextField(COLUMNS);
+	new TextComponentPropertySynchronizer<String, JTextField>(
+	    windowsUserNameProp, windowsUserName, false);
+	ChangeIndicator windowsUserNameChange = new ChangeIndicator();
+	windowsUserNameProp.addChangeListener(windowsUserNameChange);
+        windowsUserNameProp.save();
+	getChangeableAggregator().addChangeables(windowsUserNameProp);
+
+        ChangeListener listener = new ChangeListener() {
+            @Override
+            public void stateChanged(ChangeEvent e) {
+                Boolean enable = enabledCheckBox.isSelected();
+                unixUserName.setEnabled(enable);
+                unixGroupName.setEnabled(enable);
+                windowsUserName.setEnabled(enable);
+            }
+        };
+        enabledCheckBox.addChangeListener(listener);
+        listener.stateChanged(null);
+
+        Form form = new Form(formPanel, VerticalAnchor.TOP);
+        int gap = GUIUtil.getHalfGap();
+        int vGap = GUIUtil.getGap();
+
+        ColumnLayoutConstraint colConstraint = new ColumnLayoutConstraint(
+            HorizontalAnchor.FILL, vGap);
+        SimpleHasAnchors a = new SimpleHasAnchors(
+                HorizontalAnchor.LEFT, VerticalAnchor.CENTER);
+        SimpleHasAnchors b = new SimpleHasAnchors(
+                HorizontalAnchor.RIGHT, VerticalAnchor.CENTER);
+
+        form.addTable(3, gap, gap, HorizontalAnchor.CENTER, colConstraint);
+        form.add(new Spacer(), b);
+        form.add(new Spacer(), b);
+        form.add(new Spacer(), a);
+
+        form.add(enabledChange, b);
+        form.add(enabledCheckBox, b);
+        form.add(new Spacer(), a);
+
+        form.add(unixUserNameChange, b);
+        form.add(unixUserNameLabel, b);
+        form.add(unixUserName, a);
+
+        form.add(unixGroupNameChange, b);
+        form.add(unixGroupNameLabel, b);
+        form.add(unixGroupName, a);
+
+        form.add(windowsUserNameChange, b);
+        form.add(windowsUserNameLabel, b);
+        form.add(windowsUserName, a);
+
+        return formPanel;
+    }
+
+    public BooleanProperty getEnabledProp() {
+	return enabledProp;
+    }
+
+    public StringProperty getUnixUserNameProp() {
+        return unixUserNameProp;
+    }
+
+    public StringProperty getUnixGroupNameProp() {
+        return unixGroupNameProp;
+    }
+
+    public StringProperty getWindowsUserNameProp() {
+        return windowsUserNameProp;
+    }
+
+    public void init(IdmapMXBean bean) {
+
+	assert EventQueue.isDispatchThread();
+
+        IdmapProperties props = bean.getIdmapProperties();
+        if (null == props) {
+            return;
+        }
+
+	enabledProp.setValue(props.isEnabled());
+	enabledProp.update(props.isEnabled(), false);
+	unixUserNameProp.update(props.getUnixuser(), false);
+        unixGroupNameProp.update(props.getUnixgroup(), false);
+        windowsUserNameProp.update(props.getWinname(), false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/PropertiesTab.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,135 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.Component;
+import java.net.URL;
+import java.util.*;
+import javax.swing.*;
+import org.opensolaris.os.vp.common.panel.auth.UnauthorizedException;
+import org.opensolaris.os.vp.panel.common.action.*;
+import org.opensolaris.os.vp.panel.common.control.*;
+import org.opensolaris.os.vp.panel.swing.control.*;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+import org.opensolaris.os.vp.util.misc.*;
+import org.opensolaris.os.vp.util.swing.*;
+
+public class PropertiesTab
+            extends SwingSettingsControl<IdmapPanelDescriptor, PropertiesPanel>
+            implements HasTabComponent, HasIcon {
+
+    private static final String NAME = Finder.getString("panel.idmap.prop.tab");
+    private static final String ID	= "idmap_properties";
+    private ReplacingStackPanel stack = new ReplacingStackPanel();
+    private IdmapPanelDescriptor descriptor;
+
+    public PropertiesTab(IdmapPanelDescriptor descriptor) {
+        super(ID, NAME, descriptor.getClientContext());
+
+        this.descriptor = descriptor;
+        descriptor.addPropertyChangeListener(this);
+    }
+
+    @Override
+    public Component getTabComponent() {
+        return stack;
+    }
+
+    @Override
+    public void start(Navigator navigator, Map<String, String> parameters)
+        throws NavigationAbortedException, InvalidParameterException {
+
+        super.start(navigator, parameters);
+        descriptor.addPropertyChangeListener(this);
+    }
+
+    @Override
+    public void stop(boolean isCancel) throws NavigationAbortedException {
+        super.stop(isCancel);
+        descriptor.removePropertyChangeListener(this);
+    }
+
+    @Override
+    protected void save() throws ActionAbortedException, ActionFailedException,
+	ActionUnauthorizedException {
+
+        IdmapMXBean bean = descriptor.getIdmapBean();
+	PropertiesPanel panel = getComponent();
+
+        IdmapProperties props = new IdmapProperties(
+                panel.getEnabledProp().getValue(),
+                panel.getUnixUserNameProp().getValue(),
+                panel.getUnixGroupNameProp().getValue(),
+                panel.getWindowsUserNameProp().getValue());
+        try {
+
+            bean.setIdmapProperties(props);
+
+        } catch (SecurityException e) {
+            throw new ActionUnauthorizedException(e);
+
+        } catch (UnauthorizedException e) {
+            throw new ActionUnauthorizedException(e);
+        }
+
+	super.save();
+    }
+
+    @Override
+    public Icon getIcon(int size) {
+
+        List<? extends Icon> icons = (null != descriptor)
+                ? descriptor.getIcons()
+                : new ArrayList<ImageIcon>();
+        return IconUtil.getClosestIcon(icons, size);
+    }
+
+    @Override
+    public URL getHelpURL() {
+        return buildHelpURL("help/idmap.html", "#idmap-properties");
+    }
+
+    @Override
+    protected PropertiesPanel createComponent() {
+
+        PropertiesPanel panel = new PropertiesPanel();
+
+        stack.push(panel);
+        setComponentStack(stack);
+
+        addDefaultResetAction(panel);
+        addDefaultApplyAction(panel);
+        addDefaultHelpAction(panel);
+
+        return panel;
+    }
+
+    @Override
+    protected void initComponent() {
+        getComponent().init(descriptor.getIdmapBean());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/RulesPanel.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,243 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.EventQueue;
+import java.util.*;
+import java.util.logging.Logger;
+import org.opensolaris.os.vp.common.panel.auth.UnauthorizedException;
+import org.opensolaris.os.vp.panel.common.action.*;
+import org.opensolaris.os.vp.panel.common.control.*;
+import org.opensolaris.os.vp.panel.common.model.*;
+import org.opensolaris.os.vp.panel.swing.action.AddManagedObjectAction;
+import org.opensolaris.os.vp.panel.swing.control.*;
+import org.opensolaris.os.vp.panel.swing.view.*;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+
+public class RulesPanel extends SettingsPanel {
+
+    private static final Logger logger = Logger.getLogger(
+            Logger.GLOBAL_LOGGER_NAME);
+
+    public RulesPanel(IdmapPanelDescriptor descriptor,
+	StructuredAction<List<ManagedObject>, ?, ?>[] actions,
+	StructuredAction<List<ManagedObject>, ?, ?> dAction) {
+
+	TreeTableObjectsPanel oPanel = new TreeTableObjectsPanel(
+	    pMapRulesObject, mapProps, actions, dAction, "Rules", null);
+
+        setContent(oPanel, false, false);
+
+        getButtonBar().setVisible(false);
+    }
+
+    public void init(IdmapMXBean bean) {
+
+	assert EventQueue.isDispatchThread();
+
+        pMapRulesObject.clearChildren();
+
+        try {
+            List<MapRule> rules = bean.getMapRules();
+            for (MapRule rule : rules) {
+                pMapRulesObject.addChildren(new MapRuleManagedObject(rule));
+            }
+        } catch (IdmapException e) {
+            logger.warning("Getting the map rules failed, " + e.getMessage());
+        }
+    }
+
+    public void addChildren(MapRuleManagedObject... toAdd) {
+        pMapRulesObject.addChildren(toAdd);
+    }
+
+    public void removeChildren(MapRuleManagedObject[] gArray) {
+        pMapRulesObject.removeChildren(gArray);
+    }
+
+    public MapRuleManagedObject getMapRuleManagedObject(String id) {
+        return pMapRulesObject.getMapRule(id);
+    }
+
+    public static class CreateMapPanel extends MapRuleEditPanel {
+        public CreateMapPanel() {
+        }
+    }
+
+    public static class CreateMapControl
+        extends SwingSettingsControl<IdmapPanelDescriptor, CreateMapPanel> {
+
+        public static final String ID = "create";
+        public static final String PARAM_MAP_RULE = "rule";
+
+        private IdmapPanelDescriptor descriptor;
+        private RulesTab tab;
+        private MapRuleManagedObject mapRule;
+
+
+        public CreateMapControl(IdmapPanelDescriptor descriptor,
+                RulesTab tab) {
+            super(ID, null, descriptor.getClientContext());
+
+            this.descriptor = descriptor;
+            this.tab = tab;
+        }
+
+        //
+        // Control methods
+        //
+
+        @Override
+        public boolean isBrowsable() {
+            return true;
+        }
+
+        @Override
+        public void start(Navigator navigator, Map<String, String> parameters)
+            throws NavigationAbortedException, InvalidParameterException {
+            super.start(navigator, parameters);
+        }
+
+        @Override
+        public void stop(boolean isCancel) throws NavigationAbortedException {
+            super.stop(isCancel);
+            mapRule = null;
+        }
+
+        @Override
+        protected void save() throws ActionAbortedException,
+            ActionFailedException, ActionUnauthorizedException {
+
+            MapRuleEditPanel panel = getComponent();
+
+            MapRule rule = new MapRule(
+                panel.getWinDomain(),
+                panel.getWinEntity(),
+                panel.getWinType(),
+                panel.getUnixEntity(),
+                panel.getUnixType(),
+                panel.getRuleType());
+
+            try {
+
+                descriptor.getIdmapBean().addMapRules(rule);
+
+            } catch (SecurityException e) {
+                throw new ActionUnauthorizedException(e);
+            } catch (UnauthorizedException e) {
+                throw new ActionUnauthorizedException(e);
+            } catch (Exception ignoreForNow) {
+                return;
+            }
+
+            tab.getComponent().addChildren(new MapRuleManagedObject(rule));
+
+            super.save();
+        }
+
+        //
+        // SwingControl methods
+        //
+
+        @Override
+        protected CreateMapPanel createComponent() {
+            CreateMapPanel panel = new CreateMapPanel();
+
+            setComponent(panel);
+
+            addDefaultCancelAction(panel, false);
+            addDefaultOkayAction(panel, false);
+            return panel;
+        }
+
+        @Override
+        protected void initComponent() {
+            getComponent().init(mapRule);
+        }
+    }
+
+    @SuppressWarnings({"serial"})
+    public static class CreateMapRuleAction
+        extends AddManagedObjectAction<ManagedObject, String,
+        MapRuleManagedObject> {
+
+        private Control control;
+
+        public CreateMapRuleAction(RulesTab control) {
+            super(TEXT, ICONS, control);
+            this.control = control;
+        }
+
+        @Override
+        public MapRuleManagedObject invoke(String unused)
+                throws ActionAbortedException,
+            ActionFailedException {
+
+            Navigable navigable = new SimpleNavigable(
+                CreateMapControl.ID, CreateMapControl.PARAM_MAP_RULE);
+            control.getNavigator().goToAsync(false, control, navigable);
+
+            return null;
+        }
+    }
+
+    protected static final ManagedObjectPropInfo<ManagedObject, ?>[] mapProps;
+    static {
+	@SuppressWarnings({"unchecked"})
+	ManagedObjectPropInfo<ManagedObject, ?>[] tmp =
+	    new ManagedObjectPropInfo[] {
+		new PropInfo.WindowsDomainPropInfo(),
+		new PropInfo.WinEntityPropInfo(),
+		new PropInfo.WinTypePropInfo(),
+		new PropInfo.RuleTypePropInfo(),
+		new PropInfo.UnixEntityPropInfo(),
+		new PropInfo.UnixTypePropInfo()
+	    };
+	mapProps = tmp;
+    }
+
+    public static class MapRuleListManagedObject<C extends ManagedObject>
+            extends AbstractManagedObject<MapRuleManagedObject> {
+
+        public MapRuleManagedObject getMapRule(String id) {
+            synchronized (children) {
+
+                MapRuleManagedObject obj = new MapRuleManagedObject(id);
+
+                List<MapRuleManagedObject> childrenx = getChildren();
+                int index = childrenx.indexOf(obj);
+                if (index >= 0) {
+                    return childrenx.get(index);
+                }
+                return null;
+            }
+        }
+    }
+
+    static MapRuleListManagedObject<MapRuleManagedObject> pMapRulesObject =
+            new MapRuleListManagedObject<MapRuleManagedObject>();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/RulesTab.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,157 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.client.swing;
+
+import java.awt.Component;
+import java.util.*;
+import org.opensolaris.os.vp.common.panel.auth.UnauthorizedException;
+import org.opensolaris.os.vp.panel.common.action.*;
+import org.opensolaris.os.vp.panel.common.control.*;
+import org.opensolaris.os.vp.panel.common.model.ManagedObject;
+import org.opensolaris.os.vp.panel.swing.action.SimpleEditManagedObjectAction;
+import org.opensolaris.os.vp.panel.swing.control.*;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+import org.opensolaris.os.vp.util.misc.Finder;
+import org.opensolaris.os.vp.util.swing.ReplacingStackPanel;
+
+public class RulesTab
+        extends SwingSettingsControl<IdmapPanelDescriptor, RulesPanel>
+        implements HasTabComponent {
+
+    private static final String NAME = Finder.getString("panel.idmap.rule.tab");
+    private static final String ID = "objects";
+    private ReplacingStackPanel stack = new ReplacingStackPanel();
+    private IdmapPanelDescriptor descriptor;
+    private RulesPanel panel;
+
+    protected StructuredAction<List<ManagedObject>, ?, ?> editAction =
+	new SimpleEditManagedObjectAction<ManagedObject>(
+	this, MapRuleEditControl.ID, MapRuleEditControl.PARAM_MAP_RULE) {};
+
+    @SuppressWarnings({"unchecked"})
+    protected StructuredAction<List<ManagedObject>, ?, ?>[] actions;
+
+    public RulesTab(IdmapPanelDescriptor descriptor) {
+        super(ID, NAME, descriptor.getClientContext());
+
+        this.descriptor = descriptor;
+
+        addChildren(new RulesPanel.CreateMapControl(descriptor, this));
+        addChildren(new MapRuleEditControl(descriptor, this));
+    }
+
+    //
+    // HasTabComponent methods
+    //
+
+    @Override
+    public Component getTabComponent() {
+	return stack;
+    }
+
+    //
+    // Control methods
+    //
+
+    @Override
+    public List<Navigable> getBrowsable() {
+	List<Navigable> navigables = new ArrayList<Navigable>();
+	for (ManagedObject map : getPanelDescriptor().getChildren())
+	{
+	    Navigable navigable = new SimpleNavigable(
+		MapRuleEditControl.ID, map.getName(),
+		MapRuleEditControl.PARAM_MAP_RULE, map.getId());
+
+	    navigables.add(navigable);
+	}
+
+	return navigables;
+    }
+
+    //
+    // SwingControl methods
+    //
+
+    @Override
+    @SuppressWarnings({"unchecked"})
+    protected RulesPanel createComponent() {
+        actions = new StructuredAction[] {
+            new RulesPanel.CreateMapRuleAction(this),
+            new DeleteMapRuleAction(this),
+	    editAction
+	};
+
+        panel = new RulesPanel(getPanelDescriptor(), actions, editAction);
+
+        stack.push(panel);
+        setComponentStack(stack);
+
+        return panel;
+    }
+
+    @Override
+    public void start(Navigator navigator, Map<String, String> parameters)
+        throws NavigationAbortedException, InvalidParameterException {
+        super.start(navigator, parameters);
+        descriptor.addPropertyChangeListener(this);
+    }
+
+    @Override
+    public void stop(boolean isCancel) throws NavigationAbortedException {
+        super.stop(isCancel);
+        descriptor.removePropertyChangeListener(this);
+    }
+
+    @Override
+    protected void initComponent() {
+        getComponent().init(descriptor.getIdmapBean());
+    }
+
+    public boolean removeMapRule(MapRule rule)
+            throws ActionUnauthorizedException, ActionFailedException {
+
+        try {
+            descriptor.getIdmapBean().removeMapRules(rule);
+            return true;
+
+        } catch (SecurityException e) {
+            throw new ActionUnauthorizedException(e);
+        } catch (UnauthorizedException e) {
+            throw new ActionUnauthorizedException(e);
+        } catch (IdmapException e) {
+            throw new ActionFailedException(e.getMessage());
+        }
+    }
+
+    public void removeChildren(MapRuleManagedObject[] gArray) {
+        panel.removeChildren(gArray);
+    }
+
+    public MapRuleManagedObject getMapRuleManagedObject(String id) {
+        return panel.getMapRuleManagedObject(id);
+    }
+}
Binary file usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap-16.png has changed
Binary file usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap-24.png has changed
Binary file usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap-48.png has changed
Binary file usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap_dir_bioff.png has changed
Binary file usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap_dir_lroff.png has changed
Binary file usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/images/idmap_dir_rloff.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/client/swing/resources/Resources.properties	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,57 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+panel.idmap.name = Identity Mapping
+
+panel.idmap.prop.tab = Properties
+
+panel.idmap.prop.enabled = Directory-Based Mapping
+panel.idmap.prop.unix.user = Unix User Name:
+panel.idmap.prop.unix.group = Unix Group Name:
+panel.idmap.prop.win.user = Windows User Name:
+
+panel.idmap.prop.info.domain = Windows Domain
+panel.idmap.prop.info.win.entity = Windows Name
+panel.idmap.prop.info.win.type = Windows Type
+panel.idmap.prop.info.rule.type = Rule Type
+panel.idmap.prop.info.unix.entity = Unix Name
+panel.idmap.prop.info.unix.type = Unix Type
+
+panel.idmap.rule.tab = Rules
+panel.idmap.rule.domain = Windows Domain:
+panel.idmap.rule.win.entity = Windows Name:
+panel.idmap.rule.entity.type = Entity Type:
+panel.idmap.rule.type = Direction:
+panel.idmap.rule.unix.entity = Unix Name:
+panel.idmap.rule.entity.type.user = User
+panel.idmap.rule.entity.type.group = Group
+panel.idmap.rule.w2u = Map Windows identity to Unix
+panel.idmap.rule.bi = Map bi-directionally
+panel.idmap.rule.u2w = Map Unix identity to Windows
+
+panel.idmap.rule.remove = Delete the selected "{0}" maps rules?
+panel.idmap.common.exception = error code = {0}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapException.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,54 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.common;
+
+import org.opensolaris.os.vp.util.misc.Finder;
+
+@SuppressWarnings({"serial"})
+public class IdmapException extends Exception {
+
+    private int errorCode;
+
+    public IdmapException(int errorCode) {
+        super(Finder.getString("panel.idmap.common.exception",
+            new Object[] {new Integer(errorCode)}));
+        this.errorCode = errorCode;
+    }
+
+    /*
+     * @param   message   the detail message. The detail message is saved for
+     *  later retrieval by the {@link #getMessage()} method.
+     */
+    public IdmapException(int errorCode, String message) {
+        super(message);
+        this.errorCode = errorCode;
+    }
+
+    public int getErrorCode() {
+        return errorCode;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapMXBean.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,46 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.common;
+
+import java.util.List;
+import org.opensolaris.os.vp.common.panel.auth.UnauthorizedException;
+
+public interface IdmapMXBean
+{
+    boolean isSufficientlyPrivileged();
+
+    IdmapProperties getIdmapProperties();
+
+    void setIdmapProperties(IdmapProperties props) throws UnauthorizedException;
+
+    List<MapRule> getMapRules() throws IdmapException;
+    void addMapRules(MapRule rule) throws UnauthorizedException, IdmapException;
+    void removeMapRules(MapRule rule)
+            throws UnauthorizedException, IdmapException;
+    void editMapRules(MapRule oldRule, MapRule newRule)
+            throws UnauthorizedException, IdmapException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapProperties.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,84 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.common;
+
+import java.beans.ConstructorProperties;
+import java.io.Serializable;
+
+public class IdmapProperties implements Serializable {
+
+    private boolean enabled;   //  Directory-Based Mapping
+    private String unixuser;   //  AD Attribute - Unix User Name
+    private String unixgroup;  //  AD Attribute - Unix Group Name
+    private String winname;    //  Native LDAP Attribute - Windows User Name
+
+    //
+    // Constructors
+    //
+
+    @ConstructorProperties({"enabled", "unixuser", "unixgroup", "winname"})
+    public IdmapProperties(boolean enabled, String unixuser, String unixgroup,
+        String winname) {
+
+        setEnabled(enabled);
+        setUnixuser(unixuser);
+        setUnixgroup(unixgroup);
+        setWinname(winname);
+    }
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public String getUnixuser() {
+        return unixuser;
+    }
+
+    public void setUnixuser(String unixuser) {
+        this.unixuser = unixuser;
+    }
+
+    public String getUnixgroup() {
+        return unixgroup;
+    }
+
+    public void setUnixgroup(String unixgroup) {
+        this.unixgroup = unixgroup;
+    }
+
+    public String getWinname() {
+        return winname;
+    }
+
+    public void setWinname(String winname) {
+        this.winname = winname;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapRuntimeException.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,40 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.common;
+
+@SuppressWarnings({"serial"})
+public class IdmapRuntimeException extends RuntimeException
+{
+	public IdmapRuntimeException()
+	{
+	}
+
+	public IdmapRuntimeException(String s)
+	{
+		super(s);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/IdmapUtil.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,40 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.common;
+
+import javax.management.ObjectName;
+import org.opensolaris.os.vp.common.panel.MBeanUtil;
+
+public class IdmapUtil {
+    //
+    // Static data
+    //
+
+    public static final String DOMAIN = MBeanUtil.VP_PANEL_DOMAIN + ".idmap";
+    public static final ObjectName OBJECT_NAME =
+	MBeanUtil.makeObjectName(DOMAIN, "Identity Mapping");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/common/MapRule.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,136 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.common;
+
+import java.beans.ConstructorProperties;
+
+/**
+ *  usr/src/uts/common/sys/idmap.h
+ *  usr/src/uts/common/sys/acl.h
+ */
+public class MapRule implements Cloneable {
+
+    //
+    // Constructors
+    //
+
+    @ConstructorProperties({"domain", "winEntity", "winType", "unixEntity",
+        "unixType", "direction"})
+    public MapRule(String domain, String winEntity, boolean winType,
+        String unixEntity, boolean unixType, int direction) {
+
+        setDomain(domain);
+        setWinEntity(winEntity);
+        setWinType(winType);
+        setUnixEntity(unixEntity);
+        setUnixType(unixType);
+        setDirection(direction);
+    }
+
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String winDomain) {
+        this.domain = winDomain;
+    }
+
+    public String getWinEntity() {
+        return winEntity;
+    }
+
+    public void setWinEntity(String winEntity) {
+        this.winEntity = winEntity;
+    }
+
+    public boolean isWinType() {
+        return winType;
+    }
+
+    public void setWinType(boolean winType) {
+        this.winType = winType;
+    }
+
+    public String getUnixEntity() {
+        return unixEntity;
+    }
+
+    public void setUnixEntity(String unixEntity) {
+        this.unixEntity = unixEntity;
+    }
+
+    public boolean isUnixType() {
+        return unixType;
+    }
+
+    public void setUnixType(boolean unixType) {
+        this.unixType = unixType;
+    }
+
+    public int getDirection() {
+        return direction;
+    }
+
+    public void setDirection(int direction) {
+        this.direction = direction;
+    }
+
+    public void update(String domain, String winEntity, boolean winType,
+        String unixEntity, boolean unixType, int direction) {
+
+        setDomain(domain);
+        setWinEntity(winEntity);
+        setWinType(winType);
+        setUnixEntity(unixEntity);
+        setUnixType(unixType);
+        setDirection(direction);
+    }
+
+    @Override
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException ex) {
+            throw new InternalError(ex.toString());
+        }
+    }
+
+    /** Windows Domain, All / specific */
+    private String domain;
+
+    /** Windows Entity, All / specific */
+    private String winEntity;
+    /* Windows Entity Type, User or Group */
+    private boolean winType;
+
+    /** Unix Entity, All / specific */
+    private String unixEntity;
+    /** Unix Entity Type, User / Group */
+    private boolean unixType;
+
+    private int direction;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/Idmap.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,159 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.server.module;
+
+import java.util.List;
+import javax.management.*;
+import org.opensolaris.os.vp.common.panel.auth.UnauthorizedException;
+import org.opensolaris.os.vp.panels.idmap.common.*;
+import org.opensolaris.os.vp.util.jmx.auth.AuthUtil;
+import org.opensolaris.os.vp.util.misc.LibraryUtil;
+
+public class Idmap implements IdmapMXBean, MBeanRegistration {
+    //
+    // MBeanRegistration methods
+    //
+
+    @Override
+    public void postDeregister() {
+    }
+
+    @Override
+    public void postRegister(Boolean registrationDone) {
+    }
+
+    @Override
+    public void preDeregister() {
+    }
+
+    @Override
+    public ObjectName preRegister(MBeanServer server, ObjectName name) {
+        return (IdmapUtil.OBJECT_NAME);
+    }
+
+    //
+    // IdmapMXBean methods
+    //
+
+    @Override
+    public boolean isSufficientlyPrivileged() {
+	return AuthUtil.isRoot();
+    }
+
+
+    private long pointer_ = 0;
+    private static native void init();
+    private native void native_ctor();
+    private native void native_dtor();
+
+    private native IdmapProperties get_idmap_props();
+    private native void set_idmap_props(IdmapProperties props);
+
+    private native List<MapRule> get_maps() throws IdmapException;
+    private native void add_map(MapRule rule) throws IdmapException;
+    private native void edit_map(MapRule oldRule, MapRule newRule)
+            throws IdmapException;
+    private native void remove_map(MapRule rule) throws IdmapException;
+
+    static
+    {
+            LibraryUtil.loadLibrary(Idmap.class,
+                new LibraryUtil.LibraryLoader()
+                {
+                    public void load(String filename)
+                    {
+                            System.load(filename);
+                    }
+                },
+                "libidmap_jni.so.1",
+                System.getenv("VPANELS_DEBUG") != null);
+            Idmap.init();
+    }
+
+    public Idmap()
+    {
+        native_ctor();
+    }
+
+    @Override
+    protected void finalize()
+    {
+        native_dtor();
+    }
+
+    @Override
+    public IdmapProperties getIdmapProperties() {
+        return get_idmap_props();
+    }
+
+    @Override
+    public void setIdmapProperties(IdmapProperties props)
+            throws UnauthorizedException {
+
+        if (!isSufficientlyPrivileged()) {
+	    throw new UnauthorizedException();
+	}
+
+        set_idmap_props(props);
+    }
+
+    @Override
+    public List<MapRule> getMapRules() throws IdmapException {
+
+        return get_maps();
+    }
+
+    @Override
+    public void addMapRules(MapRule rule)
+            throws UnauthorizedException, IdmapException {
+
+        if (!isSufficientlyPrivileged()) {
+	    throw new UnauthorizedException();
+	}
+        add_map(rule);
+    }
+
+    @Override
+    public void removeMapRules(MapRule rule)
+            throws UnauthorizedException, IdmapException {
+
+        if (!isSufficientlyPrivileged()) {
+	    throw new UnauthorizedException();
+	}
+        remove_map(rule);
+    }
+
+    @Override
+    public void editMapRules(MapRule oldRule, MapRule newRule)
+            throws UnauthorizedException, IdmapException {
+
+        if (!isSufficientlyPrivileged()) {
+	    throw new UnauthorizedException();
+	}
+        edit_map(oldRule, newRule);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/Idmap.rootacl.properties	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,43 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+addNotificationListener=any
+getAttribute=any
+getClassLoader=any
+getClassLoaderFor=any
+getClassLoaderRepository=any
+getDomains=any
+getMBeanInfo=any
+getObjectInstance=any
+instantiate=root
+invoke=root
+isInstanceOf=any
+queryMBeans=any
+queryNames=any
+registerMBean=any
+removeNotificationListener=any
+setAttribute=root
+unregisterMBean=root
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/IdmapGenerator.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,44 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.server.module;
+
+import java.util.*;
+import javax.management.MBeanRegistration;
+import org.opensolaris.os.vp.server.common.AbstractMBeanGenerator;
+
+public class IdmapGenerator extends AbstractMBeanGenerator {
+    //
+    // MBeanGenerator methods
+    //
+
+    @Override
+    public Set<MBeanRegistration> getMBeans() {
+	Set<MBeanRegistration> result = new HashSet<MBeanRegistration>();
+	result.add(new Idmap());
+	return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/IdmapModule.java	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,83 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+package org.opensolaris.os.vp.panels.idmap.server.module;
+
+import com.sun.cacao.DeploymentDescriptor;
+import java.util.*;
+import org.opensolaris.os.vp.panels.idmap.common.IdmapUtil;
+import org.opensolaris.os.vp.server.common.SimpleModule;
+import org.opensolaris.os.vp.server.module.proxy.MBeanGenerator;
+
+public class IdmapModule extends SimpleModule {
+    //
+    // Instance data
+    //
+
+    private IdmapGenerator generator;
+
+    //
+    // Constructors
+    //
+
+    public IdmapModule(DeploymentDescriptor descriptor) {
+	super(descriptor);
+	generator = new IdmapGenerator();
+    }
+
+    //
+    // DomainDispatcher methods
+    //
+
+    @Override
+    public String getDomain() {
+	return IdmapUtil.DOMAIN;
+    }
+
+    //
+    // SimpleModule methods
+    //
+
+    @Override
+    protected MBeanGenerator getGenerator() {
+	return generator;
+    }
+
+    @Override
+    protected Set<String> getJars() {
+	Set<String> result = new HashSet<String>();
+	result.add("/usr/share/vpanels/vpanels-common.jar");
+	result.add("/usr/share/vpanels/vpanels-server.jar");
+	result.add("/usr/share/vpanels/vpanels-util.jar");
+	result.add("/usr/share/vpanels/panel/vpanels-panels-idmap.jar");
+	return result;
+    }
+
+    @Override
+    protected boolean isProxied() {
+	return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panels/idmap/org/opensolaris/os/vp/panels/idmap/server/module/module:idmap.xml	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module SYSTEM "/usr/share/lib/xml/dtd/vpanel-module.dtd.1">
+<module name='idmap' proxied='true'>
+        <description xml:lang='C'>Identity Mapping</description>
+	<domain>org.opensolaris.os.vp.panels.idmap</domain>
+        <mainclass>org.opensolaris.os.vp.panels.idmap.server.module.IdmapGenerator</mainclass>
+	<jar>vpanels-common.jar</jar>
+	<jar>vpanels-server.jar</jar>
+	<jar>vpanels-util.jar</jar>
+	<jar>panel/vpanels-panels-idmap.jar</jar>
+</module>
--- a/usr/src/lib/Makefile	Fri Jun 26 16:06:20 2009 -0400
+++ b/usr/src/lib/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -20,14 +20,12 @@
 #
 
 #
-# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"@(#)Makefile	1.5	07/09/05 SMI"
-#
 
 include $(SRC)/Makefile.env
 
-libscf_jni libUnixDomainSocket_jni libshare_jni: libjniutil
+libscf_jni libUnixDomainSocket_jni libshare_jni libidmap_jni: libjniutil
 
 include $(SRC)/Makefile.targ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/Idmap.c	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,735 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+#include <libshare.h>
+#include <libjniutil.h>
+#include <pthread.h>
+#include <stdarg.h>
+
+#include <idmap.h>
+#include "Idmap.h"
+#include "common.h"
+#include "idmap_scf.h"
+#include "idmap_idmap.h"
+
+
+jclass idmap_class;
+
+jclass list_class;
+jmethodID list_ctor;
+jmethodID list_add;
+
+jclass map_class;
+jmethodID map_ctor;
+jmethodID map_put;
+jmethodID map_get;
+
+jclass idmap_prop_class;
+jmethodID idmap_prop_ctor;
+
+jclass idmap_rule_class;
+jmethodID idmap_rule_ctor;
+
+jclass idmapxcp_class;
+jmethodID idmapexcp_ctor;
+jmethodID idmapexcp_ctor2;
+
+/*
+ * Per-object native state;
+ */
+typedef struct {
+	pthread_mutex_t lock;
+	idmap_handle_t *idmap_handle;
+} nstate_t;
+
+static jfieldID fid_ptr;
+
+#define	fa_Handle(env, obj) \
+	GETLONGFIELD(env, idmap_class, nstate_t, obj, fid_ptr)
+
+classdef_t classes[] = {
+	{ &idmap_class, NULL,
+	    "org/opensolaris/os/vp/panels/idmap/server/module/Idmap",
+	    NULL },
+	{ &list_class, &list_ctor, "java/util/LinkedList", "()V" },
+	{ &map_class, &map_ctor, "java/util/HashMap", "()V" },
+	{ &idmap_prop_class, &idmap_prop_ctor,
+	    "org/opensolaris/os/vp/panels/idmap/common/IdmapProperties",
+	    "(ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V" },
+	{ &idmap_rule_class, &idmap_rule_ctor,
+	    "org/opensolaris/os/vp/panels/idmap/common/MapRule",
+	    "(Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;ZI)V" },
+	{ &idmapxcp_class, &idmapexcp_ctor,
+	    "org/opensolaris/os/vp/panels/idmap/common/IdmapException",
+	    "(I)V" },
+};
+
+
+static void
+rtidmapexception(JNIEnv *env, const char *format, ...)
+{
+	va_list alist;
+
+	va_start(alist, format);
+	simpleexception(env, "org/opensolaris/os/vp/panels/idmap/common/"
+	    "IdmapRuntimeException", format, alist);
+	va_end(alist);
+}
+
+static void
+idmapexception(JNIEnv *env, int error, const char *detail_message)
+{
+	if (NULL == detail_message) {
+		throw(env, idmapxcp_class, idmapexcp_ctor, error);
+	} else {
+		jstring jmessage = (*env)->NewStringUTF(env, detail_message);
+		if (NULL == jmessage) {
+			return;
+		}
+		throw(env, idmapxcp_class, idmapexcp_ctor2, error,
+		    jmessage);
+		(*env)->DeleteLocalRef(env, jmessage);
+	}
+}
+
+static jobject
+make_idmap_rule(JNIEnv *env, const char *win_domain,
+    const char *win_entity, boolean_t winType, const char *unix_entity,
+    boolean_t unixType, int direction)
+{
+	jobject result = NULL;
+	jstring jwin_domain;
+	jstring jwin_entity;
+	jboolean jwinType;
+	jstring junix_entity;
+	jboolean junixType;
+	jint jdirection;
+
+	jwin_domain = (*env)->NewStringUTF(env, (NULL == win_domain)
+	    ? "" : win_domain);
+	if (NULL == jwin_domain) {
+		return (result);
+	}
+
+	jwin_entity = (*env)->NewStringUTF(env, (NULL == win_entity)
+	    ? "" : win_entity);
+	if (NULL == jwin_entity) {
+		(*env)->DeleteLocalRef(env, jwin_domain);
+		return (result);
+	}
+
+	junix_entity = (*env)->NewStringUTF(env, (NULL == unix_entity)
+	    ? "" : unix_entity);
+	if (NULL == junix_entity) {
+		(*env)->DeleteLocalRef(env, jwin_domain);
+		(*env)->DeleteLocalRef(env, jwin_entity);
+		return (result);
+	}
+
+	jwinType = (B_TRUE == winType) ? JNI_TRUE : JNI_FALSE;
+	junixType = (B_TRUE == unixType) ? JNI_TRUE : JNI_FALSE;
+	jdirection = direction;
+
+	result = makeobject(env, idmap_rule_class, idmap_rule_ctor, jwin_domain,
+	    jwin_entity, jwinType, junix_entity, junixType, jdirection);
+	(*env)->DeleteLocalRef(env, jwin_domain);
+	(*env)->DeleteLocalRef(env, jwin_entity);
+	(*env)->DeleteLocalRef(env, junix_entity);
+
+	return (result);
+}
+
+static jobject
+make_idmap_props(JNIEnv *env, boolean_t enabled, char *unixuser,
+    char *unixgroup, char *winname)
+{
+	jobject result = NULL;
+	jstring junixuser;
+	jstring junixgroup;
+	jstring jwinname;
+	jboolean jenabled;
+
+	junixuser = (*env)->NewStringUTF(env, (NULL == unixuser)
+	    ? "" : unixuser);
+	if (NULL == junixuser) {
+		return (result);
+	}
+
+	junixgroup = (*env)->NewStringUTF(env, (NULL == unixgroup)
+	    ? "" : unixgroup);
+	if (NULL == junixgroup) {
+		(*env)->DeleteLocalRef(env, junixuser);
+		return (result);
+	}
+
+	jwinname = (*env)->NewStringUTF(env, (NULL == winname) ? "" : winname);
+	if (NULL == jwinname) {
+		(*env)->DeleteLocalRef(env, junixuser);
+		(*env)->DeleteLocalRef(env, junixgroup);
+		return (result);
+	}
+
+	jenabled = (B_TRUE == enabled) ? JNI_TRUE : JNI_FALSE;
+
+	result = makeobject(env, idmap_prop_class, idmap_prop_ctor, jenabled,
+	    junixuser, junixgroup, jwinname);
+	(*env)->DeleteLocalRef(env, junixuser);
+	(*env)->DeleteLocalRef(env, junixgroup);
+	(*env)->DeleteLocalRef(env, jwinname);
+
+	return (result);
+}
+
+/*
+ * Class:     Idmap
+ * Method:    init
+ * Signature: ()V
+ */
+void
+JP(Idmap_init)(JNIEnv *env, jclass class)
+{
+	int i;
+
+	fid_ptr = fetch_ptr_id(env, class, "pointer_");
+	for (i = 0; i < sizeof (classes) / sizeof (classdef_t); ++i) {
+		load_class(env, &classes[i], B_TRUE);
+	}
+
+	list_add = (*env)->GetMethodID(env, list_class, "add",
+	    "(Ljava/lang/Object;)Z");
+	if (0 == list_add) {
+		(*env)->FatalError(env, "Couldn't find LinkedList.add(Object)");
+	}
+
+	map_put = (*env)->GetMethodID(env, map_class, "put",
+	    "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+	if (0 == map_put) {
+		(*env)->FatalError(env,
+		    "Couldn't find HashMap.put(Object, Object)");
+	}
+
+	map_get = (*env)->GetMethodID(env, map_class, "get",
+	    "(Ljava/lang/Object;)Ljava/lang/Object;");
+	if (0 == map_get) {
+		(*env)->FatalError(env, "Couldn't find HashMap.get(Object)");
+	}
+
+	idmapexcp_ctor2 = (*env)->GetMethodID(env, idmapxcp_class, "<init>",
+	    "(ILjava/lang/String;)V");
+	if (0 == idmapexcp_ctor2) {
+		(*env)->FatalError(env,
+		    "Couldn't find IdmapException(int, String)");
+	}
+}
+
+/*
+ * Class:     Idmap
+ * Method:    native_ctor
+ * Signature: ()V
+ */
+void
+JP(Idmap_native_1ctor)(JNIEnv *env, jobject obj)
+{
+	nstate_t *state;
+
+	if (fa_Handle(env, obj) != NULL) {
+		rtidmapexception(env, "bad initial state");
+		return;
+	}
+
+	if ((state = malloc(sizeof (nstate_t))) == NULL) {
+		oomerror(env, "malloc failure");
+		return;
+	}
+
+	(void) pthread_mutex_init(&state->lock, NULL);
+
+	if (init_idmap_command(&state->idmap_handle)) {
+		(void) pthread_mutex_destroy(&state->lock);
+		free(state);
+		return;
+	}
+
+	(*env)->SetLongField(env, obj, fid_ptr, (long)state);
+}
+
+/*
+ * Class:     Idmap
+ * Method:    native_dtor
+ * Signature: ()V
+ */
+void
+JP(Idmap_native_1dtor)(JNIEnv *env, jobject obj)
+{
+	nstate_t *state = fa_Handle(env, obj);
+
+	if (NULL == state) {
+		return;
+	}
+
+	(void) pthread_mutex_destroy(&state->lock);
+	if (NULL != state->idmap_handle) {
+		fini_idmap_command(&state->idmap_handle);
+	}
+	free(state);
+}
+
+static nstate_t *
+get_state(JNIEnv *env, jobject obj)
+{
+	return (fa_Handle(env, obj));
+}
+
+/*
+ * Class:     Idmap
+ * Method:    get_idmap_props
+ * Signature: ()Lorg/opensolaris/os/vp/panels/idmap/common/IdmapProperties;
+ */
+JNIEXPORT jobject JNICALL
+JP(Idmap_get_1idmap_1props)(JNIEnv *env, jobject obj)
+{
+	jobject result = NULL;
+	uint8_t bool_val;
+	char *unixuser = NULL;
+	char *unixgroup = NULL;
+	char *winname = NULL;
+
+	get_idmap_props(&bool_val, &unixuser, &unixgroup, &winname);
+
+	result = make_idmap_props(env, bool_val, unixuser, unixgroup, winname);
+
+	if (unixuser) {
+		free(unixuser);
+	}
+	if (unixgroup) {
+		free(unixgroup);
+	}
+	if (winname) {
+		free(winname);
+	}
+
+	return (result);
+}
+
+/*
+ * Class:     Idmap
+ * Method:    set_idmap_props
+ * Signature: (Lorg/opensolaris/os/vp/panels/idmap/common/IdmapProperties;)V
+ */
+JNIEXPORT void JNICALL
+JP(Idmap_set_1idmap_1props)(JNIEnv *env, jobject obj, jobject prop)
+{
+	jfieldID fieldID;
+	jstring j_unixuser;
+	const char *unixuser = NULL;
+	jstring j_unixgroup;
+	const char *unixgroup = NULL;
+	jstring j_winname;
+	const char *winname = NULL;
+	jboolean j_enabled;
+	uint8_t valbool;
+
+	jclass idmap_prop_class = (*env)->GetObjectClass(env, prop);
+
+	fieldID = (*env)->GetFieldID(env, idmap_prop_class, "unixuser",
+	"Ljava/lang/String;");
+	if (NULL == fieldID) {
+		rtidmapexception(env, "cannot find field unixuser");
+		return;
+	}
+	j_unixuser = (*env)->GetObjectField(env, prop, fieldID);
+	unixuser = (*env)->GetStringUTFChars(env, j_unixuser, NULL);
+	if (NULL == unixuser) {
+		goto error;
+	}
+
+	fieldID = (*env)->GetFieldID(env, idmap_prop_class, "unixgroup",
+	"Ljava/lang/String;");
+	if (NULL == fieldID) {
+		rtidmapexception(env, "cannot find field unixgroup");
+		goto error;
+	}
+	j_unixgroup = (*env)->GetObjectField(env, prop, fieldID);
+	unixgroup = (*env)->GetStringUTFChars(env, j_unixgroup, NULL);
+	if (NULL == unixgroup) {
+		goto error;
+	}
+
+	fieldID = (*env)->GetFieldID(env, idmap_prop_class, "winname",
+	"Ljava/lang/String;");
+	if (NULL == fieldID) {
+		rtidmapexception(env, "cannot find field winname");
+		goto error;
+	}
+	j_winname = (*env)->GetObjectField(env, prop, fieldID);
+	winname = (*env)->GetStringUTFChars(env, j_winname, NULL);
+	if (NULL == winname) {
+		goto error;
+	}
+
+	fieldID = (*env)->GetFieldID(env, idmap_prop_class, "enabled", "Z");
+	if (NULL == fieldID) {
+		rtidmapexception(env, "cannot find field enabled");
+		goto error;
+	}
+	j_enabled = (*env)->GetBooleanField(env, prop, fieldID);
+	valbool = (JNI_TRUE == j_enabled) ? B_TRUE : B_FALSE;
+
+	set_idmap_props(valbool, unixuser, unixgroup, winname);
+
+error:
+	if (unixuser) {
+		(*env)->ReleaseStringUTFChars(env, j_unixuser, unixuser);
+	}
+	if (unixgroup) {
+		(*env)->ReleaseStringUTFChars(env, j_unixgroup, unixgroup);
+	}
+	if (winname) {
+		(*env)->ReleaseStringUTFChars(env, j_winname, winname);
+	}
+}
+
+/*
+ * Class:     Idmap
+ * Method:    get_maps
+ * Signature: ()Ljava/util/List;
+ */
+JNIEXPORT jobject JNICALL
+JP(Idmap_get_1maps)(JNIEnv *env, jobject obj)
+{
+	nstate_t *state;
+	idmap_stat stat;
+	idmap_iter_t *ihandle;
+	jobject result = NULL;
+	jobject rule = NULL;
+	name_mapping_t *nm;
+	boolean_t is_user;
+	boolean_t is_wuser;
+	const char *error_detail = NULL;
+
+	result = makeobject(env, list_class, list_ctor);
+
+	if (NULL == (state = get_state(env, obj))) {
+		return (NULL);
+	}
+	(void) pthread_mutex_lock(&state->lock);
+
+	stat = idmap_iter_namerules(state->idmap_handle, NULL, 0, 0, NULL, NULL,
+	    &ihandle);
+	if (stat < 0) {
+		error_detail = idmap_stat2string(state->idmap_handle, stat);
+		idmap_iter_destroy(ihandle);
+		(void) pthread_mutex_unlock(&state->lock);
+		return (result);
+	}
+
+	do {
+		nm = name_mapping_init();
+		if (NULL == nm) {
+			goto error;
+		}
+
+		stat = idmap_iter_next_namerule(ihandle, &nm->windomain,
+		    &nm->winname, &nm->unixname, &is_user, &is_wuser,
+		    &nm->is_nt4, &nm->direction);
+		if (stat >= 0) {
+			nm->is_user = is_user ? IDMAP_YES : IDMAP_NO;
+			nm->is_wuser = is_wuser ? IDMAP_YES : IDMAP_NO;
+
+			rule = make_idmap_rule(env, nm->windomain, nm->winname,
+			    nm->is_wuser, nm->unixname, nm->is_user,
+			    nm->direction);
+			if (NULL == rule) {
+				name_mapping_fini(nm);
+				break;
+			}
+
+			(void) (*env)->CallBooleanMethod(env, result,
+			    list_add, rule);
+			(*env)->DeleteLocalRef(env, rule);
+			if (JNI_TRUE == (*env)->ExceptionCheck(env)) {
+				name_mapping_fini(nm);
+				break;
+			}
+		}
+		name_mapping_fini(nm);
+
+	} while (stat > 0);
+
+	(void) pthread_mutex_unlock(&state->lock);
+
+	idmap_iter_destroy(ihandle);
+	return (result);
+
+error:
+	(void) pthread_mutex_unlock(&state->lock);
+
+	idmap_iter_destroy(ihandle);
+	(*env)->DeleteLocalRef(env, result);
+
+	return (NULL);
+}
+
+typedef struct {
+	jstring j_win_domain;
+	const char *windomain;
+
+	jstring j_win_entity;
+	const char *winname;
+
+	jstring j_unix_entity;
+	const char *unixname;
+
+	int is_user;
+	int is_wuser;
+	int direction;
+
+} map_rule_t;
+
+static void
+free_map_rule(JNIEnv *env, map_rule_t *p_map) {
+
+	if (p_map->windomain) {
+	    (*env)->ReleaseStringUTFChars(env, p_map->j_win_domain,
+		p_map->windomain);
+	}
+	if (p_map->winname) {
+	    (*env)->ReleaseStringUTFChars(env, p_map->j_win_entity,
+		p_map->winname);
+	}
+	if (p_map->unixname) {
+	    (*env)->ReleaseStringUTFChars(env, p_map->j_unix_entity,
+		p_map->unixname);
+	}
+	free(p_map);
+}
+
+static map_rule_t *
+init_map_rule()
+{
+	map_rule_t *nm = (map_rule_t *)malloc(sizeof (map_rule_t));
+	if (NULL != nm) {
+		nm->winname = nm->windomain = nm->unixname = NULL;
+		nm->is_user = IDMAP_UNKNOWN;
+		nm->is_wuser = IDMAP_UNKNOWN;
+		nm->direction = IDMAP_DIRECTION_UNDEF;
+	}
+	return (nm);
+}
+
+static map_rule_t *
+get_map(JNIEnv *env, jobject jmap)
+{
+	jfieldID fieldID;
+	jboolean j_enabled;
+	jint j_direction;
+
+	jclass idmap_map_class = (*env)->GetObjectClass(env, jmap);
+
+	map_rule_t *p_map = init_map_rule();
+
+	fieldID = (*env)->GetFieldID(env, idmap_rule_class, "domain",
+	    "Ljava/lang/String;");
+	if (NULL == fieldID) {
+		return (p_map);
+	}
+	p_map->j_win_domain = (*env)->GetObjectField(env, jmap, fieldID);
+	p_map->windomain = (*env)->GetStringUTFChars(env, p_map->j_win_domain,
+	    NULL);
+	if (NULL == p_map->windomain) {
+		goto error;
+	}
+
+	fieldID = (*env)->GetFieldID(env, idmap_rule_class, "winEntity",
+	    "Ljava/lang/String;");
+	if (NULL == fieldID) {
+		goto error;
+	}
+	p_map->j_win_entity = (*env)->GetObjectField(env, jmap, fieldID);
+	p_map->winname = (*env)->GetStringUTFChars(env, p_map->j_win_entity,
+	    NULL);
+	if (NULL == p_map->winname) {
+		goto error;
+	}
+
+	fieldID = (*env)->GetFieldID(env, idmap_rule_class, "unixEntity",
+	    "Ljava/lang/String;");
+	if (NULL == fieldID) {
+		goto error;
+	}
+	p_map->j_unix_entity = (*env)->GetObjectField(env, jmap, fieldID);
+	p_map->unixname = (*env)->GetStringUTFChars(env, p_map->j_unix_entity,
+	    NULL);
+	if (NULL == p_map->unixname) {
+		goto error;
+	}
+
+	fieldID = (*env)->GetFieldID(env, idmap_rule_class, "winType", "Z");
+	if (NULL == fieldID) {
+		goto error;
+	}
+	j_enabled = (*env)->GetBooleanField(env, jmap, fieldID);
+	p_map->is_wuser = (JNI_TRUE == j_enabled) ? B_TRUE : B_FALSE;
+
+	fieldID = (*env)->GetFieldID(env, idmap_rule_class, "unixType", "Z");
+	if (NULL == fieldID) {
+		goto error;
+	}
+	j_enabled = (*env)->GetBooleanField(env, jmap, fieldID);
+	p_map->is_user = (JNI_TRUE == j_enabled) ? B_TRUE : B_FALSE;
+
+	fieldID = (*env)->GetFieldID(env, idmap_rule_class, "direction", "I");
+	if (NULL == fieldID) {
+		goto error;
+	}
+	j_direction = (*env)->GetIntField(env, jmap, fieldID);
+	p_map->direction = j_direction;
+
+	return (p_map);
+error:
+	free_map_rule(env, p_map);
+	return (NULL);
+}
+
+/*
+ * Class:     Idmap
+ * Method:    add_map
+ * Signature: (Lorg/opensolaris/os/vp/panels/idmap/common/MapRule;)V
+ */
+JNIEXPORT void JNICALL
+JP(Idmap_add_1map)(JNIEnv *env, jobject obj, jobject jmap)
+{
+	nstate_t *state;
+	map_rule_t *p_map = get_map(env, jmap);
+	const char *error_detail;
+	int rc;
+
+	if (NULL == (state = get_state(env, obj))) {
+		return;
+	}
+
+	(void) pthread_mutex_lock(&state->lock);
+	if (p_map) {
+		rc = idmap_add_rule(state->idmap_handle,
+		    p_map->windomain, p_map->winname,
+		    p_map->is_wuser, p_map->unixname, p_map->is_user,
+		    p_map->direction, &error_detail);
+	}
+	if (IDMAP_SUCCESS != rc) {
+		idmapexception(env, rc, error_detail);
+	}
+	(void) pthread_mutex_unlock(&state->lock);
+
+	if (p_map) {
+		free_map_rule(env, p_map);
+	}
+}
+
+/*
+ * Class:     Idmap
+ * Method:    edit_map
+ * Signature: (Lorg/opensolaris/os/vp/panels/idmap/common/MapRule;)V
+ */
+JNIEXPORT void JNICALL
+JP(Idmap_edit_1map)(JNIEnv *env, jobject obj, jobject j_old_map,
+    jobject j_new_map)
+{
+	nstate_t *state;
+	int rc = 0;
+	map_rule_t *p_old_map = get_map(env, j_old_map);
+	map_rule_t *p_new_map = get_map(env, j_new_map);
+	const char *error_detail;
+
+	if ((state = get_state(env, obj)) == NULL) {
+		return;
+	}
+
+	(void) pthread_mutex_lock(&state->lock);
+	if (p_old_map && p_new_map) {
+		rc = idmap_remove_rule(state->idmap_handle,
+		    p_old_map->windomain, p_old_map->is_user,
+		    p_old_map->is_wuser, p_old_map->winname,
+		    p_old_map->unixname, p_old_map->direction, &error_detail);
+		if (IDMAP_SUCCESS == rc) {
+			rc = idmap_add_rule(state->idmap_handle,
+			    p_new_map->windomain, p_new_map->winname,
+			    p_new_map->is_wuser, p_new_map->unixname,
+			    p_new_map->is_user, p_new_map->direction,
+			    &error_detail);
+		}
+		if (IDMAP_SUCCESS != rc) {
+			idmapexception(env, rc, error_detail);
+		}
+	}
+	(void) pthread_mutex_unlock(&state->lock);
+
+	if (p_old_map) {
+		free_map_rule(env, p_old_map);
+	}
+	if (p_new_map) {
+		free_map_rule(env, p_new_map);
+	}
+}
+
+/*
+ * Class:     Idmap
+ * Method:    remove_map
+ * Signature: (Lorg/opensolaris/os/vp/panels/idmap/common/MapRule;)V
+ */
+JNIEXPORT void JNICALL
+JP(Idmap_remove_1map)(JNIEnv *env, jobject obj, jobject jmap)
+{
+	nstate_t *state;
+	map_rule_t *p_map = get_map(env, jmap);
+	const char *error_detail;
+	int rc = 0;
+
+	if (NULL == (state = get_state(env, obj))) {
+		return;
+	}
+
+	(void) pthread_mutex_lock(&state->lock);
+	if (p_map) {
+		rc = idmap_remove_rule(state->idmap_handle, p_map->windomain,
+		    p_map->is_user, p_map->is_wuser, p_map->winname,
+		    p_map->unixname, p_map->direction, &error_detail);
+		if (rc) {
+			idmapexception(env, rc, error_detail);
+		}
+	}
+	(void) pthread_mutex_unlock(&state->lock);
+
+	if (p_map) {
+		free_map_rule(env, p_map);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,58 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include Makefile.env
+
+# Jars that must be built prior (added automatically to CLASSPATH)
+DEPENDENCY_JARS = \
+	$(SRC)/java/vpanels/panels/idmap/vpanels-panels-idmap.jar
+
+# Override SUBDIRS
+ARCH:sh=uname -p
+SUBDIRS_sparc=sparcv7 sparcv9
+SUBDIRS_i386=i386 amd64
+SUBDIRS=osol-deps $(SUBDIRS_$(ARCH))
+
+CLEAN_FILES += $(HEADERS)
+
+include $(SRC)/Makefile.targ
+
+$(SUBDIRS_$(ARCH)): osol-deps
+
+headers: $(HEADERS)
+
+$(HEADERS): $(DEPENDENCY_JARS)
+	for f in $(DEPENDENCY_JARS); \
+	do \
+		jar tf "$$f"; \
+	done | $(GREP) '/$(@:%.h=%).class' | \
+	$(SED) 's/\.class$$//; s#/#.#g' | \
+	$(XARGS) echo javah -classpath $(CLASS_PATH) -o $@ | \
+	while read line; \
+	do \
+		echo "$$line"; \
+		$$line; \
+	done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/Makefile.com	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,59 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.env
+
+TARG = libidmap_jni.so.1
+OBJS = $(NATIVES:%=%.o) idmap_scf.o idmap_idmap.o
+CFLAGS = $(ARCH) -Kpic -I$(ROOT)/usr/include -I/usr/java/include -I/usr/java/include/solaris -I../osol-deps
+LFLAGS = -L. -L$(ROOT)/usr/lib/$(LLINK) -Wl,-zdefs -ljniutil -lidmap -lscf -lc
+LPATH = $(ROOT)/usr/lib/$(LDIR)
+
+CLEAN_FILES += $(OBJS)
+CLOBBER_FILES += $(TARG)
+
+include $(SRC)/Makefile.targ
+
+all: $(CLASSES) $(TARG)
+
+install: $(TARG)
+	mkdir -p $(LPATH)
+	$(RM) -- $(ROOT)/usr/lib/$(LLINK)
+	ln -fs $(LDIR) $(ROOT)/usr/lib/$(LLINK)
+	/usr/sbin/install -f $(LPATH) -m 755 -s $(TARG)
+
+$(TARG): $(OBJS)
+	ln -fs /usr/lib/$(LLINK)/libidmap.so.1 libidmap.so
+	$(CC) $(ARCH) -G -h $@ -o $@ $(OBJS) $(LFLAGS)
+
+%.o: ../%.c ../%.h
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
+
+%.ln: ../%.c
+	$(LINT.c) $(OUTPUT_OPTION) -c $<
+
+../%.h:
+	cd $(@D); $(MAKE) $(@F)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/Makefile.env	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include $(SRC)/Makefile.env
+
+NATIVES = \
+	Idmap
+
+HEADERS = $(NATIVES:%=%.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/amd64/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+ARCH=-xarch=amd64
+LDIR=amd64
+LLINK=64
+
+include ../Makefile.com
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/common.h	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,39 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_COMMON_H
+#define	_COMMON_H
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#define	JP(x) Java_org_opensolaris_os_vp_panels_idmap_server_module_##x
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _COMMON_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/i386/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+ARCH=
+LDIR=.
+LLINK=32
+
+include ../Makefile.com
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/idmap_idmap.c	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,158 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdio.h>
+#include <libintl.h>
+#include <idmap.h>
+#include "idmap_idmap.h"
+
+/* Allocate a new name_mapping_t and initialize the values. */
+name_mapping_t *
+name_mapping_init()
+{
+	name_mapping_t *nm = (name_mapping_t *)malloc(sizeof (name_mapping_t));
+	if (NULL == nm) {
+		return (NULL);
+	}
+	nm->winname = nm->windomain = nm->unixname = nm->sidprefix = NULL;
+	nm->is_nt4 = B_FALSE;
+	nm->is_user = IDMAP_UNKNOWN;
+	nm->is_wuser = IDMAP_UNKNOWN;
+	nm->direction = IDMAP_DIRECTION_UNDEF;
+	return (nm);
+}
+
+/* Free name_mapping_t */
+void
+name_mapping_fini(name_mapping_t *nm)
+{
+	free(nm->winname);
+	free(nm->windomain);
+	free(nm->unixname);
+	free(nm->sidprefix);
+
+	free(nm);
+}
+
+/* Initialization of the libidmap API */
+int
+init_idmap_command(idmap_handle_t **handle)
+{
+	idmap_stat stat;
+
+	stat = idmap_init(handle);
+	if (stat != IDMAP_SUCCESS) {
+		*handle = NULL;
+		return (-1);
+	}
+
+	return (0);
+}
+
+/* Finalization of the libidmap API */
+void
+fini_idmap_command(idmap_handle_t **handle)
+{
+	if (handle != NULL) {
+		(void) idmap_fini(*handle);
+		handle = NULL;
+	}
+}
+
+int
+idmap_add_rule(
+    idmap_handle_t *handle,
+    const char *windomain, const char *winname, boolean_t is_wuser,
+    const char *unixname, boolean_t is_user, int direction,
+    const char **error_detail)
+{
+	idmap_udt_handle_t *udt = NULL;
+	idmap_stat stat;
+	boolean_t is_nt4 = B_FALSE;
+
+	*error_detail = NULL;
+
+	stat = idmap_udt_create(handle, &udt);
+	if (stat != IDMAP_SUCCESS) {
+		*error_detail = idmap_stat2string(handle, stat);
+		return (-1);
+	}
+
+	stat = idmap_udt_add_namerule(udt, windomain, is_user, is_wuser,
+	    winname, unixname, is_nt4, direction);
+	if (stat < 0) {
+		*error_detail = idmap_stat2string(handle, stat);
+		goto error;
+	}
+
+	stat = idmap_udt_commit(udt);
+	if (IDMAP_SUCCESS != stat) {
+		*error_detail = idmap_stat2string(handle, stat);
+		goto error;
+	}
+
+error:
+	idmap_udt_destroy(udt);
+	udt = NULL;
+
+	return ((int)stat);
+}
+
+int
+idmap_remove_rule(
+    idmap_handle_t *handle, const char *windomain, boolean_t is_user,
+    boolean_t is_wuser, const char *winname, const char *unixname,
+    int direction, const char **error_detail)
+{
+	int rc = 0;
+	idmap_stat stat;
+	idmap_udt_handle_t *udt = NULL;
+
+	*error_detail = NULL;
+
+	stat = idmap_udt_create(handle, &udt);
+	if (stat != IDMAP_SUCCESS) {
+		return (-1);
+	}
+
+	stat = idmap_udt_rm_namerule(udt,
+	    is_user,
+	    is_wuser,
+	    windomain, winname, unixname, direction);
+	if (stat < 0) {
+		*error_detail = idmap_stat2string(handle, stat);
+		rc = -1;
+	}
+
+	stat = idmap_udt_commit(udt);
+	if (IDMAP_SUCCESS != stat) {
+		*error_detail = idmap_stat2string(handle, stat);
+	}
+
+	idmap_udt_destroy(udt);
+	udt = NULL;
+
+	return (rc);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/idmap_idmap.h	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,135 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_IDMAP_IDMAP_H
+#define	_IDMAP_IDMAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*  from idmap_prot.h */
+
+typedef int idmap_retcode;
+
+/*  from idmap_impl.h */
+
+struct idmap_iter {
+	struct idmap_handle	*ih;
+	int			type;
+	uint64_t		limit;
+	void			*arg;
+	idmap_retcode		retcode;
+	uint64_t		lastrowid;
+	uint64_t		next;
+	void			*retlist;
+};
+
+/* from idmap_priv.h */
+
+/* Opaque iterator */
+typedef struct idmap_iter idmap_iter_t;
+
+/* Opaque handle to batch config add/remove operations */
+typedef struct idmap_udt_handle idmap_udt_handle_t;
+
+extern idmap_stat idmap_init(idmap_handle_t **);
+
+/* Finalize/close handle */
+extern idmap_stat idmap_fini(idmap_handle_t *);
+
+/* Create handle for updates */
+extern idmap_stat idmap_udt_create(idmap_handle_t *,
+	idmap_udt_handle_t **);
+
+/* Commit */
+extern idmap_stat idmap_udt_commit(idmap_udt_handle_t *);
+
+/* Add name-based mapping rule */
+extern idmap_stat idmap_udt_add_namerule(idmap_udt_handle_t *, const char *,
+	boolean_t, boolean_t, const char *, const char *, boolean_t, int);
+
+/* Remove name-based mapping rule */
+extern idmap_stat idmap_udt_rm_namerule(idmap_udt_handle_t *, boolean_t,
+	boolean_t, const char *, const char *, const char *, int);
+
+/* Destroy the update handle */
+extern void idmap_udt_destroy(idmap_udt_handle_t *);
+
+/* Create a iterator to get name-based mapping rules */
+extern idmap_stat idmap_iter_namerules(idmap_handle_t *, const char *,
+	boolean_t, boolean_t, const char *, const char *, idmap_iter_t **);
+
+/* Iterate through the name-based mapping rules */
+extern idmap_stat idmap_iter_next_namerule(idmap_iter_t *, char **,
+	char **, char **, boolean_t *, boolean_t *, boolean_t *, int *);
+
+/* Destroy the iterator */
+extern void idmap_iter_destroy(idmap_iter_t *);
+
+extern int
+idmap_add_rule(
+    idmap_handle_t *handle,
+    const char *windomain, const char *winname, boolean_t is_wuser,
+    const char *unixname, boolean_t is_user, int direction,
+    const char **error_detail);
+
+extern int
+idmap_remove_rule(idmap_handle_t *handle, const char *windomain,
+    boolean_t is_user, boolean_t is_wuser, const char *winname,
+    const char *unixname, int direction, const char **error_detail);
+
+#define	IDMAP_DIRECTION_UNDEF -1
+#define	IDMAP_DIRECTION_BI 0
+#define	IDMAP_DIRECTION_W2U 1
+#define	IDMAP_DIRECTION_U2W 2
+
+#define	IDMAP_YES 1
+#define	IDMAP_NO 0
+#define	IDMAP_UNKNOWN -1
+
+typedef struct {
+	int is_user;
+	int is_wuser;
+	int direction;
+	boolean_t is_nt4;
+	char *unixname;
+	char *winname;
+	char *windomain;
+	char *sidprefix;
+
+} name_mapping_t;
+
+name_mapping_t *name_mapping_init();
+void name_mapping_fini(name_mapping_t *nm);
+
+int init_idmap_command(idmap_handle_t **handle);
+void fini_idmap_command(idmap_handle_t **handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _IDMAP_IDMAP_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/idmap_scf.c	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,522 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <smbsrv/libsmb.h>
+#include <libscf.h>
+
+#include "idmap_scf.h"
+
+/* Handle Init states */
+#define	IDMAP_SCH_STATE_UNINIT		0
+#define	IDMAP_SCH_STATE_INITIALIZING	1
+#define	IDMAP_SCH_STATE_INIT		2
+
+typedef struct idmap_scfhandle {
+
+	scf_handle_t *scf_handle;
+	int scf_state;
+	scf_transaction_t *scf_trans;
+	scf_propertygroup_t *scf_pg;
+
+} idmap_scfhandle_t;
+
+#define	FMRI_BASE		"svc:/system/idmap"
+#define	CONFIG_PG		"config"
+
+static char *
+scf_value2string(scf_value_t *value)
+{
+	int rc = 0;
+	char *buf = NULL;
+
+	int length = scf_value_get_astring(value, buf, 0);
+	if (length < 0) {
+		rc = -1;
+		goto destruction;
+	}
+
+	buf = (char *) malloc(sizeof (char) * (length + 1));
+	if (!buf) {
+		rc = -1;
+		goto destruction;
+	}
+
+	length = scf_value_get_astring(value, buf, length);
+	if (length < 0) {
+		rc = -1;
+		goto destruction;
+	}
+
+destruction:
+	if (rc < 0) {
+		if (buf) {
+			free(buf);
+		}
+		buf = NULL;
+	}
+
+	return (buf);
+}
+
+static int
+get_val_astring(idmap_scfhandle_t *handles, const char *name, char **val)
+{
+	int rc = 0;
+
+	scf_property_t *scf_prop;
+	scf_value_t *value;
+
+	scf_prop = scf_property_create(handles->scf_handle);
+	if (NULL == scf_prop) {
+		return (-1);
+	}
+	value = scf_value_create(handles->scf_handle);
+	if (NULL == value) {
+		scf_property_destroy(scf_prop);
+		return (-1);
+	}
+
+	*val = NULL;
+
+	if (scf_pg_get_property(handles->scf_pg, name, scf_prop) < 0) {
+	/* this is OK: the property is just undefined */
+		goto destruction;
+	}
+
+	if (scf_property_get_value(scf_prop, value) < 0) {
+		rc = -1;
+		goto destruction;
+	}
+
+	if (!(*val = scf_value2string(value))) {
+		rc = -1;
+	}
+
+destruction:
+	scf_value_destroy(value);
+	scf_property_destroy(scf_prop);
+
+	if (rc < 0) {
+		if (*val) {
+			free(*val);
+		}
+		*val = NULL;
+	}
+
+	return (rc);
+}
+
+/* Check if in the case of failure the original value of *val is preserved */
+static int
+get_val_int(idmap_scfhandle_t *handles, const char *name,
+	void *val, scf_type_t type)
+{
+	int rc = 0;
+
+	scf_property_t *scf_prop;
+	scf_value_t *value;
+
+	switch (type) {
+	case SCF_TYPE_BOOLEAN:
+		*(uint8_t *)val = 0;
+		break;
+	case SCF_TYPE_COUNT:
+		*(uint64_t *)val = 0;
+		break;
+	case SCF_TYPE_INTEGER:
+		*(int64_t *)val = 0;
+		break;
+	default:
+		return (-1);
+	}
+
+	scf_prop = scf_property_create(handles->scf_handle);
+	if (NULL == scf_prop) {
+		return (-1);
+	}
+	value = scf_value_create(handles->scf_handle);
+	if (NULL == value) {
+		scf_property_destroy(scf_prop);
+		return (-1);
+	}
+
+	if (scf_pg_get_property(handles->scf_pg, name, scf_prop) < 0) {
+	/* this is OK: the property is just undefined */
+		goto destruction;
+	}
+
+
+	if (scf_property_get_value(scf_prop, value) < 0) {
+	/* It is still OK when a property doesn't have any value */
+		goto destruction;
+	}
+
+	switch (type) {
+	case SCF_TYPE_BOOLEAN:
+		rc = scf_value_get_boolean(value, val);
+		break;
+	case SCF_TYPE_COUNT:
+		rc = scf_value_get_count(value, val);
+		break;
+	case SCF_TYPE_INTEGER:
+		rc = scf_value_get_integer(value, val);
+		break;
+	}
+
+
+destruction:
+	scf_value_destroy(value);
+	scf_property_destroy(scf_prop);
+
+	return (rc);
+}
+
+static void
+idmap_smf_scf_fini(idmap_scfhandle_t *handle)
+{
+	if (NULL != handle) {
+		if (handle->scf_pg) {
+			scf_pg_destroy(handle->scf_pg);
+		}
+		handle->scf_state = IDMAP_SCH_STATE_UNINIT;
+		if (handle->scf_handle) {
+			(void) scf_handle_unbind(handle->scf_handle);
+			scf_handle_destroy(handle->scf_handle);
+			free(handle);
+		}
+	}
+}
+
+/*
+ * Must be called before using any of the SCF functions. Returns
+ * idmap_scfhandle_t pointer if success.
+ */
+static idmap_scfhandle_t *
+idmap_smf_scf_init()
+{
+	idmap_scfhandle_t *handle;
+
+	handle = (idmap_scfhandle_t *)calloc(1, sizeof (idmap_scfhandle_t));
+	if (NULL != handle) {
+		handle->scf_state = IDMAP_SCH_STATE_INITIALIZING;
+		if ((NULL != (handle->scf_handle =
+		    scf_handle_create(SCF_VERSION))) &&
+		    (0 == scf_handle_bind(handle->scf_handle))) {
+			if (NULL == (handle->scf_pg =
+			    scf_pg_create(handle->scf_handle))) {
+				goto err;
+			}
+
+			if (scf_handle_decode_fmri(handle->scf_handle,
+			    FMRI_BASE "/:properties/" CONFIG_PG,
+			    NULL,		/* scope */
+			    NULL,		/* service */
+			    NULL,		/* instance */
+			    handle->scf_pg,	/* pg */
+			    NULL,		/* prop */
+			    SCF_DECODE_FMRI_EXACT) < 0) {
+				goto err;
+			}
+			handle->scf_state = IDMAP_SCH_STATE_INIT;
+		} else {
+			goto err;
+		}
+	} else {
+		handle = NULL;
+	}
+	return (handle);
+
+	/* Error handling/unwinding */
+err:
+	(void) idmap_smf_scf_fini(handle);
+	return (NULL);
+}
+
+/*
+ * Start transaction on current pg in handle. The pg could be service or
+ * instance level. Must be called after pg handle is obtained from create or
+ * get.
+ */
+static int
+idmap_smf_start_transaction(idmap_scfhandle_t *handle)
+{
+	/*
+	 * Lookup the property group and create it if it doesn't already
+	 * exist.
+	 */
+	if (IDMAP_SCH_STATE_INIT == handle->scf_state) {
+		if (NULL != (handle->scf_trans =
+		    scf_transaction_create(handle->scf_handle))) {
+			if (0 != scf_transaction_start(handle->scf_trans,
+			    handle->scf_pg)) {
+				scf_transaction_destroy(handle->scf_trans);
+				handle->scf_trans = NULL;
+				return (-1);
+			}
+		} else {
+			return (-1);
+		}
+	}
+	if (SCF_ERROR_PERMISSION_DENIED == scf_error()) {
+		return (-1);
+	}
+
+	return (0);
+}
+
+/*
+ * Deletes property in current pg
+ */
+static int
+idmap_smf_delete_property(idmap_scfhandle_t *handle, const char *propname)
+{
+	scf_transaction_entry_t *entry = NULL;
+
+	/*
+	 * Properties must be set in transactions and don't take effect until
+	 * the transaction has been ended/committed.
+	 */
+	if (NULL != (entry = scf_entry_create(handle->scf_handle))) {
+		if (0 != scf_transaction_property_delete(handle->scf_trans,
+		    entry, propname)) {
+			scf_entry_destroy(entry);
+			return (-1);
+		}
+	} else {
+		return (-1);
+	}
+	if (SCF_ERROR_PERMISSION_DENIED == (scf_error())) {
+		scf_entry_destroy(entry);
+		return (-1);
+	}
+
+	return (0);
+}
+
+/*
+ * Sets property in current pg
+ */
+static int
+idmap_smf_set_property(idmap_scfhandle_t *handle,
+    const char *propname, const char *valstr)
+{
+	int ret = 0;
+	scf_value_t *value = NULL;
+	scf_transaction_entry_t *entry = NULL;
+	scf_property_t *prop;
+	scf_type_t type;
+	int64_t valint;
+	uint8_t valbool;
+
+	/*
+	 * Properties must be set in transactions and don't take effect until
+	 * the transaction has been ended/committed.
+	 */
+	if ((NULL != (value = scf_value_create(handle->scf_handle))) &&
+	    NULL != (entry = scf_entry_create(handle->scf_handle))) {
+		if ((NULL != (prop
+		    = scf_property_create(handle->scf_handle))) &&
+		    (0 == (scf_pg_get_property(handle->scf_pg, propname,
+		    prop)))) {
+			if (0 == scf_property_get_value(prop, value)) {
+				type = scf_value_type(value);
+				if ((0 == scf_transaction_property_change(
+				    handle->scf_trans, entry, propname,
+				    type)) ||
+				    (0 == scf_transaction_property_new(
+				    handle->scf_trans, entry, propname,
+				    type))) {
+					switch (type) {
+					case SCF_TYPE_ASTRING:
+						if (SCF_SUCCESS !=
+						    scf_value_set_astring(value,
+						    valstr)) {
+							ret = -1;
+						}
+						break;
+					case SCF_TYPE_INTEGER:
+						valint = strtoll(valstr, 0, 0);
+						scf_value_set_integer(value,
+						    valint);
+						break;
+					case SCF_TYPE_BOOLEAN:
+						if (strncmp(valstr, "yes", 3)) {
+							valbool = 0;
+						} else {
+							valbool = 1;
+						}
+						scf_value_set_boolean(value,
+						    valbool);
+						break;
+					default:
+						ret = -1;
+					}
+					if (0 != scf_entry_add_value(entry,
+					    value)) {
+						ret = -1;
+						scf_value_destroy(value);
+					}
+					/* The value is in the transaction */
+					value = NULL;
+				}
+				/* The entry is in the transaction */
+				entry = NULL;
+			} else {
+				ret = -1;
+			}
+		} else {
+			ret = -1;
+		}
+	} else {
+		ret = -1;
+	}
+	if (ret == -1) {
+		if (SCF_ERROR_PERMISSION_DENIED == scf_error()) {
+			fprintf(stderr, "idmap_smf_set_property() failed: %s",
+			    scf_strerror(scf_error()));
+		} else {
+			fprintf(stderr, "idmap_smf_set_property() failed: %s",
+			    scf_strerror(scf_error()));
+		}
+	}
+	scf_value_destroy(value);
+	scf_entry_destroy(entry);
+	return (ret);
+}
+
+/*
+ * Commit the changes that were added to the transaction in the handle. Do all
+ * necessary cleanup.
+ */
+static int
+idmap_smf_end_transaction(idmap_scfhandle_t *handle)
+{
+	if (scf_transaction_commit(handle->scf_trans) < 0) {
+		// ndmp_errno = ENDMP_SMF_INTERNAL;
+		fprintf(stderr, "idmap_smf_end_transaction() failed: %s",
+		    scf_strerror(scf_error()));
+		return (-1);
+	}
+
+	scf_transaction_destroy_children(handle->scf_trans);
+	scf_transaction_destroy(handle->scf_trans);
+	handle->scf_trans = NULL;
+
+	return (0);
+}
+
+int
+get_idmap_props(uint8_t *mapping_enabled, char **unixuser, char **unixgroup,
+	char **winname) {
+
+	idmap_scfhandle_t *handle;
+	int rc;
+
+	handle = idmap_smf_scf_init();
+	if (!handle) {
+		return (-1);
+	}
+
+	if (scf_pg_update(handle->scf_pg) < 0) {
+		goto error;
+	}
+
+	rc = get_val_astring(handle, "ad_unixuser_attr", unixuser);
+	if (SCF_SUCCESS != rc) {
+		goto error;
+	}
+	rc = get_val_astring(handle, "ad_unixgroup_attr", unixgroup);
+	if (SCF_SUCCESS != rc) {
+		goto error;
+	}
+	rc = get_val_astring(handle, "nldap_winname_attr", winname);
+	if (SCF_SUCCESS != rc) {
+		goto error;
+	}
+	rc = get_val_int(handle, "ds_name_mapping_enabled", mapping_enabled,
+		SCF_TYPE_BOOLEAN);
+	if (SCF_SUCCESS != rc) {
+		goto error;
+	}
+
+	rc = scf_error();
+error:
+	idmap_smf_scf_fini(handle);
+
+	return (rc);
+}
+
+static int
+idmap_smf_do_set_property(idmap_scfhandle_t *handle, const char *propname,
+    const char *valstr) {
+
+	if (NULL == valstr) {
+		return (idmap_smf_delete_property(handle, propname));
+	} else {
+		return (idmap_smf_set_property(handle, propname, valstr));
+	}
+}
+
+int
+set_idmap_props(uint8_t mapping_enabled, const char *unixuser,
+    const char *unixgroup, const char *winname) {
+
+	scf_value_t *value = NULL;
+	scf_transaction_entry_t *entry = NULL;
+	scf_property_t *prop;
+	scf_type_t type;
+	idmap_scfhandle_t *handle = NULL;
+
+	handle = idmap_smf_scf_init();
+	if (!handle) {
+		return (-1);
+	}
+
+	handle->scf_state = IDMAP_SCH_STATE_INIT;
+	if (idmap_smf_start_transaction(handle)) {
+		goto error;
+	}
+
+	if (
+	    idmap_smf_do_set_property(handle, "ad_unixuser_attr",
+	    unixuser) ||
+	    idmap_smf_do_set_property(handle, "ad_unixgroup_attr",
+	    unixgroup) ||
+	    idmap_smf_do_set_property(handle, "nldap_winname_attr",
+	    winname) ||
+	    idmap_smf_do_set_property(handle, "ds_name_mapping_enabled",
+	    (0 != mapping_enabled) ? "yes" : "no")) {
+		goto error;
+	}
+
+error:
+
+	idmap_smf_end_transaction(handle);
+	idmap_smf_scf_fini(handle);
+
+	return (scf_error());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/idmap_scf.h	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,42 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_IDMAP_SCF_H
+#define	_IDMAP_SCF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int get_idmap_props(uint8_t *mapping_enabled, char **unixuser,
+	char **unixgroup, char **winname);
+extern int set_idmap_props(uint8_t mapping_enabled, const char *unixuser,
+	const char *unixgroup, const char *winname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _IDMAP_SCF_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/osol-deps/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,28 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include $(SRC)/Makefile.env
+include $(SRC)/Makefile.targ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/osol-deps/smbsrv/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,104 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include $(SRC)/Makefile.env
+
+URL_PREFIX = http://src.opensolaris.org/source/raw/onnv/onnv-gate
+
+OSO_UTS_HEADERS = \
+	alloc.h \
+	cifs.h \
+	codepage.h \
+	cp_cyrillic.h \
+	cp_latin1.h \
+	cp_latin2.h \
+	cp_latin3.h \
+	cp_latin4.h \
+	cp_latin5.h \
+	cp_latin6.h \
+	cp_unicode.h \
+	cp_usascii.h \
+	ctype.h \
+	doserror.h \
+	hash_table.h \
+	lm.h \
+	lmdfs.h \
+	lmerr.h \
+	mac_cifs.h \
+	mailslot.h \
+	mbuf.h \
+	msgbuf.h \
+	ndr.h \
+	netbios.h \
+	netrauth.h \
+	nmpipes.h \
+	ntaccess.h \
+	nterror.h \
+	ntifs.h \
+	ntlocale.h \
+	ntstatus.h \
+	oem.h \
+	smb.h \
+	smb_common_door.h \
+	smb_door_svc.h \
+	smb_fsops.h \
+	smb_i18n.h \
+	smb_idmap.h \
+	smb_incl.h \
+	smb_inet.h \
+	smb_ioctl.h \
+	smb_kproto.h \
+	smb_kstat.h \
+	smb_ktypes.h \
+	smb_privilege.h \
+	smb_share.h \
+	smb_sid.h \
+	smb_token.h \
+	smb_vops.h \
+	smb_xdr.h \
+	smbfmt.h \
+	smbinfo.h \
+	string.h \
+	svrapi.h \
+	winioctl.h \
+	winsvc.h \
+	wintypes.h
+
+OSO_LIB_HEADERS = \
+	libsmb.h
+
+HEADERS = $(OSO_LIB_HEADERS) $(OSO_UTS_HEADERS)
+CLEAN_FILES += $(HEADERS)
+
+include $(SRC)/Makefile.targ
+
+all: $(HEADERS)
+
+$(OSO_LIB_HEADERS):
+	$(WGET) $(URL_PREFIX)/usr/src/lib/smbsrv/libsmb/common/$@
+
+$(OSO_UTS_HEADERS):
+	$(WGET) $(URL_PREFIX)/usr/src/uts/common/smbsrv/$@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/osol-deps/sqlite/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,42 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include $(SRC)/Makefile.env
+
+DOWNLOAD = \
+	sqlite.h.in
+
+CLEAN_FILES += sqlite.h $(DOWNLOAD)
+
+include $(SRC)/Makefile.targ
+
+all: sqlite.h $(DOWNLOAD)
+
+$(DOWNLOAD):
+	$(WGET) http://src.opensolaris.org/source/raw/onnv/onnv-gate/usr/src/lib/libsqlite/src/$@
+
+sqlite.h: sqlite.h.in
+	cp "$^" "$@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/sparcv7/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+ARCH=-xarch=v8
+LDIR=.
+LLINK=32
+
+include ../Makefile.com
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libidmap_jni/sparcv9/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+ARCH=-xarch=v9
+LDIR=sparcv9
+LLINK=64
+
+include ../Makefile.com
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOL0vpanels-idmap/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.env
+
+install: all pkg
+
+include ../Makefile.targ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOL0vpanels-idmap/depend	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,29 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+P OSOL0vpanels-api	Visual Panels API
+P OSOL0vpanels-server	Visual Panels Server (Usr)
+P OSOL0vpanels-server-root	Visual Panels Server (Root)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOL0vpanels-idmap/pkginfo	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,39 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+PKG="OSOL0vpanels-idmap"
+NAME="Visual Panels: Identity Mapping panel (Usr)"
+ARCH="ISA"
+VERSION="1.0"
+MAXINST="1000"
+CATEGORY="system"
+DESC="Visual Panels: Identity Mapping panel (Usr)"
+VENDOR="http://www.opensolaris.org/os/project/vpanels/"
+HOTLINE="[email protected]"
+EMAIL="[email protected]"
+CLASSES="none"
+BASEDIR="/"
+SUNW_PKGVERS="1.0"
+SUNW_PKGTYPE="usr"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOL0vpanels-idmap/prototype_com	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,42 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# packaging files
+i depend
+i pkginfo
+
+d none usr 755 root sys
+d none usr/lib 755 root bin
+f none usr/lib/libidmap_jni.so.1 755 root bin
+d none usr/share 755 root sys
+d none usr/share/applications 755 root other
+f none usr/share/applications/vp-idmap.desktop 644 root bin
+d none usr/share/vpanels 755 root sys
+d none usr/share/vpanels/panel 755 root sys
+f none usr/share/vpanels/panel/vpanels-panels-idmap.jar 644 root sys
+f none usr/share/vpanels/panels/idmap.xml 444 root sys
+d none usr/share/vpanels/modules 755 root sys
+f none usr/share/vpanels/modules/idmap.xml 444 root sys
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOL0vpanels-idmap/prototype_i386	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,30 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+!include prototype_com
+
+d none usr/lib/amd64 755 root bin
+f none usr/lib/amd64/libidmap_jni.so.1 755 root bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOL0vpanels-idmap/prototype_sparc	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,30 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+!include prototype_com
+
+d none usr/lib/sparcv9 755 root bin
+f none usr/lib/sparcv9/libidmap_jni.so.1 755 root bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOLvpin-idmap/Makefile	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,31 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.env
+
+install: all pkg
+
+include ../Makefile.targ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOLvpin-idmap/copyright	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,23 @@
+Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+Use is subject to license terms.
+
+--------------------------------------------------------------------
+
+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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOLvpin-idmap/pkginfo	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,41 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+PKG="OSOLvpin-idmap"
+NAME="Visual Panels Identity Mapping Panel"
+ARCH="ISA"
+VERSION="1.0.0"
+MAXINST="1000"
+CATEGORY="system"
+DESC="Visual Panels Identity Mapping Panel"
+VENDOR="http://www.opensolaris.org/os/project/vpanels/"
+HOTLINE="[email protected]"
+EMAIL="[email protected]"
+CLASSES="none"
+BASEDIR="/"
+SUNW_PKGVERS="1.0"
+SUNW_PRODNAME=SunOS
+SUNW_PKGTYPE=root
+SUNW_PRODVERS=5.11/vpanels-gate
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOLvpin-idmap/prototype_com	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,48 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# packaging files
+i pkginfo
+i copyright
+
+d none usr/lib 755 root bin
+f none usr/lib/libidmap_jni.so.1 755 root bin
+
+# Technically these jars aren't public, but these locations are referenced by
+# the Indiana hooks.
+d none usr/share/lib 755 root sys
+d none usr/share/lib/java 755 root sys
+#s none usr/share/lib/java/vpanels-panels-idmap.jar=../../vpanels/panel/vpanels-panels-idmap.jar 755 root sys
+
+d none usr/share/vpanels 755 root sys
+d none usr/share/vpanels/panel 755 root sys
+f none usr/share/vpanels/panel/vpanels-panels-idmap.jar 644 root sys
+d none usr/share/vpanels/panels 755 root sys
+f none usr/share/vpanels/panels/idmap.xml 444 root sys
+d none usr/share/vpanels/modules 755 root sys
+f none usr/share/vpanels/modules/idmap.xml 444 root sys
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOLvpin-idmap/prototype_i386	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,27 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+!include prototype_com
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/pkgdefs/OSOLvpin-idmap/prototype_sparc	Wed Jul 08 15:51:56 2009 -0400
@@ -0,0 +1,26 @@
+#
+# 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 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+!include prototype_com
--- a/usr/src/pkgdefs/OSOLvpin/prototype_com	Fri Jun 26 16:06:20 2009 -0400
+++ b/usr/src/pkgdefs/OSOLvpin/prototype_com	Wed Jul 08 15:51:56 2009 -0400
@@ -55,6 +55,7 @@
 s none usr/lib/libjniutil.so=libjniutil.so.1
 f none usr/lib/libscf_jni.so.1 755 root bin
 f none usr/lib/service-browser 755 root bin
+f none usr/lib/libidmap_jni.so.1 755 root bin
 
 d none usr/share 755 root sys
 d none usr/share/applications 755 root other
--- a/usr/src/pkgdefs/publish.ksh	Fri Jun 26 16:06:20 2009 -0400
+++ b/usr/src/pkgdefs/publish.ksh	Wed Jul 08 15:51:56 2009 -0400
@@ -81,3 +81,10 @@
 pkgsend add depend type=require fmri=pkg:/OSOLvpanels@$VERSION
 pkgsend import OSOLvpin-examples
 pkgsend close
+
+eval `pkgsend open pkg:/OSOLvpanels-idmap@$VERSION`
+pkgsend add set name=classification value="Applications/Configuration and Preferences"
+pkgsend add depend type=require fmri=pkg:/OSOLvpanels@$VERSION
+pkgsend import OSOLvpin-idmap
+pkgsend close
+