diff options
author | root <root@unused-16-131.sjc.redhat.com> | 2014-09-23 16:49:08 -0700 |
---|---|---|
committer | Matthew Harmsen <mharmsen@pki.usersys.redhat.com> | 2014-09-30 10:31:13 -0700 |
commit | 0bbe59e0d52b3e473169d8588642bbab7f789dd0 (patch) | |
tree | e8fd1667ca864766a7983737048dc39919a0d9ea | |
parent | 0bce20a04e06bfdf5317735da0f347d57afc5aa4 (diff) | |
download | pki-0bbe59e0d52b3e473169d8588642bbab7f789dd0.tar.gz pki-0bbe59e0d52b3e473169d8588642bbab7f789dd0.tar.xz pki-0bbe59e0d52b3e473169d8588642bbab7f789dd0.zip |
Remove 'pki-migrate' code
- PKI TRAC Ticket #1138 - Remove 'migrate' source code from master branch
175 files changed, 4 insertions, 27999 deletions
diff --git a/.classpath b/.classpath index a699d9f12..8d5aed01b 100644 --- a/.classpath +++ b/.classpath @@ -19,7 +19,6 @@ <classpathentry excluding="**/CMakeLists.txt" kind="src" path="base/ocsp/src"/> <classpathentry excluding="**/CMakeLists.txt" kind="src" path="base/tks/src"/> <classpathentry excluding="**/CMakeLists.txt" kind="src" path="base/tps/src"/> - <classpathentry excluding="**/CMakeLists.txt" kind="src" path="base/migrate/80"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="/usr/share/java/apache-commons-cli.jar"/> <classpathentry kind="lib" path="/usr/share/java/apache-commons-logging.jar"/> diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b04500a4..18faf8d72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,6 @@ elseif (BUILD_PKI_CORE) set(APPLICATION_FLAVOR_PKI_CORE TRUE) elseif (BUILD_PKI_CONSOLE) set(APPLICATION_FLAVOR_PKI_CONSOLE TRUE) -elseif (BUILD_PKI_MIGRATE) - set(APPLICATION_FLAVOR_PKI_MIGRATE TRUE) endif () set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}") @@ -61,10 +59,9 @@ add_custom_target(test) # search for libraries -# required for all PKI components EXCEPT Theme-based components and PKI_MIGRATE +# required for all PKI components EXCEPT Theme-based components if (NOT APPLICATION_FLAVOR_DOGTAG_PKI_THEME AND - NOT APPLICATION_FLAVOR_REDHAT_PKI_THEME AND - NOT APPLICATION_FLAVOR_PKI_MIGRATE) + NOT APPLICATION_FLAVOR_REDHAT_PKI_THEME) find_package(NSPR REQUIRED) find_package(NSS REQUIRED) endif () @@ -72,8 +69,7 @@ endif () # ONLY required for Java-based PKI components if (APPLICATION_FLAVOR_PKI_CORE OR APPLICATION_FLAVOR_PKI_CONSOLE OR - APPLICATION_FLAVOR_DOGTAG_PKI_THEME OR - APPLICATION_FLAVOR_PKI_MIGRATE) + APPLICATION_FLAVOR_DOGTAG_PKI_THEME) find_package(Java REQUIRED) find_package(JNI REQUIRED) endif () @@ -141,8 +137,7 @@ add_custom_target(clean-cmake # check subdirectories if (APPLICATION_FLAVOR_PKI_CORE OR - APPLICATION_FLAVOR_PKI_CONSOLE OR - APPLICATION_FLAVOR_PKI_MIGRATE) + APPLICATION_FLAVOR_PKI_CONSOLE) add_subdirectory(base) endif () diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 4edc0680c..a872959bf 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -44,8 +44,3 @@ if (APPLICATION_FLAVOR_PKI_CONSOLE) add_subdirectory(test) add_subdirectory(console) endif (APPLICATION_FLAVOR_PKI_CONSOLE) - -if (APPLICATION_FLAVOR_PKI_MIGRATE) - add_subdirectory(test) - add_subdirectory(migrate) -endif (APPLICATION_FLAVOR_PKI_MIGRATE) diff --git a/base/migrate/41ToTxt/classes/CMS41LdifParser.class b/base/migrate/41ToTxt/classes/CMS41LdifParser.class Binary files differdeleted file mode 100644 index b787984a2..000000000 --- a/base/migrate/41ToTxt/classes/CMS41LdifParser.class +++ /dev/null diff --git a/base/migrate/41ToTxt/classes/Main.class b/base/migrate/41ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 87854eb4d..000000000 --- a/base/migrate/41ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/41ToTxt/run.bat b/base/migrate/41ToTxt/run.bat deleted file mode 100755 index 35a5fda9f..000000000 --- a/base/migrate/41ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 4.1 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 4.1 ldif text file. -REM -REM This subsequent normalized CMS 4.1 ldif text file -REM can be migrated into CMS 6.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 4.1 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms41 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\base\jre\bin;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\bin\jssjava.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss.jar;%SERVER_ROOT%\bin\cert\jars\jssjdk12.jar;%SERVER_ROOT%\bin\base\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/41ToTxt/run.sh b/base/migrate/41ToTxt/run.sh deleted file mode 100755 index 390195ea1..000000000 --- a/base/migrate/41ToTxt/run.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 4.1 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 4.1 ldif text file. ### -### ### -### This subsequent normalized CMS 4.1 ldif text file ### -### can be migrated into CMS 6.0 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 4.1 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms41 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform (SunOS) -### - -LD_LIBRARY_PATH=${SERVER_ROOT}/bin/base/jre/lib:${SERVER_ROOT}/bin/base/jre/lib/sparc/native_threads -export LD_LIBRARY_PATH - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/bin/jssjava -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss.jar:${SERVER_ROOT}/bin/cert/jars/jssjdk12.jar:${SERVER_ROOT}/bin/base/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/41ToTxt/src/Main.java b/base/migrate/41ToTxt/src/Main.java deleted file mode 100644 index 4a15ec7af..000000000 --- a/base/migrate/41ToTxt/src/Main.java +++ /dev/null @@ -1,464 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -// -// "41ToTxt/src/Main.java" represents the initial CMS "ToTxt" migration file. -// -// Always comment any new code sections with a "CMS 4.1" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import com.netscape.jss.*; // CMS 4.1/4.2/4.2 (SP 2) -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.1/4.2/4.2 (SP 2) - CryptoManager.initialize("./secmod.db", "./key3.db", "./cert7.db"); - // load JSS provider in CMS 4.1/4.2/4.2 (SP 2) - java.security.Security.removeProvider("Netscape version 1.4"); - java.security.Security.removeProvider("SunRsaSign version 1.0"); -// java.security.Security.insertProviderAt( -// new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS41LdifParser parser = null; - if (args.length == 1) { - parser = new CMS41LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS41LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS41LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.1/4.2/4.2 (SP 2)/4.5 use "requestattributes" - private static final String REQUEST_ATTRIBUTES = - "requestattributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS41LdifParser(String filename) - { - mFilename = filename; - } - - public CMS41LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.certsrv.base.ArgBlock) { - com.netscape.certsrv.base.ArgBlock o = - (com.netscape.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.certsrv.dbs.keydb.KeyRecord) { - com.netscape.certsrv.dbs.keydb.KeyRecord o = - (com.netscape.certsrv.dbs.keydb.KeyRecord)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/41ToTxt/src/compile.bat b/base/migrate/41ToTxt/src/compile.bat deleted file mode 100755 index fd92f3fb7..000000000 --- a/base/migrate/41ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "41ToTxt/classes/Main.class" and -REM "41ToTxt/classes/CMS41LdifParser.class" which are -REM used to create a normalized CMS 4.1 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 41ToTxt -REM - -REM SET SERVER_ROOT=C:\cms41 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 4.1 NOTE: "WINNT" - 1.1.6 -REM - -REM SET JDK_VERSION=CMS_4.1 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 41ToTxt - create "CMS41LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\lib\classes.zip;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss.jar;%SERVER_ROOT%\bin\cert\jars\jssjdk12.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/41ToTxt/src/compile.sh b/base/migrate/41ToTxt/src/compile.sh deleted file mode 100755 index 968190ff2..000000000 --- a/base/migrate/41ToTxt/src/compile.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "41ToTxt/classes/Main.class" and ### -### "41ToTxt/classes/CMS41LdifParser.class" which are ### -### used to create a normalized CMS 4.1 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 41ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms41 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 4.1 NOTE: "SunOS" - 1.1.6 -### - -#JDK_VERSION=CMS_4.1 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform (SunOS) -### - -LD_LIBRARY_PATH=${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads -export LD_LIBRARY_PATH - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 41ToTxt - create "CMS41LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/lib/classes.zip:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss.jar:${SERVER_ROOT}/bin/cert/jars/jssjdk12.jar Main.java - diff --git a/base/migrate/42SP2ToTxt/classes/CMS42SP2LdifParser.class b/base/migrate/42SP2ToTxt/classes/CMS42SP2LdifParser.class Binary files differdeleted file mode 100644 index dbf8a1170..000000000 --- a/base/migrate/42SP2ToTxt/classes/CMS42SP2LdifParser.class +++ /dev/null diff --git a/base/migrate/42SP2ToTxt/classes/Main.class b/base/migrate/42SP2ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index d881f3560..000000000 --- a/base/migrate/42SP2ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/42SP2ToTxt/run.bat b/base/migrate/42SP2ToTxt/run.bat deleted file mode 100755 index ec2a5d6ff..000000000 --- a/base/migrate/42SP2ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 4.2 (SP 2) ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 4.2 (SP 2) ldif text file. -REM -REM This subsequent normalized CMS 4.2 (SP 2) ldif text file -REM can be migrated into CMS 6.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 4.2 (SP 2) ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms43 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.2 (SP 2)" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\hotspot;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss21.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/42SP2ToTxt/run.sh b/base/migrate/42SP2ToTxt/run.sh deleted file mode 100755 index 79a203700..000000000 --- a/base/migrate/42SP2ToTxt/run.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 4.2 (SP 2) ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 4.2 (SP 2) ldif text file. ### -### ### -### This subsequent normalized CMS 4.2 (SP 2) ldif text file ### -### can be migrated into CMS 6.0 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 4.2 (SP 2) ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms43 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.2 (SP 2)" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "AIX" ] ; then - LIBPATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/aix/native_threads - export LIBPATH -elif [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -elif [ ${OS_NAME} = "OSF1" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/alpha/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss21.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/42SP2ToTxt/src/Main.java b/base/migrate/42SP2ToTxt/src/Main.java deleted file mode 100644 index b76b17b71..000000000 --- a/base/migrate/42SP2ToTxt/src/Main.java +++ /dev/null @@ -1,467 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "42SP2ToTxt/src/Main.java" is based upon a copy "42ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 4.2 (SP 2)" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 42ToTxt/src/Main.java 42SP2ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import com.netscape.jss.*; // CMS 4.1/4.2/4.2 (SP 2) -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.1/4.2/4.2 (SP 2) - CryptoManager.initialize("./secmod.db", "./key3.db", "./cert7.db"); - // load JSS provider in CMS 4.1/4.2/4.2 (SP 2) - java.security.Security.removeProvider("Netscape version 1.4"); - java.security.Security.removeProvider("SunRsaSign version 1.0"); -// java.security.Security.insertProviderAt( -// new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS42SP2LdifParser parser = null; - if (args.length == 1) { - parser = new CMS42SP2LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS42SP2LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS42SP2LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.1/4.2/4.2 (SP 2)/4.5 use "requestattributes" - private static final String REQUEST_ATTRIBUTES = - "requestattributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS42SP2LdifParser(String filename) - { - mFilename = filename; - } - - public CMS42SP2LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.certsrv.base.ArgBlock) { - com.netscape.certsrv.base.ArgBlock o = - (com.netscape.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.certsrv.dbs.keydb.KeyRecord) { - com.netscape.certsrv.dbs.keydb.KeyRecord o = - (com.netscape.certsrv.dbs.keydb.KeyRecord)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/42SP2ToTxt/src/compile.bat b/base/migrate/42SP2ToTxt/src/compile.bat deleted file mode 100755 index 5b6c11566..000000000 --- a/base/migrate/42SP2ToTxt/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "42SP2ToTxt/classes/Main.class" and -REM "42SP2ToTxt/classes/CMS42SP2LdifParser.class" which are -REM used to create a normalized CMS 4.2 (SP 2) ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 42SP2ToTxt -REM - -REM SET SERVER_ROOT=C:\cms43 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 4.2 (SP 2) NOTE: "WINNT" - 1.3.0 -REM -REM CMS 4.2 (SP 2) CONSOLE NOTE: "WINNT" - 1.1.7A -REM - -REM SET JDK_VERSION=CMS_4.3 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.2 (SP 2)" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 42SP2ToTxt - create "CMS42SP2LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss21.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/42SP2ToTxt/src/compile.sh b/base/migrate/42SP2ToTxt/src/compile.sh deleted file mode 100755 index 26aa6140b..000000000 --- a/base/migrate/42SP2ToTxt/src/compile.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "42SP2ToTxt/classes/Main.class" and ### -### "42SP2ToTxt/classes/CMS42SP2LdifParser.class" which are ### -### used to create a normalized CMS 4.2 (SP 2) ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 42SP2ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms42sp2 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "AIX", "HP-UX", "Linux", "OSF1", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 4.2 (SP 2) NOTE: "AIX" - 1.3.0 -### "HP-UX" - 1.3.0.00 -### "Linux" - 1.3.0 -### "OSF1" - 1.3.0-1 -### "SunOS" - 1.3.0 -### -### CMS 4.2 (SP 2) CONSOLE NOTE: "AIX" - 1.1.6_10 -### "HP-UX" - 1.1.6 -### "Linux" - 1.1.7 -### "OSF1" - 1.1.6 -### "SunOS" - 1.1.6 -### - -#JDK_VERSION=CMS_4.3 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.2 (SP 2)" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "AIX" ] ; then - LIBPATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/aix/native_threads - export LIBPATH -elif [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -elif [ ${OS_NAME} = "OSF1" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/alpha/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 42SP2ToTxt - create "CMS42SP2LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss21.jar Main.java - diff --git a/base/migrate/42ToTxt/classes/CMS42LdifParser.class b/base/migrate/42ToTxt/classes/CMS42LdifParser.class Binary files differdeleted file mode 100644 index 81c20523c..000000000 --- a/base/migrate/42ToTxt/classes/CMS42LdifParser.class +++ /dev/null diff --git a/base/migrate/42ToTxt/classes/Main.class b/base/migrate/42ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 7a75e96c0..000000000 --- a/base/migrate/42ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/42ToTxt/run.bat b/base/migrate/42ToTxt/run.bat deleted file mode 100755 index 43300869c..000000000 --- a/base/migrate/42ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 4.2 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 4.2 ldif text file. -REM -REM This subsequent normalized CMS 4.2 ldif text file -REM can be migrated into CMS 6.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 4.2 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms42 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\jre.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss.jar;%SERVER_ROOT%\bin\cert\jars\jssjdk12.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/42ToTxt/run.sh b/base/migrate/42ToTxt/run.sh deleted file mode 100755 index 3172159f1..000000000 --- a/base/migrate/42ToTxt/run.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 4.2 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 4.2 ldif text file. ### -### ### -### This subsequent normalized CMS 4.2 ldif text file ### -### can be migrated into CMS 6.0 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 4.2 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms42 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.2" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "AIX" ] ; then - LIBPATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/aix/native_threads - export LIBPATH -elif [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -elif [ ${OS_NAME} = "OSF1" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/alpha/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/jre/bin/jre -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss.jar:${SERVER_ROOT}/bin/cert/jars/jssjdk12.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/42ToTxt/src/Main.java b/base/migrate/42ToTxt/src/Main.java deleted file mode 100644 index 76adfb16e..000000000 --- a/base/migrate/42ToTxt/src/Main.java +++ /dev/null @@ -1,467 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "42ToTxt/src/Main.java" is based upon a copy "41ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 4.2" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 41ToTxt/src/Main.java 42ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import com.netscape.jss.*; // CMS 4.1/4.2/4.2 (SP 2) -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.1/4.2/4.2 (SP 2) - CryptoManager.initialize("./secmod.db", "./key3.db", "./cert7.db"); - // load JSS provider in CMS 4.1/4.2/4.2 (SP 2) - java.security.Security.removeProvider("Netscape version 1.4"); - java.security.Security.removeProvider("SunRsaSign version 1.0"); -// java.security.Security.insertProviderAt( -// new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS42LdifParser parser = null; - if (args.length == 1) { - parser = new CMS42LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS42LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS42LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.1/4.2/4.2 (SP 2)/4.5 use "requestattributes" - private static final String REQUEST_ATTRIBUTES = - "requestattributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS42LdifParser(String filename) - { - mFilename = filename; - } - - public CMS42LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.certsrv.base.ArgBlock) { - com.netscape.certsrv.base.ArgBlock o = - (com.netscape.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.certsrv.dbs.keydb.KeyRecord) { - com.netscape.certsrv.dbs.keydb.KeyRecord o = - (com.netscape.certsrv.dbs.keydb.KeyRecord)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/42ToTxt/src/compile.bat b/base/migrate/42ToTxt/src/compile.bat deleted file mode 100755 index 20ca0ebb5..000000000 --- a/base/migrate/42ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "42ToTxt/classes/Main.class" and -REM "42ToTxt/classes/CMS42LdifParser.class" which are -REM used to create a normalized CMS 4.2 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 42ToTxt -REM - -REM SET SERVER_ROOT=C:\cms42 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 4.2 NOTE: "WINNT" - 1.1.7A -REM - -REM SET JDK_VERSION=CMS_4.2 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 42ToTxt - create "CMS42LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\lib\classes.zip;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss.jar;%SERVER_ROOT%\bin\cert\jars\jssjdk12.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/42ToTxt/src/compile.sh b/base/migrate/42ToTxt/src/compile.sh deleted file mode 100755 index e8acf71bf..000000000 --- a/base/migrate/42ToTxt/src/compile.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "42ToTxt/classes/Main.class" and ### -### "42ToTxt/classes/CMS42LdifParser.class" which are ### -### used to create a normalized CMS 4.2 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 42ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms42 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "AIX", "HP-UX", "Linux", "OSF1", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 4.2 NOTE: "AIX" - 1.1.6_10 -### "HP-UX" - 1.1.6 -### "Linux" - 1.1.7 -### "OSF1" - 1.1.6 -### "SunOS" - 1.1.6 -### - -#JDK_VERSION=CMS_4.2 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.2" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "AIX" ] ; then - LIBPATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/aix/native_threads - export LIBPATH -elif [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -elif [ ${OS_NAME} = "OSF1" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/alpha/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 42ToTxt - create "CMS42LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/lib/classes.zip:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss.jar:${SERVER_ROOT}/bin/cert/jars/jssjdk12.jar Main.java - diff --git a/base/migrate/45ToTxt/classes/CMS45LdifParser.class b/base/migrate/45ToTxt/classes/CMS45LdifParser.class Binary files differdeleted file mode 100644 index 75d4ab47c..000000000 --- a/base/migrate/45ToTxt/classes/CMS45LdifParser.class +++ /dev/null diff --git a/base/migrate/45ToTxt/classes/Main.class b/base/migrate/45ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index a1f3e91c2..000000000 --- a/base/migrate/45ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/45ToTxt/run.bat b/base/migrate/45ToTxt/run.bat deleted file mode 100755 index 8dfb4e77c..000000000 --- a/base/migrate/45ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 4.5 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 4.5 ldif text file. -REM -REM This subsequent normalized CMS 4.5 ldif text file -REM can be migrated into CMS 6.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 4.5 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms45 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.5" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\hotspot;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/45ToTxt/run.sh b/base/migrate/45ToTxt/run.sh deleted file mode 100755 index f19a550d5..000000000 --- a/base/migrate/45ToTxt/run.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 4.5 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 4.5 ldif text file. ### -### ### -### This subsequent normalized CMS 4.5 ldif text file ### -### can be migrated into CMS 6.0 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 4.5 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms45 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.5" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/45ToTxt/src/Main.java b/base/migrate/45ToTxt/src/Main.java deleted file mode 100644 index 13125fb43..000000000 --- a/base/migrate/45ToTxt/src/Main.java +++ /dev/null @@ -1,469 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "45ToTxt/src/Main.java" is based upon a copy "42SP2ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 4.5" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 42SP2ToTxt/src/Main.java 45ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS45LdifParser parser = null; - if (args.length == 1) { - parser = new CMS45LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS45LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS45LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.1/4.2/4.2 (SP 2)/4.5 use "requestattributes" - private static final String REQUEST_ATTRIBUTES = - "requestattributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS45LdifParser(String filename) - { - mFilename = filename; - } - - public CMS45LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.certsrv.base.ArgBlock) { - com.netscape.certsrv.base.ArgBlock o = - (com.netscape.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.certsrv.dbs.keydb.KeyRecord) { - com.netscape.certsrv.dbs.keydb.KeyRecord o = - (com.netscape.certsrv.dbs.keydb.KeyRecord)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/45ToTxt/src/compile.bat b/base/migrate/45ToTxt/src/compile.bat deleted file mode 100755 index 11abbf103..000000000 --- a/base/migrate/45ToTxt/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "45ToTxt/classes/Main.class" and -REM "45ToTxt/classes/CMS45LdifParser.class" which are -REM used to create a normalized CMS 4.5 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 45ToTxt -REM - -REM SET SERVER_ROOT=C:\cms45 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 4.5 NOTE: "WINNT" - 1.3.0 -REM -REM CMS 4.5 CONSOLE NOTE: "WINNT" - 1.1.7A -REM - -REM SET JDK_VERSION=CMS_4.5 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.5" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 45ToTxt - create "CMS45LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/45ToTxt/src/compile.sh b/base/migrate/45ToTxt/src/compile.sh deleted file mode 100755 index a08eea1b7..000000000 --- a/base/migrate/45ToTxt/src/compile.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "45ToTxt/classes/Main.class" and ### -### "45ToTxt/classes/CMS45LdifParser.class" which are ### -### used to create a normalized CMS 4.5 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 45ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms45 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "Linux" or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 4.5 NOTE: "Linux" - 1.3.0 -### "SunOS" - 1.3.0 -### -### CMS 4.5 CONSOLE NOTE: "Linux" - 1.1.7 -### "SunOS" - 1.1.6 -### - -#JDK_VERSION=CMS_4.5 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.5" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 45ToTxt - create "CMS45LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/47ToTxt/classes/CMS47LdifParser.class b/base/migrate/47ToTxt/classes/CMS47LdifParser.class Binary files differdeleted file mode 100644 index 79d1bc12d..000000000 --- a/base/migrate/47ToTxt/classes/CMS47LdifParser.class +++ /dev/null diff --git a/base/migrate/47ToTxt/classes/Main.class b/base/migrate/47ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 7ee99ee96..000000000 --- a/base/migrate/47ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/47ToTxt/run.bat b/base/migrate/47ToTxt/run.bat deleted file mode 100755 index e658ab410..000000000 --- a/base/migrate/47ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 4.7 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 4.7 ldif text file. -REM -REM This subsequent normalized CMS 4.7 ldif text file -REM can be migrated into CMS 6.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 4.7 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms47 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.7" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\hotspot;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/47ToTxt/run.sh b/base/migrate/47ToTxt/run.sh deleted file mode 100755 index 35a41bc90..000000000 --- a/base/migrate/47ToTxt/run.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 4.7 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 4.7 ldif text file. ### -### ### -### This subsequent normalized CMS 4.7 ldif text file ### -### can be migrated into CMS 6.0 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 4.7 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms47 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.7" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "AIX" ] ; then - LIBPATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/aix/native_threads - export LIBPATH -elif [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -elif [ ${OS_NAME} = "OSF1" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/alpha/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/47ToTxt/src/Main.java b/base/migrate/47ToTxt/src/Main.java deleted file mode 100644 index ebed784fb..000000000 --- a/base/migrate/47ToTxt/src/Main.java +++ /dev/null @@ -1,578 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "47ToTxt/src/Main.java" is based upon a copy "42SP2ToTxt/src/Main.java" -// with additional material provided from "45ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 4.7" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following commands: -// -// diff 42SP2ToTxt/src/Main.java 47ToTxt/src/Main.java -// diff 45ToTxt/src/Main.java 47ToTxt/src/Main.java -// -// NOTE: The "47ToTxt/src/Main.java" file will differ substantially -// from the "42SP2ToTxt/src/Main.java" and "45ToTxt/src/Main.java" -// files upon which it was based due to the changes that were -// necessary to change "iplanet" to "netscape". -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import iplanet.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new iplanet.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS47LdifParser parser = null; - if (args.length == 1) { - parser = new CMS47LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS47LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS47LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS47LdifParser(String filename) - { - mFilename = filename; - } - - public CMS47LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - String data_type = null; - String translation = null; - if (obj instanceof String) { - data_type = obj.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - System.out.println(" " + - key + ":" + translation + "=" + - obj); - } else if (obj instanceof iplanet.security.x509.CertificateX509Key) { - iplanet.security.x509.CertificateX509Key o = - (iplanet.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.CertificateX509Key" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.CertificateSubjectName) { - iplanet.security.x509.CertificateSubjectName o = - (iplanet.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.CertificateSubjectName" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.CertificateExtensions) { - iplanet.security.x509.CertificateExtensions o = - (iplanet.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.CertificateExtensions" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.X509CertInfo) { - iplanet.security.x509.X509CertInfo o = - (iplanet.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.X509CertInfo" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.X509CertImpl) { - iplanet.security.x509.X509CertImpl o = - (iplanet.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.X509CertImpl" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.CertificateChain) { - iplanet.security.x509.CertificateChain o = - (iplanet.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.CertificateChain" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.X509CertImpl[]) { - iplanet.security.x509.X509CertImpl o[] = - (iplanet.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.X509CertImpl" +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof iplanet.security.x509.X509CertInfo[]) { - iplanet.security.x509.X509CertInfo o[] = - (iplanet.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.X509CertInfo" + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof iplanet.security.x509.RevokedCertImpl[]) { - iplanet.security.x509.RevokedCertImpl o[] = - (iplanet.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "netscape.security.x509.RevokedCertImpl" +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - data_type = o[i].getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + translation +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.iplanet.certsrv.base.ArgBlock) { - com.iplanet.certsrv.base.ArgBlock o = - (com.iplanet.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + "com.netscape.certsrv.base.ArgBlock" + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.iplanet.certsrv.dbs.keydb.KeyRecord) { - com.iplanet.certsrv.dbs.keydb.KeyRecord o = - (com.iplanet.certsrv.dbs.keydb.KeyRecord)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - data_type = ob.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.dbs.keydb.KeyRecord" + "=" + - k + ":" + translation + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - data_type = ob.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "com.netscape.certsrv.dbs.keydb.KeyRecord" + "=" + - k + ":" + translation + "=" + encoder.encode((byte[])ob)); - - } else { - data_type = ob.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.dbs.keydb.KeyRecord" + "=" + - k + ":" + translation + "=" + ob); - } - } - } - } else if (obj instanceof com.iplanet.certsrv.kra.ProofOfArchival) { - com.iplanet.certsrv.kra.ProofOfArchival o = - (com.iplanet.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + "com.netscape.certsrv.kra.ProofOfArchival" + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.iplanet.certsrv.request.AgentApprovals) { - com.iplanet.certsrv.request.AgentApprovals o = - (com.iplanet.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.iplanet.certsrv.request.AgentApproval approval = (com.iplanet.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - "com.netscape.certsrv.request.AgentApprovals" + ":" + "com.netscape.certsrv.request.AgentApprovals" + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.iplanet.certsrv.authentication.AuthToken) { - com.iplanet.certsrv.authentication.AuthToken o = - (com.iplanet.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - data_type = ob.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":" + translation + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - data_type = o.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + translation + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - data_type = ob.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":" + translation + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof iplanet.security.x509.CertificateAlgorithmId) { - iplanet.security.x509.CertificateAlgorithmId o = - (iplanet.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof iplanet.security.x509.CertificateValidity) { - iplanet.security.x509.CertificateValidity o = - (iplanet.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - data_type = o.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + translation + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - data_type = obj.getClass().getName(); - if( data_type.startsWith( "iplanet" ) ) { - translation = "netscape" - + data_type.substring( 7 ); - } else if( data_type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + data_type.substring( 11 ); - } else { - translation = data_type; - } - System.out.println(" " + - key + ":" + translation + "=" + - obj); - } - } -} - diff --git a/base/migrate/47ToTxt/src/compile.bat b/base/migrate/47ToTxt/src/compile.bat deleted file mode 100755 index 553beca5c..000000000 --- a/base/migrate/47ToTxt/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "47ToTxt/classes/Main.class" and -REM "47ToTxt/classes/CMS47LdifParser.class" which are -REM used to create a normalized CMS 4.7 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 47ToTxt -REM - -REM SET SERVER_ROOT=C:\cms47 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 4.7 NOTE: "WINNT" - 1.3.0 -REM -REM CMS 4.7 CONSOLE NOTE: "WINNT" - 1.1.7A -REM - -REM SET JDK_VERSION=CMS_4.7 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.7" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 47ToTxt - create "CMS47LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/47ToTxt/src/compile.sh b/base/migrate/47ToTxt/src/compile.sh deleted file mode 100755 index 8d91b4491..000000000 --- a/base/migrate/47ToTxt/src/compile.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "47ToTxt/classes/Main.class" and ### -### "47ToTxt/classes/CMS47LdifParser.class" which are ### -### used to create a normalized CMS 4.7 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 47ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms47 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "AIX", "HP-UX", "Linux", "OSF1", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 4.7 NOTE: "AIX" - 1.3.0 -### "HP-UX" - 1.3.0.00 -### "Linux" - 1.3.0 -### "OSF1" - 1.3.0-1 -### "SunOS" - 1.3.0 -### -### CMS 4.7 CONSOLE NOTE: "AIX" - 1.1.6_10 -### "HP-UX" - 1.1.6 -### "Linux" - 1.1.7 -### "OSF1" - 1.1.6 -### "SunOS" - 1.1.6 -### - -#JDK_VERSION=CMS_4.7 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.7" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "AIX" ] ; then - LIBPATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/aix/native_threads - export LIBPATH -elif [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -elif [ ${OS_NAME} = "OSF1" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/alpha/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 47ToTxt - create "CMS47LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/60ToTxt/classes/CMS60LdifParser.class b/base/migrate/60ToTxt/classes/CMS60LdifParser.class Binary files differdeleted file mode 100644 index f3ff43045..000000000 --- a/base/migrate/60ToTxt/classes/CMS60LdifParser.class +++ /dev/null diff --git a/base/migrate/60ToTxt/classes/Main.class b/base/migrate/60ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 6d0d3dcd3..000000000 --- a/base/migrate/60ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/60ToTxt/run.bat b/base/migrate/60ToTxt/run.bat deleted file mode 100755 index cc24fd214..000000000 --- a/base/migrate/60ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 6.0/6.01 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 6.0/6.01 ldif text file. -REM -REM This subsequent normalized CMS 6.0/6.01 ldif text file -REM can be migrated into CMS 6.0/6.01 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 6.0/6.01 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms601 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\hotspot;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/60ToTxt/run.sh b/base/migrate/60ToTxt/run.sh deleted file mode 100755 index d41d65294..000000000 --- a/base/migrate/60ToTxt/run.sh +++ /dev/null @@ -1,199 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 6.0/6.01 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 6.0/6.01 ldif text file. ### -### ### -### This subsequent normalized CMS 6.0/6.01 ldif text file ### -### can be migrated into CMS 6.0/6.01 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 6.0/6.01 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms601 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/60ToTxt/src/Main.java b/base/migrate/60ToTxt/src/Main.java deleted file mode 100644 index 3eb3c8150..000000000 --- a/base/migrate/60ToTxt/src/Main.java +++ /dev/null @@ -1,475 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "60ToTxt/src/Main.java" is based upon a copy "45ToTxt/src/Main.java" -// with additional material provided from "47ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 6.0" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following commands: -// -// diff 45ToTxt/src/Main.java 60ToTxt/src/Main.java -// diff 47ToTxt/src/Main.java 60ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS60LdifParser parser = null; - if (args.length == 1) { - parser = new CMS60LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS60LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS60LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS60LdifParser(String filename) - { - mFilename = filename; - } - - public CMS60LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.certsrv.base.ArgBlock) { - com.netscape.certsrv.base.ArgBlock o = - (com.netscape.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.cmscore.kra.ProofOfArchival) { - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.cmscore.kra.ProofOfArchival o = - (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/60ToTxt/src/compile.bat b/base/migrate/60ToTxt/src/compile.bat deleted file mode 100755 index 8c8b122c0..000000000 --- a/base/migrate/60ToTxt/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "60ToTxt/classes/Main.class" and -REM "60ToTxt/classes/CMS60LdifParser.class" which are -REM used to create a normalized CMS 6.0/6.01 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 60ToTxt -REM - -REM SET SERVER_ROOT=C:\cms601 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.0 NOTE: "WINNT" - 1.3.1_02 -REM -REM CMS 6.01 NOTE: "WINNT" - 1.3.1_02 -REM - -REM SET JDK_VERSION=CMS_6.01 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 60ToTxt - create "CMS60LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/60ToTxt/src/compile.sh b/base/migrate/60ToTxt/src/compile.sh deleted file mode 100755 index 5641688bb..000000000 --- a/base/migrate/60ToTxt/src/compile.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "60ToTxt/classes/Main.class" and ### -### "60ToTxt/classes/CMS60LdifParser.class" which are ### -### used to create a normalized CMS 6.0/6.01 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 60ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms601 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.0 NOTE: "HP-UX" - 1.3.1.02 -### "Linux" - 1.3.1_02 -### "SunOS" - 1.3.1_02 -### -### CMS 6.01 NOTE: "HP-UX" - 1.3.1.02 -### "Linux" - 1.4.0 -### "SunOS" - 1.3.1_02 -### - -#JDK_VERSION=CMS_6.01 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 60ToTxt - create "CMS60LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/61ToTxt/classes/CMS61LdifParser.class b/base/migrate/61ToTxt/classes/CMS61LdifParser.class Binary files differdeleted file mode 100644 index 4c08a38aa..000000000 --- a/base/migrate/61ToTxt/classes/CMS61LdifParser.class +++ /dev/null diff --git a/base/migrate/61ToTxt/classes/Main.class b/base/migrate/61ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 8f141215d..000000000 --- a/base/migrate/61ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/61ToTxt/run.bat b/base/migrate/61ToTxt/run.bat deleted file mode 100755 index 2386ab20b..000000000 --- a/base/migrate/61ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 6.1 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 6.1 ldif text file. -REM -REM This subsequent normalized CMS 6.1 ldif text file -REM can be migrated into CMS 6.1 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 6.1 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms61 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/61ToTxt/run.sh b/base/migrate/61ToTxt/run.sh deleted file mode 100755 index 9fa8ffe12..000000000 --- a/base/migrate/61ToTxt/run.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 6.1 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 6.1 ldif text file. ### -### ### -### This subsequent normalized CMS 6.1 ldif text file ### -### can be migrated into CMS 6.1 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 6.1 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms61 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/61ToTxt/src/Main.java b/base/migrate/61ToTxt/src/Main.java deleted file mode 100644 index b99c35eb4..000000000 --- a/base/migrate/61ToTxt/src/Main.java +++ /dev/null @@ -1,483 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "61ToTxt/src/Main.java" is based upon a copy "60ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 6.1" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 60ToTxt/src/Main.java 61ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS61LdifParser parser = null; - if (args.length == 1) { - parser = new CMS61LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS61LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS61LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS61LdifParser(String filename) - { - mFilename = filename; - } - - public CMS61LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.cmscore.kra.ProofOfArchival) { - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.cmscore.kra.ProofOfArchival o = - (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/61ToTxt/src/compile.bat b/base/migrate/61ToTxt/src/compile.bat deleted file mode 100755 index 48bb90018..000000000 --- a/base/migrate/61ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "61ToTxt/classes/Main.class" and -REM "61ToTxt/classes/CMS61LdifParser.class" which are -REM used to create a normalized CMS 6.1 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 61ToTxt -REM - -REM SET SERVER_ROOT=C:\cms61 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.1 NOTE: "WINNT" - 1.4.0 -REM - -REM SET JDK_VERSION=CMS_6.1 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 61ToTxt - create "CMS61LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/61ToTxt/src/compile.sh b/base/migrate/61ToTxt/src/compile.sh deleted file mode 100755 index b1f8c8505..000000000 --- a/base/migrate/61ToTxt/src/compile.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "61ToTxt/classes/Main.class" and ### -### "61ToTxt/classes/CMS61LdifParser.class" which are ### -### used to create a normalized CMS 6.1 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 61ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms61 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.1 NOTE: "HP-UX" - 1.3.1.02 -### "Linux" - 1.3.1_02 -### "SunOS" - 1.3.1_02 -### - -#JDK_VERSION=CMS_6.1 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 61ToTxt - create "CMS61LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/62ToTxt/classes/CMS62LdifParser.class b/base/migrate/62ToTxt/classes/CMS62LdifParser.class Binary files differdeleted file mode 100644 index 8c413efe2..000000000 --- a/base/migrate/62ToTxt/classes/CMS62LdifParser.class +++ /dev/null diff --git a/base/migrate/62ToTxt/classes/Main.class b/base/migrate/62ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index a3b28db52..000000000 --- a/base/migrate/62ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/62ToTxt/run.bat b/base/migrate/62ToTxt/run.bat deleted file mode 100755 index f182fd715..000000000 --- a/base/migrate/62ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 6.2 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 6.2 ldif text file. -REM -REM This subsequent normalized CMS 6.2 ldif text file -REM can be migrated into CMS 6.2 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 6.2 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms62 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/62ToTxt/run.sh b/base/migrate/62ToTxt/run.sh deleted file mode 100755 index a192df1ce..000000000 --- a/base/migrate/62ToTxt/run.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 6.2 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 6.2 ldif text file. ### -### ### -### This subsequent normalized CMS 6.2 ldif text file ### -### can be migrated into CMS 6.2 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 6.2 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms62 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.2" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/62ToTxt/src/Main.java b/base/migrate/62ToTxt/src/Main.java deleted file mode 100644 index 72b9c3838..000000000 --- a/base/migrate/62ToTxt/src/Main.java +++ /dev/null @@ -1,483 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "62ToTxt/src/Main.java" is based upon a copy "61ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 6.2" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 61ToTxt/src/Main.java 62ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS62LdifParser parser = null; - if (args.length == 1) { - parser = new CMS62LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS62LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS62LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS62LdifParser(String filename) - { - mFilename = filename; - } - - public CMS62LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.cmscore.kra.ProofOfArchival) { - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.cmscore.kra.ProofOfArchival o = - (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/62ToTxt/src/compile.bat b/base/migrate/62ToTxt/src/compile.bat deleted file mode 100755 index c6bfff97e..000000000 --- a/base/migrate/62ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "62ToTxt/classes/Main.class" and -REM "62ToTxt/classes/CMS62LdifParser.class" which are -REM used to create a normalized CMS 6.2 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 62ToTxt -REM - -REM SET SERVER_ROOT=C:\cms62 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.2 NOTE: "WINNT" - 1.4.0 -REM - -REM SET JDK_VERSION=CMS_6.2 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 62ToTxt - create "CMS62LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/62ToTxt/src/compile.sh b/base/migrate/62ToTxt/src/compile.sh deleted file mode 100755 index 163d5e440..000000000 --- a/base/migrate/62ToTxt/src/compile.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "62ToTxt/classes/Main.class" and ### -### "62ToTxt/classes/CMS62LdifParser.class" which are ### -### used to create a normalized CMS 6.2 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 62ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms62 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.2 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.0 -### "SunOS" - 1.4.0 -### - -#JDK_VERSION=CMS_6.2 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.2" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 62ToTxt - create "CMS62LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/63ToTxt/classes/CMS63LdifParser.class b/base/migrate/63ToTxt/classes/CMS63LdifParser.class Binary files differdeleted file mode 100644 index 39dde5f50..000000000 --- a/base/migrate/63ToTxt/classes/CMS63LdifParser.class +++ /dev/null diff --git a/base/migrate/63ToTxt/classes/Main.class b/base/migrate/63ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index d8885bc11..000000000 --- a/base/migrate/63ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/63ToTxt/run.bat b/base/migrate/63ToTxt/run.bat deleted file mode 100755 index 34c9422c8..000000000 --- a/base/migrate/63ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 6.3 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 6.3 ldif text file. -REM -REM This subsequent normalized CMS 6.3 ldif text file -REM can be migrated into CMS 6.3 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 6.3 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms63 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.3" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/63ToTxt/run.sh b/base/migrate/63ToTxt/run.sh deleted file mode 100755 index d4aa5d5a2..000000000 --- a/base/migrate/63ToTxt/run.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 6.3 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 6.3 ldif text file. ### -### ### -### This subsequent normalized CMS 6.3 ldif text file ### -### can be migrated into CMS 6.3 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 6.3 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms63 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.3" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/63ToTxt/src/Main.java b/base/migrate/63ToTxt/src/Main.java deleted file mode 100644 index efd3337d0..000000000 --- a/base/migrate/63ToTxt/src/Main.java +++ /dev/null @@ -1,483 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "63ToTxt/src/Main.java" is based upon a copy "62ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 6.3" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 62ToTxt/src/Main.java 63ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS63LdifParser parser = null; - if (args.length == 1) { - parser = new CMS63LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS63LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS63LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS63LdifParser(String filename) - { - mFilename = filename; - } - - public CMS63LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.cmscore.kra.ProofOfArchival) { - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.cmscore.kra.ProofOfArchival o = - (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/63ToTxt/src/compile.bat b/base/migrate/63ToTxt/src/compile.bat deleted file mode 100755 index f587dd7e8..000000000 --- a/base/migrate/63ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "63ToTxt/classes/Main.class" and -REM "63ToTxt/classes/CMS63LdifParser.class" which are -REM used to create a normalized CMS 6.3 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 63ToTxt -REM - -REM SET SERVER_ROOT=C:\cms63 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.3 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CMS_6.3 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.3" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 63ToTxt - create "CMS63LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/63ToTxt/src/compile.sh b/base/migrate/63ToTxt/src/compile.sh deleted file mode 100755 index 57b9c7718..000000000 --- a/base/migrate/63ToTxt/src/compile.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "63ToTxt/classes/Main.class" and ### -### "63ToTxt/classes/CMS63LdifParser.class" which are ### -### used to create a normalized CMS 6.3 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 63ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms63 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.3 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.2 -### "SunOS" - 1.4.2 -### - -#JDK_VERSION=CMS_6.3 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.3" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 63ToTxt - create "CMS63LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/70ToTxt/classes/CMS70LdifParser.class b/base/migrate/70ToTxt/classes/CMS70LdifParser.class Binary files differdeleted file mode 100644 index e6900f5aa..000000000 --- a/base/migrate/70ToTxt/classes/CMS70LdifParser.class +++ /dev/null diff --git a/base/migrate/70ToTxt/classes/Main.class b/base/migrate/70ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 0743af44a..000000000 --- a/base/migrate/70ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/70ToTxt/run.bat b/base/migrate/70ToTxt/run.bat deleted file mode 100755 index 3adeee6f9..000000000 --- a/base/migrate/70ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 7.0 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 7.0 ldif text file. -REM -REM This subsequent normalized CMS 7.0 ldif text file -REM can be migrated into CMS 7.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 7.0 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms70 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 7.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/70ToTxt/run.sh b/base/migrate/70ToTxt/run.sh deleted file mode 100755 index 294bb63c7..000000000 --- a/base/migrate/70ToTxt/run.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 7.0/7.01 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 7.0/7.01 ldif text file. ### -### ### -### This subsequent normalized CMS 7.0/7.01 ldif text file ### -### can be migrated into CMS 7.0/7.01 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 7.0/7.01 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms701 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 7.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/70ToTxt/src/Main.java b/base/migrate/70ToTxt/src/Main.java deleted file mode 100644 index 8c5d3811e..000000000 --- a/base/migrate/70ToTxt/src/Main.java +++ /dev/null @@ -1,483 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "70ToTxt/src/Main.java" is based upon a copy "62ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.0" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 62ToTxt/src/Main.java 70ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS70LdifParser parser = null; - if (args.length == 1) { - parser = new CMS70LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS70LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS70LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS70LdifParser(String filename) - { - mFilename = filename; - } - - public CMS70LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.cmscore.kra.ProofOfArchival) { - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.cmscore.kra.ProofOfArchival o = - (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/70ToTxt/src/compile.bat b/base/migrate/70ToTxt/src/compile.bat deleted file mode 100755 index 164cdc321..000000000 --- a/base/migrate/70ToTxt/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "70ToTxt/classes/Main.class" and -REM "70ToTxt/classes/CMS70LdifParser.class" which are -REM used to create a normalized CMS 7.0 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 70ToTxt -REM - -REM SET SERVER_ROOT=C:\cms701 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 7.0 NOTE: "WINNT" - 1.4.2 -REM -REM CMS 7.01 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CMS_7.01 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 7.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 70ToTxt - create "CMS70LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/70ToTxt/src/compile.sh b/base/migrate/70ToTxt/src/compile.sh deleted file mode 100755 index 7c9de9b89..000000000 --- a/base/migrate/70ToTxt/src/compile.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "70ToTxt/classes/Main.class" and ### -### "70ToTxt/classes/CMS70LdifParser.class" which are ### -### used to create a normalized CMS 7.0 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 70ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms70 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 7.0 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.2 -### "SunOS" - 1.4.2 -### - -#JDK_VERSION=CMS_7.0 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 7.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 70ToTxt - create "CMS70LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/71ToTxt/classes/CMS71LdifParser.class b/base/migrate/71ToTxt/classes/CMS71LdifParser.class Binary files differdeleted file mode 100644 index b78e44623..000000000 --- a/base/migrate/71ToTxt/classes/CMS71LdifParser.class +++ /dev/null diff --git a/base/migrate/71ToTxt/classes/Main.class b/base/migrate/71ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index e37d5400a..000000000 --- a/base/migrate/71ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/71ToTxt/run.bat b/base/migrate/71ToTxt/run.bat deleted file mode 100755 index 4dbe2f5cd..000000000 --- a/base/migrate/71ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CS 7.1 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CS 7.1 ldif text file. -REM -REM This subsequent normalized CS 7.1 ldif text file -REM can be migrated into CS 7.1 or later utilizing -REM the corresponding TxtTo<Target CS Version> script which -REM converts this normalized CS 7.1 ldif text file into -REM a <Target CS Version> ldif data file. -REM -REM This <Target CS Version> ldif data file can then be -REM imported into the internal database of the desired CS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cs71 - - -REM -REM INSTANCE - if the CS instance directory is called 'cert-ca', -REM set the CS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CS% ldif data file -REM into a normalized %CS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/71ToTxt/run.sh b/base/migrate/71ToTxt/run.sh deleted file mode 100755 index e1a33a541..000000000 --- a/base/migrate/71ToTxt/run.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CS 7.1 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CS 7.1 ldif text file. ### -### ### -### This subsequent normalized CS 7.1 ldif text file ### -### can be migrated into CS 7.1 or later utilizing ### -### the corresponding TxtTo<Target CS Version> script which ### -### converts this normalized CS 7.1 ldif text file into ### -### a <Target CS Version> ldif data file. ### -### ### -### This <Target CS Version> ldif data file can then be ### -### imported into the internal database of the desired CS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cs71 -#export SERVER_ROOT - - -### -### INSTANCE - if the CS instance directory is called 'cert-ca', -### set the CS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.1" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CS} ldif data file -### into a normalized ${CS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/71ToTxt/src/Main.java b/base/migrate/71ToTxt/src/Main.java deleted file mode 100644 index 796653370..000000000 --- a/base/migrate/71ToTxt/src/Main.java +++ /dev/null @@ -1,483 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "71ToTxt/src/Main.java" is based upon a copy "70ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.1" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 70ToTxt/src/Main.java 71ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS71LdifParser parser = null; - if (args.length == 1) { - parser = new CMS71LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS71LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS71LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS71LdifParser(String filename) - { - mFilename = filename; - } - - public CMS71LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.cmscore.kra.ProofOfArchival) { - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.cmscore.kra.ProofOfArchival o = - (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/71ToTxt/src/compile.bat b/base/migrate/71ToTxt/src/compile.bat deleted file mode 100755 index 49ba89621..000000000 --- a/base/migrate/71ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "71ToTxt/classes/Main.class" and -REM "71ToTxt/classes/CMS71LdifParser.class" which are -REM used to create a normalized CS 7.1 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CS <server_root> used to compile 71ToTxt -REM - -REM SET SERVER_ROOT=C:\cs71 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CS -REM -REM CS 7.1 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CS_7.1 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 71ToTxt - create "CMS71LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/71ToTxt/src/compile.sh b/base/migrate/71ToTxt/src/compile.sh deleted file mode 100755 index 23464bcb3..000000000 --- a/base/migrate/71ToTxt/src/compile.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "71ToTxt/classes/Main.class" and ### -### "71ToTxt/classes/CMS71LdifParser.class" which are ### -### used to create a normalized CS 7.1 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CS <server_root> used to compile 71ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cs71 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CS -### -### CS 7.1 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.2 -### "SunOS" - 1.4.2 -### - -#JDK_VERSION=CS_7.1 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.1" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 71ToTxt - create "CMS71LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/72ToTxt/classes/CMS72LdifParser.class b/base/migrate/72ToTxt/classes/CMS72LdifParser.class Binary files differdeleted file mode 100644 index 707657160..000000000 --- a/base/migrate/72ToTxt/classes/CMS72LdifParser.class +++ /dev/null diff --git a/base/migrate/72ToTxt/classes/Main.class b/base/migrate/72ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 470df979a..000000000 --- a/base/migrate/72ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/72ToTxt/run.bat b/base/migrate/72ToTxt/run.bat deleted file mode 100755 index 9613fe5d5..000000000 --- a/base/migrate/72ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CS 7.2 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CS 7.2 ldif text file. -REM -REM This subsequent normalized CS 7.2 ldif text file -REM can be migrated into CS 7.2 or later utilizing -REM the corresponding TxtTo<Target CS Version> script which -REM converts this normalized CS 7.2 ldif text file into -REM a <Target CS Version> ldif data file. -REM -REM This <Target CS Version> ldif data file can then be -REM imported into the internal database of the desired CS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cs72 - - -REM -REM INSTANCE - if the CS instance directory is called 'cert-ca', -REM set the CS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CS% ldif data file -REM into a normalized %CS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/72ToTxt/run.sh b/base/migrate/72ToTxt/run.sh deleted file mode 100755 index ccdd00630..000000000 --- a/base/migrate/72ToTxt/run.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CS 7.2 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CS 7.2 ldif text file. ### -### ### -### This subsequent normalized CS 7.2 ldif text file ### -### can be migrated into CS 7.2 or later utilizing ### -### the corresponding TxtTo<Target CS Version> script which ### -### converts this normalized CS 7.2 ldif text file into ### -### a <Target CS Version> ldif data file. ### -### ### -### This <Target CS Version> ldif data file can then be ### -### imported into the internal database of the desired CS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - -### -### Java Runtime Environment -### -JRE_ROOT=/usr/lib/jvm/jre-1.5.0 -export JRE_ROOT - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - -### -### Script-defined constants -### - -CS="CS 7.2" -export CS - -OS_NAME=`uname` -export OS_NAME - -ARCH=`uname -i` -export ARCH - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### -CLASSPATH=/usr/share/rhpki/migrate/72ToTxt/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar -export CLASSPATH - -if [ ${OS_NAME} = "Linux" ] ; then - if [ ${ARCH} = "i386" ] ; then - LD_LIBRARY_PATH=/usr/lib/dirsec:/usr/lib:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - else # x86_64 - LD_LIBRARY_PATH=/usr/lib64/dirsec:/usr/lib64:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/72ToTxt/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib64/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH - fi -else # SunOS 64-bits - LD_LIBRARY_PATH=/usr/lib/sparcv9/dirsec:/usr/lib/sparcv9:${JRE_ROOT}/lib:${JRE_ROOT}/lib/sparc/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/72ToTxt/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/sparcv9/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH -fi - - -### -### Convert the specified ${CS} ldif data file -### into a normalized ${CS} ldif text file. -### - -${JRE_ROOT}/bin/java -classpath ${CLASSPATH} Main $1 $2 diff --git a/base/migrate/72ToTxt/src/Main.java b/base/migrate/72ToTxt/src/Main.java deleted file mode 100644 index 3b1a3693d..000000000 --- a/base/migrate/72ToTxt/src/Main.java +++ /dev/null @@ -1,485 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "71ToTxt/src/Main.java" is based upon a copy "70ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.1" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 70ToTxt/src/Main.java 71ToTxt/src/Main.java -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS72LdifParser parser = null; - if (args.length == 1) { - parser = new CMS72LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS72LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS72LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS72LdifParser(String filename) - { - mFilename = filename; - } - - public CMS72LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - // CS 7.2: moved com.netscape.cmscore.kra.ProofOfArchival - // to com.netscape.certsrv.kra.ProofOfArchival - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/72ToTxt/src/compile.bat b/base/migrate/72ToTxt/src/compile.bat deleted file mode 100755 index c0377e5e5..000000000 --- a/base/migrate/72ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "72ToTxt/classes/Main.class" and -REM "72ToTxt/classes/CMS72LdifParser.class" which are -REM used to create a normalized CS 7.2 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CS <server_root> used to compile 72ToTxt -REM - -REM SET SERVER_ROOT=C:\cs72 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CS -REM -REM CS 7.2 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CS_7.2 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 72ToTxt - create "CMS72LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/72ToTxt/src/compile.sh b/base/migrate/72ToTxt/src/compile.sh deleted file mode 100755 index 6c616cd40..000000000 --- a/base/migrate/72ToTxt/src/compile.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "72ToTxt/classes/Main.class" and ### -### "72ToTxt/classes/CMS72LdifParser.class" which are ### -### used to create a normalized CS 7.2 ldif text file. ### -### ### -##################################################################### - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=Linux -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CS -### -### CS 7.2 NOTE: "Linux" - 1.5.0 (IBM) -### "SunOS" - 1.5.0 -### - -#JDK_VERSION=CS_7.2.0 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.2" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 72ToTxt - create "CMS72LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:/usr/share/java/rhpki/nsutil.jar:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/lib/java/rhpki/ca/ca.jar:/usr/lib/java/rhpki/tks/tks.jar:/usr/lib/java/rhpki/ocsp/ocsp.jar:/usr/lib/java/rhpki/kra/kra.jar:/usr/lib/java/dirsec/jss4.jar Main.java - diff --git a/base/migrate/73ToTxt/classes/CMS73LdifParser.class b/base/migrate/73ToTxt/classes/CMS73LdifParser.class Binary files differdeleted file mode 100644 index 9ca1fdfd5..000000000 --- a/base/migrate/73ToTxt/classes/CMS73LdifParser.class +++ /dev/null diff --git a/base/migrate/73ToTxt/classes/Main.class b/base/migrate/73ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 30a21375d..000000000 --- a/base/migrate/73ToTxt/classes/Main.class +++ /dev/null diff --git a/base/migrate/73ToTxt/run.bat b/base/migrate/73ToTxt/run.bat deleted file mode 100755 index f360f44d0..000000000 --- a/base/migrate/73ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CS 7.3 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CS 7.3 ldif text file. -REM -REM This subsequent normalized CS 7.3 ldif text file -REM can be migrated into CS 7.3 or later utilizing -REM the corresponding TxtTo<Target CS Version> script which -REM converts this normalized CS 7.3 ldif text file into -REM a <Target CS Version> ldif data file. -REM -REM This <Target CS Version> ldif data file can then be -REM imported into the internal database of the desired CS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cs73 - - -REM -REM INSTANCE - if the CS instance directory is called 'cert-ca', -REM set the CS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.3" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CS% ldif data file -REM into a normalized %CS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/73ToTxt/run.sh b/base/migrate/73ToTxt/run.sh deleted file mode 100755 index a35994fb0..000000000 --- a/base/migrate/73ToTxt/run.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CS 7.3 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CS 7.3 ldif text file. ### -### ### -### This subsequent normalized CS 7.3 ldif text file ### -### can be migrated into CS 7.3 or later utilizing ### -### the corresponding TxtTo<Target CS Version> script which ### -### converts this normalized CS 7.3 ldif text file into ### -### a <Target CS Version> ldif data file. ### -### ### -### This <Target CS Version> ldif data file can then be ### -### imported into the internal database of the desired CS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - -### -### Java Runtime Environment -### -JRE_ROOT=/usr/lib/jvm/jre-1.5.0 -export JRE_ROOT - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - -### -### Script-defined constants -### - -CS="CS 7.3" -export CS - -OS_NAME=`uname` -export OS_NAME - -ARCH=`uname -i` -export ARCH - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### -CLASSPATH=/usr/share/rhpki/migrate/73ToTxt/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar -export CLASSPATH - -if [ ${OS_NAME} = "Linux" ] ; then - if [ ${ARCH} = "i386" ] ; then - LD_LIBRARY_PATH=/usr/lib/dirsec:/usr/lib:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - else # x86_64 - LD_LIBRARY_PATH=/usr/lib64/dirsec:/usr/lib64:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/73ToTxt/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib64/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH - fi -else # SunOS 64-bits - LD_LIBRARY_PATH=/usr/lib/sparcv9/dirsec:/usr/lib/sparcv9:${JRE_ROOT}/lib:${JRE_ROOT}/lib/sparc/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/73ToTxt/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/sparcv9/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH -fi - - -### -### Convert the specified ${CS} ldif data file -### into a normalized ${CS} ldif text file. -### - -${JRE_ROOT}/bin/java -classpath ${CLASSPATH} Main $1 $2 diff --git a/base/migrate/73ToTxt/src/Main.java b/base/migrate/73ToTxt/src/Main.java deleted file mode 100644 index e6526b6c1..000000000 --- a/base/migrate/73ToTxt/src/Main.java +++ /dev/null @@ -1,485 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "71ToTxt/src/Main.java" is based upon a copy "70ToTxt/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.1" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// -// This file should always be maintained by executing the following command: -// -// diff 70ToTxt/src/Main.java 71ToTxt/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS73LdifParser parser = null; - if (args.length == 1) { - parser = new CMS73LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS73LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS73LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS73LdifParser(String filename) - { - mFilename = filename; - } - - public CMS73LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock o = - (com.netscape.cmscore.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.cmscore.dbs.KeyRecord) { - // CMS 6.0: moved "com.netscape.certsrv.dbs.keydb.KeyRecord" - // to "com.netscape.cmscore.dbs.KeyRecord" - com.netscape.cmscore.dbs.KeyRecord o = - (com.netscape.cmscore.dbs.KeyRecord)obj; - Enumeration<String> e = o.getElements(); - while (e.hasMoreElements()) { - String k = e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - // CS 7.2: moved com.netscape.cmscore.kra.ProofOfArchival - // to com.netscape.certsrv.kra.ProofOfArchival - // CMS 6.0: moved "com.netscape.certsrv.kra.ProofOfArchival" - // to "com.netscape.cmscore.kra.ProofOfArchival" - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof byte[]) { - // Since 6.1's profile framework, - // req_archive_options is a byte array - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/base/migrate/73ToTxt/src/compile.bat b/base/migrate/73ToTxt/src/compile.bat deleted file mode 100755 index f5b720e54..000000000 --- a/base/migrate/73ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "73ToTxt/classes/Main.class" and -REM "73ToTxt/classes/CMS73LdifParser.class" which are -REM used to create a normalized CS 7.3 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CS <server_root> used to compile 73ToTxt -REM - -REM SET SERVER_ROOT=C:\cs73 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CS -REM -REM CS 7.3 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CS_7.3 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.3" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 73ToTxt - create "CMS73LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/73ToTxt/src/compile.sh b/base/migrate/73ToTxt/src/compile.sh deleted file mode 100755 index 0c8975c4a..000000000 --- a/base/migrate/73ToTxt/src/compile.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "73ToTxt/classes/Main.class" and ### -### "73ToTxt/classes/CMS73LdifParser.class" which are ### -### used to create a normalized CS 7.3 ldif text file. ### -### ### -##################################################################### - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -JDK_PLATFORM=Linux -export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CS -### -### CS 7.3 NOTE: "Linux" - 1.5.0 (IBM) -### "SunOS" - 1.5.0 -### - -JDK_VERSION=PKI_7.3.0 -export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -export JAVA_HOME - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.3" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 73ToTxt - create "CMS73LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:/usr/share/java/rhpki/nsutil.jar:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/lib/java/rhpki/ca/ca.jar:/usr/lib/java/rhpki/tks/tks.jar:/usr/lib/java/rhpki/ocsp/ocsp.jar:/usr/lib/java/rhpki/kra/kra.jar:/usr/lib/java/dirsec/jss4.jar Main.java - diff --git a/base/migrate/80/MigrateSecurityDomain.class b/base/migrate/80/MigrateSecurityDomain.class Binary files differdeleted file mode 100644 index f2a174dab..000000000 --- a/base/migrate/80/MigrateSecurityDomain.class +++ /dev/null diff --git a/base/migrate/80/MigrateSecurityDomain.java b/base/migrate/80/MigrateSecurityDomain.java deleted file mode 100644 index 09fdb28aa..000000000 --- a/base/migrate/80/MigrateSecurityDomain.java +++ /dev/null @@ -1,235 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2008 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -import java.io.FileInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Vector; - -import netscape.ldap.LDAPAttribute; -import netscape.ldap.LDAPAttributeSet; -import netscape.ldap.LDAPConnection; -import netscape.ldap.LDAPEntry; -import netscape.ldap.LDAPException; - -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import com.netscape.cmscore.base.FileConfigStore; -import com.netscape.cmscore.ldapconn.LdapJssSSLSocketFactory; -import com.netscape.cmsutil.ldap.LDAPUtil; -import com.netscape.cmsutil.xml.XMLObject; - -public class MigrateSecurityDomain { - - private static LDAPConnection getLDAPConn(FileConfigStore cs, String passwd) - throws IOException { - - String host = ""; - String port = ""; - String binddn = ""; - String security = ""; - - try { - host = cs.getString("internaldb.ldapconn.host"); - port = cs.getString("internaldb.ldapconn.port"); - binddn = cs.getString("internaldb.ldapauth.bindDN"); - security = cs.getString("internaldb.ldapconn.secureConn"); - } catch (Exception e) { - System.out.println("MigrateSecurityDomain: getLDAPConnection" + e.toString()); - throw new IOException( - "Failed to retrieve LDAP information from CS.cfg."); - } - - int p = -1; - - try { - p = Integer.parseInt(port); - } catch (Exception e) { - System.out.println("MigrateSecurityDomain getLDAPConn: " + e.toString()); - throw new IOException("Port is not valid"); - } - - LDAPConnection conn = null; - if (security.equals("true")) { - System.out.println("MigrateSecurityDomain getLDAPConn: creating secure (SSL) connection for internal ldap"); - conn = new LDAPConnection(new LdapJssSSLSocketFactory()); - } else { - System.out.println( - "MigrateSecurityDomain getLDAPConn: creating non-secure (non-SSL) connection for internal ldap"); - conn = new LDAPConnection(); - } - - System.out.println("MigrateSecurityDomain connecting to " + host + ":" + p); - try { - conn.connect(host, p, binddn, passwd); - } catch (LDAPException e) { - System.out.println("MigrateSecurityDomain getLDAPConn: " + e.toString()); - throw new IOException("Failed to connect to the internal database."); - } - - return conn; - } - - public static void main(String args[]) throws Exception { - if (args.length != 2) { - System.out.println("Usage: MigrateSecurityDomain <instance root path> <directory manager password>"); - System.exit(0); - } - - String instRoot = args[0]; - String dmPass = args[1]; - - XMLObject parser = null; - // get the security domain data from the domain.xml file - try { - String path = instRoot + "/conf/domain.xml"; - System.out.println("MigrateSecurityDomain: Reading domain.xml from file ..."); - parser = new XMLObject(new FileInputStream(path)); - - } catch (Exception e) { - System.out.println("MigrateSecurityDomain: Unable to get domain info from domain.xml file"); - System.out.println(e.toString()); - System.exit(1); - } - - try { - String configFile = instRoot + "/conf/CS.cfg"; - FileConfigStore cs = new FileConfigStore(configFile); - - LDAPConnection conn = null; - conn = MigrateSecurityDomain.getLDAPConn(cs, dmPass); - if (conn == null) { - System.out.println("MigrateSecurityDomain: Failed to connect to internal database"); - System.exit(1); - } - - // add new schema elements - String importFile = "./schema-add.ldif"; - ArrayList<String> errors = new ArrayList<String>(); - try { - LDAPUtil.importLDIF(conn, importFile, errors); - if (! errors.isEmpty()) { - System.out.println("MigrateSecurityDomain: Errors in adding new schema elements:"); - for (String error: errors) { - System.out.println(error); - } - } - } catch (Exception e) { - System.out.println("MigrateSecurityDomain: Error in adding new schema elements"); - System.exit(1); - } - // create the containers - String basedn = cs.getString("internaldb.basedn"); - String secdomain = parser.getValue("Name"); - - try { - String dn = "ou=Security Domain," + basedn; - System.out.println("MigrateSecurityDomain: creating ldap entry : " + dn); - - LDAPEntry entry = null; - LDAPAttributeSet attrs = null; - attrs = new LDAPAttributeSet(); - attrs.add(new LDAPAttribute("objectclass", "top")); - attrs.add(new LDAPAttribute("objectclass", "organizationalUnit")); - attrs.add(new LDAPAttribute("name", secdomain)); - attrs.add(new LDAPAttribute("ou", "Security Domain")); - entry = new LDAPEntry(dn, attrs); - conn.add(entry); - } catch (LDAPException e) { - if (e.getLDAPResultCode() != 68) { - System.out.println("Unable to create security domain" + e.toString()); - System.exit(1); - } - } - - // create list containers - String clist[] = { "CAList", "OCSPList", "KRAList", "RAList", "TKSList", "TPSList" }; - for (int i = 0; i < 6; i++) { - LDAPEntry entry = null; - LDAPAttributeSet attrs = null; - String dn = "cn=" + clist[i] + ",ou=Security Domain," + basedn; - attrs = new LDAPAttributeSet(); - attrs.add(new LDAPAttribute("objectclass", "top")); - attrs.add(new LDAPAttribute("objectclass", "pkiSecurityGroup")); - attrs.add(new LDAPAttribute("cn", clist[i])); - entry = new LDAPEntry(dn, attrs); - try { - conn.add(entry); - } catch (LDAPException e) { - if (e.getLDAPResultCode() != 68) { - System.out.println("Unable to create security domain list entry " + dn + ": " + e.toString()); - System.exit(1); - } - } - } - - // create system entries - String tlist[] = { "CA", "OCSP", "KRA", "RA", "TKS", "TPS" }; - Document doc = parser.getDocument(); - for (int j = 0; j < 6; j++) { - String type = tlist[j]; - NodeList nodeList = doc.getElementsByTagName(type); - int len = nodeList.getLength(); - for (int i = 0; i < len; i++) { - Vector<String> v_clone = parser.getValuesFromContainer(nodeList.item(i), "Clone"); - Vector<String> v_name = parser.getValuesFromContainer(nodeList.item(i), "SubsystemName"); - Vector<String> v_host = parser.getValuesFromContainer(nodeList.item(i), "Host"); - Vector<String> v_port = parser.getValuesFromContainer(nodeList.item(i), "SecurePort"); - - String cn = v_host.elementAt(0) + ":" + v_port.elementAt(0); - String dn = "cn=" + cn + ",cn=" + type + "List,ou=Security Domain," + basedn; - LDAPEntry entry = null; - LDAPAttributeSet attrs = null; - attrs = new LDAPAttributeSet(); - attrs.add(new LDAPAttribute("objectclass", "top")); - attrs.add(new LDAPAttribute("objectclass", "pkiSubsystem")); - attrs.add(new LDAPAttribute("Host", v_host.elementAt(0))); - attrs.add(new LDAPAttribute("SecurePort", v_port.elementAt(0))); - attrs.add(new LDAPAttribute("Clone", v_clone.elementAt(0))); - attrs.add(new LDAPAttribute("SubsystemName", v_name.elementAt(0))); - attrs.add(new LDAPAttribute("cn", cn)); - attrs.add(new LDAPAttribute("DomainManager", "true")); - // Since the initial port separation feature didn't occur - // until an RHCS 7.3 errata, simply store the "SecurePort" - // value for BOTH the "SecureAgentPort" and the - // "SecureAdminPort", and DON'T store any values for the - // "UnSecurePort" - attrs.add(new LDAPAttribute("SecureAgentPort", v_port.elementAt(0))); - attrs.add(new LDAPAttribute("SecureAdminPort", v_port.elementAt(0))); - entry = new LDAPEntry(dn, attrs); - - try { - conn.add(entry); - } catch (LDAPException e) { - if (e.getLDAPResultCode() != 68) { - System.out.println("Unable to create entry " + dn + ": " + e.toString()); - } - } - } - } - cs.putString("securitydomain.store", "ldap"); - cs.commit(false); - System.out.println("MigrateSecurityDomain: Domain successfully migrated."); - } catch (Exception e) { - System.out.println("MigrateSecurityDomain: Migration failed. " + e.toString()); - } - System.exit(0); - } - -} diff --git a/base/migrate/80/readme b/base/migrate/80/readme deleted file mode 100644 index 50365c985..000000000 --- a/base/migrate/80/readme +++ /dev/null @@ -1,29 +0,0 @@ -Date - - Fri Oct 3 00:37:14 EDT 2008 - -Version - - CMS 8.0 - -Overview - - In CMS8.0, the security domain data has been migrated into the - internal LDAP database to allow easier replication of this data - when cloning. Prior to this release, this information was stored - in the domain.xml configuration file on the CA serving as the Domain - Master. - -Program - - MigrateSecurityDomain - This command will add the relevant schema and migrate - security domain data that resides in domain.xml into the internal database. - The program needs only two arguments - the location of the instance root directory - (like /var/lib/pki-ca) and the directory user's password. - -Example - - Here is an example of MigrateSecurityDomain usage -java -cp /usr/share/java/ldapjdk.jar:/usr/share/java/pki/cmscore.jar:/usr/share/java/pki/cmsutil.jar:/usr/share/java/pki/certsrv.jar:. MigrateSecurityDomain /var/lib/pki-ca mypassword - - diff --git a/base/migrate/80/schema-add.ldif b/base/migrate/80/schema-add.ldif deleted file mode 100644 index fe6577e51..000000000 --- a/base/migrate/80/schema-add.ldif +++ /dev/null @@ -1,50 +0,0 @@ -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( Clone-oid NAME 'Clone' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( DomainManager-oid NAME 'DomainManager' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( SecurePort-oid NAME 'SecurePort' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( SecureAgentPort-oid NAME 'SecureAgentPort' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( SecureAdminPort-oid NAME 'SecureAdminPort' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( UnSecurePort-oid NAME 'UnSecurePort' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: attributeTypes -attributeTypes: ( SubsystemName-oid NAME 'SubsystemName' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: objectClasses -objectClasses: ( pkiSecurityDomain-oid NAME 'pkiSecurityDomain' DESC 'CMS defined class' SUP top STRUCTURAL MUST ( cn $ name ) X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: objectClasses -objectClasses: ( pkiSecurityGroup-oid NAME 'pkiSecurityGroup' DESC 'CMS defined class' SUP top STRUCTURAL MUST cn X-ORIGIN 'user defined' ) - -dn: cn=schema -changetype: modify -add: objectClasses -objectClasses: ( pkiSubsystem-oid NAME 'pkiSubsystem' DESC 'CMS defined class' SUP top STRUCTURAL MUST ( cn $ Host $ SecurePort $ SubsystemName $ Clone ) MAY ( DomainManager $ SecureAgentPort $ SecureAdminPort $ UnSecurePort ) X-ORIGIN 'user defined' ) - diff --git a/base/migrate/CMakeLists.txt b/base/migrate/CMakeLists.txt deleted file mode 100644 index 94cc990f6..000000000 --- a/base/migrate/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -project(migrate) - -set(INSTALL_DIRS - 41ToTxt - 42SP2ToTxt - 42ToTxt - 45ToTxt - 47ToTxt - 60ToTxt - 61ToTxt - 62ToTxt - 63ToTxt - 70ToTxt - 71ToTxt - 72ToTxt - 73ToTxt - 80 - TpsTo80 - TxtTo60 - TxtTo61 - TxtTo62 - TxtTo70 - TxtTo71 - TxtTo72 - TxtTo73 - TxtTo80 -) - -foreach(INSTALL_DIR ${INSTALL_DIRS}) - install( - DIRECTORY - ${INSTALL_DIR} - DESTINATION - ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME}/${INSTALL_DIR} - ) -endforeach(INSTALL_DIR ${INSTALL_DIRS}) diff --git a/base/migrate/LICENSE b/base/migrate/LICENSE deleted file mode 100644 index e281f4362..000000000 --- a/base/migrate/LICENSE +++ /dev/null @@ -1,291 +0,0 @@ -This Program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published -by the Free Software Foundation; version 2 of the License. - -This Program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with this Program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. diff --git a/base/migrate/TpsTo80/Makefile b/base/migrate/TpsTo80/Makefile deleted file mode 100644 index 99c0d275c..000000000 --- a/base/migrate/TpsTo80/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -OS_ARCH := $(subst /,_,$(shell uname -s)) - -ifeq ($(OS_ARCH), Linux) - CC = gcc - CFLAGS = -g - LDFLAGS = -s -lldif60 -lplc4 -lplds4 -lnspr4 -else -ifeq ($(OS_ARCH), SunOS) - CC = cc - LINTFLAGS = -c - CFLAGS = -dalign -xO2 -xarch=v9 -DSOLARIS - INCLUDE_PATH = -I/usr/include/dirsec - LDFLAGS = -s -L/usr/lib/64 -lldif60 -L/usr/lib/64/dirsec -R/usr/lib/64/dirsec -lplc4 -lplds4 -lnspr4 -endif # SunOS -endif # Linux - -OBJS = migrateTPSData.o - -SRCS = migrateTPSData.c - -all: migrateTPSData - -$(OBJS): $(SRCS) - $(CC) $(CFLAGS) $(INCLUDE_PATH) -c $< \ - -o $*.o - -migrateTPSData: $(OBJS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) - -lint: $(SRCS) - lint $(LINTFLAGS) $(CFLAGS) $(INCLUDE_PATH) $(SRCS) - -clean: - -rm migrateTPSData.ln - -rm migrateTPSData.o - -rm migrateTPSData diff --git a/base/migrate/TpsTo80/linux/migrateTPSData.i386 b/base/migrate/TpsTo80/linux/migrateTPSData.i386 Binary files differdeleted file mode 100755 index 9fd4b3906..000000000 --- a/base/migrate/TpsTo80/linux/migrateTPSData.i386 +++ /dev/null diff --git a/base/migrate/TpsTo80/linux/migrateTPSData.x86_64 b/base/migrate/TpsTo80/linux/migrateTPSData.x86_64 Binary files differdeleted file mode 100755 index d89125c7e..000000000 --- a/base/migrate/TpsTo80/linux/migrateTPSData.x86_64 +++ /dev/null diff --git a/base/migrate/TpsTo80/migrateTPSData.c b/base/migrate/TpsTo80/migrateTPSData.c deleted file mode 100644 index a4cf340ab..000000000 --- a/base/migrate/TpsTo80/migrateTPSData.c +++ /dev/null @@ -1,501 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, -// Boston, MA 02110-1301 USA -// -// Copyright (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#ifdef SOLARIS -#include <mozldap6/ldif.h> -#else -#include <mozldap/ldif.h> -#endif -#include <ctype.h> -#include <nspr4/nspr.h> -#include <nspr4/plstr.h> -#include <nspr4/plhash.h> -#include <nspr4/prmem.h> -#include <nspr4/prprf.h> -#include <nspr4/prsystem.h> -#include <errno.h> -#include <string.h> - -#define SHORT_LEN 512 -#define NO_TOKEN_TYPE "no_token_type" - -static PLHashTable *token_set; -static FILE *infile; -static FILE *outfile; - -/* hash functions */ -static PR_CALLBACK void* -_AllocTable(void* pool, PRSize size) -{ - return PR_MALLOC(size); -} - -static PR_CALLBACK void -_FreeTable(void* pool, void* item) -{ - PR_DELETE(item); -} - -static PR_CALLBACK PLHashEntry* -_AllocEntry(void* pool, const void* key) -{ - return PR_NEW(PLHashEntry); -} - -static PR_CALLBACK void -_FreeEntry(void* pool, PLHashEntry* he, PRUintn flag) -{ - if( he == NULL ) { - return; - } - - if (flag == HT_FREE_VALUE) { - if( he->value != NULL ) { - PL_strfree( ( char* ) he->value ); - he->value = NULL; - } - } else if (flag == HT_FREE_ENTRY) { - if( he->key != NULL ) { - PL_strfree( ( char* ) he->key ); - he->key = NULL; - } - if( he->value != NULL ) { - PL_strfree( ( char* ) he->value ); - he->value = NULL; - } - PR_DELETE(he); - } -} - -static PLHashAllocOps _AllocOps = { - _AllocTable, - _FreeTable, - _AllocEntry, - _FreeEntry -}; - -/* utility functions */ -#ifdef SOLARIS -void do_free(char * buf) -{ - if (buf != NULL) { - PR_Free(buf); - buf = NULL; - } -} -#else -inline void do_free(char * buf) -{ - if (buf != NULL) { - PR_Free(buf); - buf = NULL; - } -} -#endif - - - -char *get_field( char *s, char* fname, int len) -{ - char *end = NULL; - int n; - - if( ( s = PL_strstr( s, fname ) ) == NULL ) { - return NULL; - } - - s += strlen(fname); - end = PL_strchr( s, ' ' ); - - if( end != NULL ) { - n = end - s; - } else { - n = PL_strlen( s ); - } - - if (n == 0) { - return NULL; - } else if (n > len) { - /* string too long */ - return NULL; - } else { - return PL_strndup( s, n ); - } -} - -/* - * Read the ldif, munge the entry and write to output. - */ -int read_and_modify_ldif() { - // user changes - static char agent_entry[] = "dn: cn=TUS Agents,ou=Groups"; - static int agent_ent_len = sizeof(agent_entry)-1; - static char admin_entry[] = "dn: cn=TUS Adminstrators,ou=Groups"; - static int admin_ent_len = sizeof(admin_entry)-1; - static char operator_entry[] = "dn: cn=TUS Officers,ou=Groups"; - static int operator_ent_len = sizeof(operator_entry)-1; - static char user_entry[] = "ou=People"; - - // token changes - static char token_entry[] = "ou=Tokens"; - - // activity changes - static char activity_entry[] = "ou=Activities"; - - char *entry = 0; - int lineno = 0; - - while ((entry = ldif_get_entry(infile, &lineno))) { - char *begin = entry; - - if (!PL_strncasecmp(entry, agent_entry, agent_ent_len)) { - process_agent_entry(entry); - } else if (!PL_strncasecmp(entry, admin_entry, admin_ent_len)) { - process_admin_entry(entry); - } else if (!PL_strncasecmp(entry, operator_entry, operator_ent_len)) { - process_operator_entry(entry); - } else if (PL_strstr(entry, token_entry) != NULL) { - process_token_entry(entry); - } else if (PL_strstr(entry, activity_entry) != NULL) { - process_activity_entry(entry); - } else if ((PL_strstr(entry, user_entry) != NULL) && - (PL_strstr(entry, "objectClass: organizationalunit") == NULL)) { - process_user_entry(entry); - } else { - process_unchanged_entry(entry); - fprintf(outfile, "\n"); - } - free(begin); - } - return 0; -} - -/** - * read the file, parse the activity records - * record the tokenTypes found for later use - */ -int parse_ldif_activities() { - // activity changes - static char activity_entry[] = "ou=Activities"; - - char *entry = 0; - int lineno = 0; - - while ((entry = ldif_get_entry(infile, &lineno))) { - char *begin = entry; - if (PL_strstr(entry, activity_entry) != NULL) { - parse_activity_entry(entry); - } - free(begin); - } - return 0; -} - -int parse_activity_entry(char* entry) { - static char tokenMsg_attr[] = "tokenMsg"; - static char tokenid_attr[] = "tokenID"; - char *line = entry; - char *tokenType = NULL; - char *cuid = NULL; - while ((line = ldif_getline(&entry))) { - char *type, *value; - int vlen = 0; - int rc; - - if ( *line == '\n' || *line == '\0' ) { - break; - } - - /* this call modifies line */ - rc = ldif_parse_line(line, &type, &value, &vlen); - if (rc != 0) { - printf("Unknown error processing ldif entry: %s\n", entry); - } else { - if (!PL_strncasecmp(type, tokenMsg_attr, SHORT_LEN)) { - tokenType = get_field(value, "tokenType=",SHORT_LEN); - } else if (!PL_strncasecmp(type, tokenid_attr, SHORT_LEN)) { - cuid = PL_strdup(value); - } - } - } - - if ((tokenType != NULL) && (cuid != NULL)) { - if ((char *) PL_HashTableLookupConst(token_set, cuid) == NULL) { - PL_HashTableAdd(token_set, PL_strdup(cuid), PL_strdup(tokenType)); - //printf("Adding entry: %s %s to hash\n", cuid, tokenType); - } - } - do_free(cuid); - do_free(tokenType); - return 0; -} - - - -/* change uniqueMember -> member */ -int process_agent_entry(char* entry) { - static char member_attr[] = "uniqueMember"; - - char *line = entry; - while ((line = ldif_getline(&entry))) { - char *type, *value; - int vlen = 0; - int rc; - - if ( *line == '\n' || *line == '\0' ) { - break; - } - - /* this call modifies line */ - rc = ldif_parse_line(line, &type, &value, &vlen); - if (rc != 0) { - printf("Unknown error processing ldif entry: %s\n", entry); - } else { - if (!PL_strncasecmp(type, member_attr, SHORT_LEN)) { - fprintf(outfile, "member: %s\n", value); - } else if ((!PL_strncasecmp(type, "objectClass", SHORT_LEN)) && (!PL_strncasecmp(value, "groupOfUniqueNames", SHORT_LEN))) { - fprintf(outfile, "objectClass: groupOfNames\n"); - } else { - fprintf(outfile, "%s", ldif_type_and_value(type, value, vlen)); - } - } - } - fprintf(outfile, "\n"); - return 0; -} - -/* same as agent */ -int process_operator_entry(char* entry) { - return process_agent_entry(entry); -} - -/* change uniqueMember -> member - * change typo in dn - */ -int process_admin_entry(char* entry) { - static char member_attr[] = "uniqueMember"; - static char dn_attr[] = "dn"; - - char *line = entry; - while ((line = ldif_getline(&entry))) { - char *type, *value; - int vlen = 0; - int rc; - - if ( *line == '\n' || *line == '\0' ) { - break; - } - - /* this call modifies line */ - rc = ldif_parse_line(line, &type, &value, &vlen); - if (rc != 0) { - printf("Unknown error processing ldif entry: %s", entry); - } else { - if (!PL_strncasecmp(type, member_attr, SHORT_LEN)) { - fprintf(outfile, "member: %s\n", value); - } else if (!PL_strncasecmp(type, dn_attr, SHORT_LEN)) { - int rep_size = PL_strlen("cn=TUS Adminstrators,ou=Groups,"); - fprintf(outfile, "dn: cn=TUS Administrators,ou=Groups,%s\n", value + rep_size); - } else if ((!PL_strncasecmp(type, "objectClass", SHORT_LEN)) && (!PL_strncasecmp(value, "groupOfUniqueNames", SHORT_LEN))) { - fprintf(outfile, "objectClass: groupOfNames\n"); - } else { - fprintf(outfile, "%s", ldif_type_and_value(type, value, vlen)); - } - } - } - fprintf(outfile, "\n"); - return 0; -} - -int process_user_entry(char *entry) { - process_unchanged_entry(entry); - fprintf(outfile, "objectClass: tpsProfileId\n"); - fprintf(outfile, "profileID: All Profiles\n"); - fprintf(outfile, "\n"); - return 0; -} - -int process_unchanged_entry(char *entry) { - char *line = entry; - while ((line = ldif_getline(&entry))) { - char *type, *value; - int vlen = 0; - int rc; - - if ( *line == '\n' || *line == '\0' ) { - break; - } - - /* this call modifies line */ - rc = ldif_parse_line(line, &type, &value, &vlen); - if (rc != 0) { - printf("Unknown error processing ldif entry: %s\n", entry); - } else { - fprintf(outfile, "%s", ldif_type_and_value(type, value, vlen)); - } - } - return 0; -} - -int process_activity_entry(char *entry) { - static char tokenmsg_attr[] = "tokenMsg"; - static char tokenid_attr[] = "tokenID"; - char *line = entry; - char *tokenType = NULL; - char *cuid = NULL; - char *dn = NULL; - while ((line = ldif_getline(&entry))) { - char *type, *value; - int vlen = 0; - int rc; - - if ( *line == '\n' || *line == '\0' ) { - break; - } - - /* this call modifies line */ - rc = ldif_parse_line(line, &type, &value, &vlen); - if (rc != 0) { - printf("Unknown error processing ldif entry: %s\n", entry); - } else { - fprintf(outfile, "%s", ldif_type_and_value(type, value, vlen)); - - if (!PL_strncasecmp(type, tokenmsg_attr, SHORT_LEN)) { - tokenType = get_field(value, "tokenType=",SHORT_LEN); - if (tokenType != NULL) { - fprintf(outfile, "tokenType: %s\n", tokenType); - } - } else if (!PL_strncasecmp(type, tokenid_attr, SHORT_LEN)) { - cuid = PL_strdup(value); - } else if (!PL_strncasecmp(type, tokenid_attr, SHORT_LEN)) { - dn = PL_strdup(value); - } - } - } - - if ((tokenType == NULL) && (cuid!= NULL)) { - // check hash for a value - if (PL_HashTableLookupConst(token_set, cuid) != NULL) { - fprintf(outfile, "tokenType: %s\n", (char *) PL_HashTableLookupConst(token_set, cuid)); - } else { - fprintf(outfile, "tokenType: %s\n", NO_TOKEN_TYPE); - // log error here - unable to set token type using dn - } - } - fprintf(outfile, "\n"); - do_free(cuid); - do_free(dn); - do_free(tokenType); - - return 0; -} - -int process_token_entry(char* entry) { - static char cn_attr[] = "cn"; - static char dn_attr[] = "dn"; - char *line = entry; - char *tokenType = NULL; - char *dn = NULL; - while ((line = ldif_getline(&entry))) { - char *type, *value; - int vlen = 0; - int rc; - - if ( *line == '\n' || *line == '\0' ) { - break; - } - - /* this call modifies line */ - rc = ldif_parse_line(line, &type, &value, &vlen); - if (rc != 0) { - printf("Unknown error processing ldif entry: %s\n", entry); - } else { - fprintf(outfile, "%s", ldif_type_and_value(type, value, vlen)); - - if (!PL_strncasecmp(type, cn_attr, SHORT_LEN)) { - if (value != NULL) { - tokenType = (char *) PL_HashTableLookupConst(token_set, value); - } - if (tokenType != NULL) { - fprintf(outfile, "tokenType: %s\n", tokenType); - } else { - fprintf(outfile, "tokenType: %s\n", NO_TOKEN_TYPE); - } - } else if (!PL_strncasecmp(type, dn_attr, SHORT_LEN)) { - dn = PL_strdup(value); - } - } - } - if ((tokenType == NULL) && (dn != NULL)) { - //log the error - } - fprintf(outfile, "\n"); - do_free(dn); - return 0; -} - - -int main (int argc, char *argv[]) { - char *in_fname = NULL; - char *out_fname = NULL; - - if (argc < 3) { - printf ("Usage:\n %s infile outfile\n", argv[0]); - return 1; - } - - in_fname = argv[1]; - infile = fopen(in_fname, "r"); - if (infile == NULL) { - perror("Error opening input file"); - return 1; - } - - out_fname = argv[2]; - outfile = fopen(out_fname, "w"); - if (outfile == NULL) { - perror("Error opening output file"); - return 1; - } - - //declare hash - token_set = PL_NewHashTable(3, PL_HashString, - PL_CompareStrings, PL_CompareValues, - &_AllocOps, NULL); - - printf("Parsing LDIF file for Token Activities\n"); - parse_ldif_activities(); - rewind(infile); - - printf("Parsing old LDIF file, and creating new LDIF file\n\n"); - read_and_modify_ldif(); - - printf("Operation is complete.\nA new LDIF file has been written at %s, \n", out_fname); - printf("to be imported into the database of your new TPS. \nPlease attend to any errors reported.\n\n"); - - fclose(infile); - fclose(outfile); - return 0; -} - diff --git a/base/migrate/TpsTo80/readme b/base/migrate/TpsTo80/readme deleted file mode 100644 index aa98de930..000000000 --- a/base/migrate/TpsTo80/readme +++ /dev/null @@ -1,44 +0,0 @@ -Date - - Tue May 12 14:37:14 EDT 2009 - -Version - - CMS 8.0 - -Overview - - In CMS8.0, the database schema for the TPS has changed. The following - changes were made: - 1. The objectclass of the LDAP groups TUS Administrators, TUS Agents and TUS Officers has been - changed from groupOfUniqueNames to groupOfNames. This also means that the attribute "uniqueMember" - must change to "member". - 2. The dn of the TUS Administrators group was originally misspelled. This has been fixed. - 3. A tokenType field has been added to the tokenRecord and tokenActivity tables. - 4. Users that have administrator, admin or officer access to the TUS are stored under ou=People, $basedn. - These users now require an auxilliary class tpsProfileId to be added, with the attribute profileID. - This multi-valued attribute profileID contains profiles for which this user has access in the TPS UI - pages. See the admin guide for more details. Because the previous versions of the TPS allowed - access to all profiles, a value for "All Profiles" will be added for all users by the migrateTpsData - program. If this is not desired, change the access of specific users using the UI. - -Program - - migrateTpsData(.x86_64 or .i386) will perform the above operations on an LDIF file and create a new - output LDIF file with the appropriate data to be imported into the new TPS instance. The input LDIF - file can be generated by running db2ldif on the old database for suffix containing the TPS data. - - The program requires two arguments - the location of the LDIF file containing a dump of the old data, - and the location of the output file. - - Any errors reported by the program should be investigated and fixed in the output LDIF file. Once - this file is corrected, it can be imported into the new TPS database. - - Note: This program should be run to migrate data into a configured TPS system. - -Example - - Here is an example of migrateTpsData usage - (for x86_64) - migrateTpsData.x86_64 old.ldif new.ldif - diff --git a/base/migrate/TpsTo80/solaris/migrateTPSData.sol9sparc b/base/migrate/TpsTo80/solaris/migrateTPSData.sol9sparc Binary files differdeleted file mode 100755 index 082201859..000000000 --- a/base/migrate/TpsTo80/solaris/migrateTPSData.sol9sparc +++ /dev/null diff --git a/base/migrate/TxtTo60/classes/CMS60LdifParser.class b/base/migrate/TxtTo60/classes/CMS60LdifParser.class Binary files differdeleted file mode 100644 index e65aea96f..000000000 --- a/base/migrate/TxtTo60/classes/CMS60LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo60/classes/DummyAuthManager.class b/base/migrate/TxtTo60/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index c713d8604..000000000 --- a/base/migrate/TxtTo60/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo60/classes/Main.class b/base/migrate/TxtTo60/classes/Main.class Binary files differdeleted file mode 100644 index 5fa0c203e..000000000 --- a/base/migrate/TxtTo60/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo60/run.bat b/base/migrate/TxtTo60/run.bat deleted file mode 100755 index bd7d582ed..000000000 --- a/base/migrate/TxtTo60/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CMS Version> ldif -REM text file (e. g. - created via a <Source CMS Version>ToTxt -REM script) into a CMS 6.0/6.01 ldif data file. -REM -REM This CMS 6.0/6.01 ldif data file can then be imported into the -REM internal database of the desired CMS 6.0/6.01 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms601 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\hotspot;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo60/run.sh b/base/migrate/TxtTo60/run.sh deleted file mode 100755 index 80856e207..000000000 --- a/base/migrate/TxtTo60/run.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CMS Version> ldif ### -### text file (e. g. - created via a <Source CMS Version>ToTxt ### -### script) into a CMS 6.0/6.01 ldif data file. ### -### ### -### This CMS 6.0/6.01 ldif data file can then be imported into ### -### the internal database of the desired CMS 6.0/6.01 server ### -### using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms601 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/base/migrate/TxtTo60/src/Main.java b/base/migrate/TxtTo60/src/Main.java deleted file mode 100644 index a2f8fbd48..000000000 --- a/base/migrate/TxtTo60/src/Main.java +++ /dev/null @@ -1,630 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo60/src/Main.java" represents the initial CMS "TxtTo" migration file. -// -// Always comment any new code sections with a "CMS 6.0" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS60LdifParser parser = null; - if (args.length == 1) { - parser = new CMS60LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS60LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS60LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS60LdifParser(String filename) - { - mFilename = filename; - } - - public CMS60LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock")) { - com.netscape.certsrv.base.ArgBlock obj = - (com.netscape.certsrv.base.ArgBlock)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions( - new DerInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.cmscore.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.cmscore.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.cmscore.kra.ProofOfArchival obj = - new com.netscape.cmscore.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo60/src/compile.bat b/base/migrate/TxtTo60/src/compile.bat deleted file mode 100755 index bc21bb20e..000000000 --- a/base/migrate/TxtTo60/src/compile.bat +++ /dev/null @@ -1,154 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo60/classes/Main.class", -REM "TxtTo60/classes/CMS60LdifParser.class", and -REM "TxtTo60/classes/DummyAuthManager.class" which are -REM used to create a CMS 6.0/6.01 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo60 -REM - -REM SET SERVER_ROOT=C:\cms601 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.0 NOTE: "WINNT" - 1.3.1_02 -REM -REM CMS 6.01 NOTE: "WINNT" - 1.3.1_02 -REM - -REM SET JDK_VERSION=CMS_6.01 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CMS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo60 - create "CMS60LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo60/src/compile.sh b/base/migrate/TxtTo60/src/compile.sh deleted file mode 100755 index a15b6a670..000000000 --- a/base/migrate/TxtTo60/src/compile.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo60/classes/Main.class", ### -### "TxtTo60/classes/CMS60LdifParser.class", and ### -### "TxtTo60/classes/DummyAuthManager.class" which are ### -### used to create a CMS 6.0/6.01 ldif data file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo60 -### - -#SERVER_ROOT=/export/home/migrate/cms601 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.0 NOTE: "HP-UX" - 1.3.1.02 -### "Linux" - 1.3.1_02 -### "SunOS" - 1.3.1_02 -### -### CMS 6.01 NOTE: "HP-UX" - 1.3.1.02 -### "Linux" - 1.4.0 -### "SunOS" - 1.3.1_02 -### - -#JDK_VERSION=CMS_6.01 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CMS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo60 - create "CMS60LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/TxtTo61/classes/CMS61LdifParser.class b/base/migrate/TxtTo61/classes/CMS61LdifParser.class Binary files differdeleted file mode 100644 index 03f2d90af..000000000 --- a/base/migrate/TxtTo61/classes/CMS61LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo61/classes/DummyAuthManager.class b/base/migrate/TxtTo61/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index 8b2039e74..000000000 --- a/base/migrate/TxtTo61/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo61/classes/Main.class b/base/migrate/TxtTo61/classes/Main.class Binary files differdeleted file mode 100644 index 2f0c1663e..000000000 --- a/base/migrate/TxtTo61/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo61/run.bat b/base/migrate/TxtTo61/run.bat deleted file mode 100755 index a63296608..000000000 --- a/base/migrate/TxtTo61/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CMS Version> ldif -REM text file (e. g. - created via a <Source CMS Version>ToTxt -REM script) into a CMS 6.1 ldif data file. -REM -REM This CMS 6.1 ldif data file can then be imported into the -REM internal database of the desired CMS 6.1 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms61 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo61/run.sh b/base/migrate/TxtTo61/run.sh deleted file mode 100755 index 6ef1cae42..000000000 --- a/base/migrate/TxtTo61/run.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CMS Version> ldif ### -### text file (e. g. - created via a <Source CMS Version>ToTxt ### -### script) into a CMS 6.1 ldif data file. ### -### ### -### This CMS 6.1 ldif data file can then be imported into the ### -### internal database of the desired CMS 6.1 server using a ### -### utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms61 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/TxtTo61/src/Main.java b/base/migrate/TxtTo61/src/Main.java deleted file mode 100644 index 7f4725f6f..000000000 --- a/base/migrate/TxtTo61/src/Main.java +++ /dev/null @@ -1,644 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo61/src/Main.java" is based upon a copy "TxtTo60/src/Main.java". -// -// Always comment any new code sections with a "CMS 6.1" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo60/src/Main.java TxtTo61/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS61LdifParser parser = null; - if (args.length == 1) { - parser = new CMS61LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS61LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS61LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS61LdifParser(String filename) - { - mFilename = filename; - } - - public CMS61LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") - || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock obj = - (com.netscape.cmscore.base.ArgBlock)table.get(name); - if (obj == null) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - obj = new com.netscape.cmscore.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions( - new DerInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.cmscore.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo[")) { - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.cmscore.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.cmscore.kra.ProofOfArchival obj = - new com.netscape.cmscore.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo61/src/compile.bat b/base/migrate/TxtTo61/src/compile.bat deleted file mode 100755 index 8b2a3bff9..000000000 --- a/base/migrate/TxtTo61/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo61/classes/Main.class", -REM "TxtTo61/classes/CMS61LdifParser.class", and -REM "TxtTo61/classes/DummyAuthManager.class" which are -REM used to create a CMS 6.1 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo61 -REM - -REM SET SERVER_ROOT=C:\cms61 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.1 NOTE: "WINNT" - 1.4.0 -REM - -REM SET JDK_VERSION=CMS_6.1 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CMS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo61 - create "CMS61LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo61/src/compile.sh b/base/migrate/TxtTo61/src/compile.sh deleted file mode 100755 index 3ec4885c9..000000000 --- a/base/migrate/TxtTo61/src/compile.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo61/classes/Main.class", ### -### "TxtTo61/classes/CMS61LdifParser.class", and ### -### "TxtTo61/classes/DummyAuthManager.class" which are ### -### used to create a CMS 6.1 ldif data file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo61 -### - -#SERVER_ROOT=/export/home/migrate/cms61 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.1 NOTE: "HP-UX" - 1.3.1.02 -### "Linux" - 1.3.1_02 -### "SunOS" - 1.3.1_02 -### - -#JDK_VERSION=CMS_6.1 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CMS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo61 - create "CMS61LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/TxtTo62/classes/CMS62LdifParser.class b/base/migrate/TxtTo62/classes/CMS62LdifParser.class Binary files differdeleted file mode 100644 index ca25274a8..000000000 --- a/base/migrate/TxtTo62/classes/CMS62LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo62/classes/DummyAuthManager.class b/base/migrate/TxtTo62/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index 387cde908..000000000 --- a/base/migrate/TxtTo62/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo62/classes/Main.class b/base/migrate/TxtTo62/classes/Main.class Binary files differdeleted file mode 100644 index e2e92309e..000000000 --- a/base/migrate/TxtTo62/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo62/run.bat b/base/migrate/TxtTo62/run.bat deleted file mode 100755 index 1e342ed24..000000000 --- a/base/migrate/TxtTo62/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CMS Version> ldif -REM text file (e. g. - created via a <Source CMS Version>ToTxt -REM script) into a CMS 6.2 ldif data file. -REM -REM This CMS 6.2 ldif data file can then be imported into the -REM internal database of the desired CMS 6.2 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms62 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo62/run.sh b/base/migrate/TxtTo62/run.sh deleted file mode 100755 index fdd6b2ee9..000000000 --- a/base/migrate/TxtTo62/run.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CMS Version> ldif ### -### text file (e. g. - created via a <Source CMS Version>ToTxt ### -### script) into a CMS 6.2 ldif data file. ### -### ### -### This CMS 6.2 ldif data file can then be imported into the ### -### internal database of the desired CMS 6.2 server using a ### -### utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms62 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.2" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/TxtTo62/src/Main.java b/base/migrate/TxtTo62/src/Main.java deleted file mode 100644 index 4af432442..000000000 --- a/base/migrate/TxtTo62/src/Main.java +++ /dev/null @@ -1,655 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo62/src/Main.java" is based upon a copy "TxtTo61/src/Main.java". -// -// Always comment any new code sections with a "CMS 6.2" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo61/src/Main.java TxtTo62/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS62LdifParser parser = null; - if (args.length == 1) { - parser = new CMS62LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS62LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS62LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS62LdifParser(String filename) - { - mFilename = filename; - } - - public CMS62LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") - || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock obj = - (com.netscape.cmscore.base.ArgBlock)table.get(name); - if (obj == null) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - obj = new com.netscape.cmscore.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions(); - obj.decodeEx(new ByteArrayInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateExtensions" - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName(new DerInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateSubjectName" - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.cmscore.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Locale")) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - table.put(name, Locale.getDefault()); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo[") - || type.startsWith("netscape.security.extensions.CertInfo[")) { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.cmscore.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.cmscore.kra.ProofOfArchival obj = - new com.netscape.cmscore.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo62/src/compile.bat b/base/migrate/TxtTo62/src/compile.bat deleted file mode 100755 index 063b8969f..000000000 --- a/base/migrate/TxtTo62/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo62/classes/Main.class", -REM "TxtTo62/classes/CMS62LdifParser.class", and -REM "TxtTo62/classes/DummyAuthManager.class" which are -REM used to create a CMS 6.2 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo62 -REM - -REM SET SERVER_ROOT=C:\cms62 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 6.2 NOTE: "WINNT" - 1.4.0 -REM - -REM SET JDK_VERSION=CMS_6.2 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 6.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CMS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo62 - create "CMS62LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo62/src/compile.sh b/base/migrate/TxtTo62/src/compile.sh deleted file mode 100755 index 4ab44f966..000000000 --- a/base/migrate/TxtTo62/src/compile.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo62/classes/Main.class", ### -### "TxtTo62/classes/CMS62LdifParser.class", and ### -### "TxtTo62/classes/DummyAuthManager.class" which are ### -### used to create a CMS 6.2 ldif data file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo62 -### - -#SERVER_ROOT=/export/home/migrate/cms62 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 6.2 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.0 -### "SunOS" - 1.4.0 -### - -#JDK_VERSION=CMS_6.2 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 6.2" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CMS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo62 - create "CMS62LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/TxtTo70/classes/CMS70LdifParser.class b/base/migrate/TxtTo70/classes/CMS70LdifParser.class Binary files differdeleted file mode 100644 index 3f4ed9b52..000000000 --- a/base/migrate/TxtTo70/classes/CMS70LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo70/classes/DummyAuthManager.class b/base/migrate/TxtTo70/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index 387cde908..000000000 --- a/base/migrate/TxtTo70/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo70/classes/Main.class b/base/migrate/TxtTo70/classes/Main.class Binary files differdeleted file mode 100644 index 09498213f..000000000 --- a/base/migrate/TxtTo70/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo70/run.bat b/base/migrate/TxtTo70/run.bat deleted file mode 100755 index 3e70ee8cd..000000000 --- a/base/migrate/TxtTo70/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CMS Version> ldif -REM text file (e. g. - created via a <Source CMS Version>ToTxt -REM script) into a CMS 7.0 ldif data file. -REM -REM This CMS 7.0 ldif data file can then be imported into the -REM internal database of the desired CMS 7.0 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms70 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 7.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo70/run.sh b/base/migrate/TxtTo70/run.sh deleted file mode 100755 index c7e0a3140..000000000 --- a/base/migrate/TxtTo70/run.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CMS Version> ldif ### -### text file (e. g. - created via a <Source CMS Version>ToTxt ### -### script) into a CMS 7.0 ldif data file. ### -### ### -### This CMS 7.0 ldif data file can then be imported into ### -### the internal database of the desired CMS 7.0 server ### -### using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms70 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 7.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/TxtTo70/src/Main.java b/base/migrate/TxtTo70/src/Main.java deleted file mode 100644 index 967bb5d63..000000000 --- a/base/migrate/TxtTo70/src/Main.java +++ /dev/null @@ -1,655 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo70/src/Main.java" is based upon a copy "TxtTo62/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.0" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo62/src/Main.java TxtTo70/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS70LdifParser parser = null; - if (args.length == 1) { - parser = new CMS70LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS70LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS70LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS70LdifParser(String filename) - { - mFilename = filename; - } - - public CMS70LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") - || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock obj = - (com.netscape.cmscore.base.ArgBlock)table.get(name); - if (obj == null) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - obj = new com.netscape.cmscore.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions(); - obj.decodeEx(new ByteArrayInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateExtensions" - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName(new DerInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateSubjectName" - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.util.Locale")) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - table.put(name, Locale.getDefault()); - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.cmscore.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo[") - || type.startsWith("netscape.security.extensions.CertInfo[")) { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.cmscore.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.cmscore.kra.ProofOfArchival obj = - new com.netscape.cmscore.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo70/src/compile.bat b/base/migrate/TxtTo70/src/compile.bat deleted file mode 100755 index f4d496a42..000000000 --- a/base/migrate/TxtTo70/src/compile.bat +++ /dev/null @@ -1,154 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo70/classes/Main.class", -REM "TxtTo70/classes/CMS70LdifParser.class", and -REM "TxtTo70/classes/DummyAuthManager.class" which are -REM used to create a CMS 7.0/7.01 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo70 -REM - -REM SET SERVER_ROOT=C:\cms701 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 7.0 NOTE: "WINNT" - 1.4.2 -REM -REM CMS 7.01 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CMS_7.01 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 7.0" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CMS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo70 - create "CMS70LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo70/src/compile.sh b/base/migrate/TxtTo70/src/compile.sh deleted file mode 100755 index 11b1b6df8..000000000 --- a/base/migrate/TxtTo70/src/compile.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo70/classes/Main.class", ### -### "TxtTo70/classes/CMS70LdifParser.class", and ### -### "TxtTo70/classes/DummyAuthManager.class" which are ### -### used to create a CMS 7.0 ldif data file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile TxtTo70 -### - -#SERVER_ROOT=/export/home/migrate/cms70 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 7.0 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.2 -### "SunOS" - 1.4.2 -### - -#JDK_VERSION=CMS_7.0 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 7.0" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CMS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo70 - create "CMS70LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/TxtTo71/classes/CMS71LdifParser.class b/base/migrate/TxtTo71/classes/CMS71LdifParser.class Binary files differdeleted file mode 100644 index fb449c41f..000000000 --- a/base/migrate/TxtTo71/classes/CMS71LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo71/classes/DummyAuthManager.class b/base/migrate/TxtTo71/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index 387cde908..000000000 --- a/base/migrate/TxtTo71/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo71/classes/Main.class b/base/migrate/TxtTo71/classes/Main.class Binary files differdeleted file mode 100644 index 8f02b13db..000000000 --- a/base/migrate/TxtTo71/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo71/run.bat b/base/migrate/TxtTo71/run.bat deleted file mode 100755 index 1682bacbc..000000000 --- a/base/migrate/TxtTo71/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CS Version> ldif -REM text file (e. g. - created via a <Source CS Version>ToTxt -REM script) into a CS 7.1 ldif data file. -REM -REM This CS 7.1 ldif data file can then be imported into the -REM internal database of the desired CS 7.1 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cs71 - - -REM -REM INSTANCE - if the CS instance directory is called 'cert-ca', -REM set the CS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CS% ldif data file -REM into a normalized %CS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo71/run.sh b/base/migrate/TxtTo71/run.sh deleted file mode 100755 index 04e8d4587..000000000 --- a/base/migrate/TxtTo71/run.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CS Version> ldif ### -### text file (e. g. - created via a <Source CS Version>ToTxt ### -### script) into a CS 7.1 ldif data file. ### -### ### -### This CS 7.1 ldif data file can then be imported into ### -### the internal database of the desired CS 7.1 server ### -### using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cs71 -#export SERVER_ROOT - - -### -### INSTANCE - if the CS instance directory is called 'cert-ca', -### set the CS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.1" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${SERVER_ROOT}/bin/cert/jre/lib:${SERVER_ROOT}/bin/cert/jre/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Convert the specified ${CS} ldif data file -### into a normalized ${CS} ldif text file. -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -${SERVER_ROOT}/bin/cert/jre/bin/java -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar:${SERVER_ROOT}/bin/cert/jre/lib/rt.jar Main $1 $2 - diff --git a/base/migrate/TxtTo71/src/Main.java b/base/migrate/TxtTo71/src/Main.java deleted file mode 100644 index a9421ebdc..000000000 --- a/base/migrate/TxtTo71/src/Main.java +++ /dev/null @@ -1,655 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo71/src/Main.java" is based upon a copy "TxtTo70/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.1" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo70/src/Main.java TxtTo71/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS71LdifParser parser = null; - if (args.length == 1) { - parser = new CMS71LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS71LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS71LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS71LdifParser(String filename) - { - mFilename = filename; - } - - public CMS71LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") - || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock obj = - (com.netscape.cmscore.base.ArgBlock)table.get(name); - if (obj == null) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - obj = new com.netscape.cmscore.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions(); - obj.decodeEx(new ByteArrayInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateExtensions" - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName(new DerInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateSubjectName" - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.util.Locale")) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - table.put(name, Locale.getDefault()); - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.cmscore.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo[") - || type.startsWith("netscape.security.extensions.CertInfo[")) { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.cmscore.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.cmscore.kra.ProofOfArchival obj = - new com.netscape.cmscore.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo71/src/compile.bat b/base/migrate/TxtTo71/src/compile.bat deleted file mode 100755 index d0a1be0b2..000000000 --- a/base/migrate/TxtTo71/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo71/classes/Main.class", -REM "TxtTo71/classes/CMS71LdifParser.class", and -REM "TxtTo71/classes/DummyAuthManager.class" which are -REM used to create a CS 7.1 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CS <server_root> used to compile TxtTo71 -REM - -REM SET SERVER_ROOT=C:\cs71 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CS -REM -REM CS 7.1 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CS_7.1 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo71 - create "CMS71LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo71/src/compile.sh b/base/migrate/TxtTo71/src/compile.sh deleted file mode 100755 index 397912a3f..000000000 --- a/base/migrate/TxtTo71/src/compile.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo71/classes/Main.class", ### -### "TxtTo71/classes/CMS71LdifParser.class", and ### -### "TxtTo71/classes/DummyAuthManager.class" which are ### -### used to create a CS 7.1 ldif data file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CS <server_root> used to compile TxtTo71 -### - -#SERVER_ROOT=/export/home/migrate/cs71 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CS -### -### CS 7.1 NOTE: "HP-UX" - 1.4.0.00 -### "Linux" - 1.4.2 -### "SunOS" - 1.4.2 -### - -#JDK_VERSION=CS_7.1 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.1" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=${SERVER_ROOT}/bin/cert/lib:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo71 - create "CMS71LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jars/nsutil.jar:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/cmscore.jar:${SERVER_ROOT}/bin/cert/jars/jss3.jar Main.java - diff --git a/base/migrate/TxtTo72/classes/CMS72LdifParser.class b/base/migrate/TxtTo72/classes/CMS72LdifParser.class Binary files differdeleted file mode 100644 index c3b8d5643..000000000 --- a/base/migrate/TxtTo72/classes/CMS72LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo72/classes/DummyAuthManager.class b/base/migrate/TxtTo72/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index 323081a39..000000000 --- a/base/migrate/TxtTo72/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo72/classes/Main.class b/base/migrate/TxtTo72/classes/Main.class Binary files differdeleted file mode 100644 index 2512afa7d..000000000 --- a/base/migrate/TxtTo72/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo72/run.bat b/base/migrate/TxtTo72/run.bat deleted file mode 100755 index 852158747..000000000 --- a/base/migrate/TxtTo72/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CS Version> ldif -REM text file (e. g. - created via a <Source CS Version>ToTxt -REM script) into a CS 7.2 ldif data file. -REM -REM This CS 7.2 ldif data file can then be imported into the -REM internal database of the desired CS 7.2 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cs72 - - -REM -REM INSTANCE - if the CS instance directory is called 'cert-ca', -REM set the CS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CS% ldif data file -REM into a normalized %CS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo72/run.sh b/base/migrate/TxtTo72/run.sh deleted file mode 100755 index 972686e3b..000000000 --- a/base/migrate/TxtTo72/run.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CS Version> ldif ### -### text file (e. g. - created via a <Source CS Version>ToTxt ### -### script) into a CS 7.2 ldif data file. ### -### ### -### This CS 7.2 ldif data file can then be imported into ### -### the internal database of the desired CS 7.2 server ### -### using a utility such as ldif2db. ### -### ### -##################################################################### - -### -### Java Runtime Environment -### -JRE_ROOT=/usr/lib/jvm/jre-1.5.0 -export JRE_ROOT - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.2" -export CS - -OS_NAME=`uname` -export OS_NAME - -ARCH=`uname -i` -export ARCH - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - -### -### Setup the appropriate library path environment variable -### based upon the platform -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -CLASSPATH=/usr/share/rhpki/migrate/TxtTo72/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar -export CLASSPATH - -if [ ${OS_NAME} = "Linux" ] ; then - if [ ${ARCH} = "i386" ] ; then - LD_LIBRARY_PATH=/usr/lib/dirsec:/usr/lib:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - else # x86_64 - LD_LIBRARY_PATH=/usr/lib64/dirsec:/usr/lib64:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/TxtTo72/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib64/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH - fi -else # SunOS 64-bits - LD_LIBRARY_PATH=/usr/lib/sparcv9/dirsec:/usr/lib/sparcv9:${JRE_ROOT}/lib:${JRE_ROOT}/lib/sparc/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/TxtTo72/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/sparcv9/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH -fi - - -### -### Convert the specified ${CS} ldif data file -### into a normalized ${CS} ldif text file. -### - -${JRE_ROOT}/bin/java -classpath ${CLASSPATH} Main $1 $2 diff --git a/base/migrate/TxtTo72/src/Main.java b/base/migrate/TxtTo72/src/Main.java deleted file mode 100644 index 002485055..000000000 --- a/base/migrate/TxtTo72/src/Main.java +++ /dev/null @@ -1,659 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo71/src/Main.java" is based upon a copy "TxtTo70/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.1" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo70/src/Main.java TxtTo71/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS72LdifParser parser = null; - if (args.length == 1) { - parser = new CMS72LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS72LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS72LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS72LdifParser(String filename) - { - mFilename = filename; - } - - public CMS72LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") - || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock obj = - (com.netscape.cmscore.base.ArgBlock)table.get(name); - if (obj == null) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - obj = new com.netscape.cmscore.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions(); - obj.decodeEx(new ByteArrayInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateExtensions" - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName(new DerInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateSubjectName" - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("org.mozilla.jss.asn1.INTEGER")) { - // CMS 7.1 stores bodyPartId as INTEGER - // CS 72. fixed the problem by storing it as String - table.put(name, value); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.util.Locale")) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - table.put(name, Locale.getDefault()); - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.certsrv.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo[") - || type.startsWith("netscape.security.extensions.CertInfo[")) { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.certsrv.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.certsrv.kra.ProofOfArchival obj = - new com.netscape.certsrv.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo72/src/compile.bat b/base/migrate/TxtTo72/src/compile.bat deleted file mode 100755 index 2c50e988e..000000000 --- a/base/migrate/TxtTo72/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo72/classes/Main.class", -REM "TxtTo72/classes/CMS72LdifParser.class", and -REM "TxtTo72/classes/DummyAuthManager.class" which are -REM used to create a CS 7.2 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CS <server_root> used to compile TxtTo72 -REM - -REM SET SERVER_ROOT=C:\cs72 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CS -REM -REM CS 7.2 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CS_7.2 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.2" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo72 - create "CMS72LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo72/src/compile.sh b/base/migrate/TxtTo72/src/compile.sh deleted file mode 100755 index ec0b466ba..000000000 --- a/base/migrate/TxtTo72/src/compile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo72/classes/Main.class", ### -### "TxtTo72/classes/CMS72LdifParser.class", and ### -### "TxtTo72/classes/DummyAuthManager.class" which are ### -### used to create a CS 7.2 ldif data file. ### -### ### -##################################################################### - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -#JDK_PLATFORM=Linux -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CS -### -### CS 7.2 NOTE: "Linux" - 1.5.0 (IBM) -### "SunOS" - 1.5.0 -### - -#JDK_VERSION=CS_7.2.0 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.2" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo72 - create "CMS72LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:/usr/share/java/rhpki/nsutil.jar:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/lib/java/rhpki/ca/ca.jar:/usr/lib/java/rhpki/tks/tks.jar:/usr/lib/java/rhpki/ocsp/ocsp.jar:/usr/lib/java/rhpki/kra/kra.jar:/usr/lib/java/dirsec/jss4.jar Main.java - diff --git a/base/migrate/TxtTo73/classes/CMS73LdifParser.class b/base/migrate/TxtTo73/classes/CMS73LdifParser.class Binary files differdeleted file mode 100644 index 03a09612d..000000000 --- a/base/migrate/TxtTo73/classes/CMS73LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo73/classes/DummyAuthManager.class b/base/migrate/TxtTo73/classes/DummyAuthManager.class Binary files differdeleted file mode 100644 index 323081a39..000000000 --- a/base/migrate/TxtTo73/classes/DummyAuthManager.class +++ /dev/null diff --git a/base/migrate/TxtTo73/classes/Main.class b/base/migrate/TxtTo73/classes/Main.class Binary files differdeleted file mode 100644 index 6609674ae..000000000 --- a/base/migrate/TxtTo73/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo73/run.bat b/base/migrate/TxtTo73/run.bat deleted file mode 100755 index 9e3898a47..000000000 --- a/base/migrate/TxtTo73/run.bat +++ /dev/null @@ -1,186 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a normalized <Source CS Version> ldif -REM text file (e. g. - created via a <Source CS Version>ToTxt -REM script) into a CS 7.3 ldif data file. -REM -REM This CS 7.3 ldif data file can then be imported into the -REM internal database of the desired CS 7.3 server using a -REM utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cs73 - - -REM -REM INSTANCE - if the CS instance directory is called 'cert-ca', -REM set the CS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.3" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%SERVER_ROOT%\bin\cert\jre\bin;%SERVER_ROOT\bin\cert\jre\bin\server;%PATH% - - -REM -REM Convert the specified %CS% ldif data file -REM into a normalized %CS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\jre\bin\java.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar;%SERVER_ROOT%\bin\cert\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo73/run.sh b/base/migrate/TxtTo73/run.sh deleted file mode 100755 index 52469acca..000000000 --- a/base/migrate/TxtTo73/run.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CS Version> ldif ### -### text file (e. g. - created via a <Source CS Version>ToTxt ### -### script) into a CS 7.3 ldif data file. ### -### ### -### This CS 7.3 ldif data file can then be imported into ### -### the internal database of the desired CS 7.3 server ### -### using a utility such as ldif2db. ### -### ### -##################################################################### - -### -### Java Runtime Environment -### -JRE_ROOT=/usr/lib/jvm/jre-1.5.0 -export JRE_ROOT - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.3" -export CS - -OS_NAME=`uname` -export OS_NAME - -ARCH=`uname -i` -export ARCH - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - -### -### Setup the appropriate library path environment variable -### based upon the platform -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -CLASSPATH=/usr/share/rhpki/migrate/TxtTo73/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar -export CLASSPATH - -if [ ${OS_NAME} = "Linux" ] ; then - if [ ${ARCH} = "i386" ] ; then - LD_LIBRARY_PATH=/usr/lib/dirsec:/usr/lib:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - else # x86_64 - LD_LIBRARY_PATH=/usr/lib64/dirsec:/usr/lib64:${JRE_ROOT}/lib:${JRE_ROOT}/lib/i386/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/TxtTo73/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib64/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH - fi -else # SunOS 64-bits - LD_LIBRARY_PATH=/usr/lib/sparcv9/dirsec:/usr/lib/sparcv9:${JRE_ROOT}/lib:${JRE_ROOT}/lib/sparc/native_threads - export LD_LIBRARY_PATH - CLASSPATH=/usr/share/rhpki/migrate/TxtTo73/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/sparcv9/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar - export CLASSPATH -fi - - -### -### Convert the specified ${CS} ldif data file -### into a normalized ${CS} ldif text file. -### - -${JRE_ROOT}/bin/java -classpath ${CLASSPATH} Main $1 $2 diff --git a/base/migrate/TxtTo73/src/Main.java b/base/migrate/TxtTo73/src/Main.java deleted file mode 100644 index 6272b33a4..000000000 --- a/base/migrate/TxtTo73/src/Main.java +++ /dev/null @@ -1,659 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo71/src/Main.java" is based upon a copy "TxtTo70/src/Main.java". -// -// Always comment any new code sections with a "CMS 7.1" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo70/src/Main.java TxtTo71/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import sun.misc.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS73LdifParser parser = null; - if (args.length == 1) { - parser = new CMS73LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS73LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS73LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = - "requestAttributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS73LdifParser(String filename) - { - mFilename = filename; - } - - public CMS73LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // begining of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - private byte[] encode(Object value) throws Exception - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - - os.writeObject(value); - os.close(); - return bos.toByteArray(); - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - Hashtable hashtable = new Hashtable(); - for (int i = 0; i < attrs.size(); i++) { - String attr = (String)attrs.elementAt(i); - buildHashtable(dn, hashtable, attr); - } - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bos); - Enumeration e = hashtable.keys(); - while (e.hasMoreElements()) { - String key = (String)e.nextElement(); - Object value = hashtable.get(key); - - try { - byte data[] = null; - data = encode(value); - os.writeObject(key); - os.writeObject(data); - } catch (Exception ex) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } // while - os.writeObject(null); - os.close(); - - // print the BASE64 encoding of the Hashtable - BASE64Encoder encoder = new BASE64Encoder(); - String attrsStr = encoder.encodeBuffer(bos.toByteArray()); - // trim the last "\n" - StringBuffer buffer = null; - attrsStr = attrsStr.trim(); - StringTokenizer st = new StringTokenizer(attrsStr, "\r\n"); - while (st.hasMoreTokens()) { - if (buffer == null) { - buffer = new StringBuffer(); - buffer.append(st.nextToken()); - } else { - buffer.append("\r\n " + st.nextToken()); - } - } - - System.out.println(REQUEST_ATTRIBUTES + " " + buffer); - } - - public void buildHashtable(String dn, Hashtable table, String attr) - throws Exception - { - // attribute format [name]:[type]=[value] - - int colon = attr.indexOf(':'); - if (colon == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - int equal = attr.indexOf('='); - if (equal == -1) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - String name = null; - String type = null; - String value = null; - try { - name = attr.substring(0, colon); - type = attr.substring(colon+1, equal); - value = attr.substring(equal+1); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - if (name.startsWith("serviceErrors")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - if (name.startsWith("Error")) { - // #56953 - skip serviceErrors - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + attr); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") - || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - com.netscape.cmscore.base.ArgBlock obj = - (com.netscape.cmscore.base.ArgBlock)table.get(name); - if (obj == null) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - obj = new com.netscape.cmscore.base.ArgBlock(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { - com.netscape.certsrv.authentication.AuthToken obj = - (com.netscape.certsrv.authentication.AuthToken)table.get(name); - if (obj == null) { - com.netscape.certsrv.authentication.IAuthManager mgr = - new DummyAuthManager(); - obj = new com.netscape.certsrv.authentication.AuthToken(mgr); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else { - System.err.println("ERROR AuthToken type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.math.BigInteger[")) { - // Bugzilla Bug #238779 - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); - if (objs == null) { - objs = new java.math.BigInteger[size]; - table.put(name, objs); - } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("byte[")) { - // byte array - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateExtensions")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateExtensions obj = - new netscape.security.x509.CertificateExtensions(); - obj.decodeEx(new ByteArrayInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateExtensions" - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateSubjectName obj = - new netscape.security.x509.CertificateSubjectName(new DerInputStream(decoder.decodeBuffer(value))); - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateSubjectName" - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - java.util.Hashtable obj = (java.util.Hashtable)table.get(name); - if (obj == null) { - obj = new java.util.Hashtable(); - table.put(name, obj); - } - BASE64Decoder decoder = new BASE64Decoder(); - String valuekey = value.substring(0, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - obj.put(valuekey, decoder.decodeBuffer(valuevalue)); - } else if (type.startsWith("Integer[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); - if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); - } - objs[index] = new Integer(value); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("org.mozilla.jss.asn1.INTEGER")) { - // CMS 7.1 stores bodyPartId as INTEGER - // CS 72. fixed the problem by storing it as String - table.put(name, value); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") - || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { - com.netscape.cmscore.dbs.KeyRecord obj = - (com.netscape.cmscore.dbs.KeyRecord)table.get(name); - if (obj == null) { - obj = new com.netscape.cmscore.dbs.KeyRecord(); - table.put(name, obj); - } - String valuekey = value.substring(0, value.indexOf(':')); - String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); - String valuevalue = value.substring(value.indexOf('=')+1); - if (valuetype.equals("java.lang.String")) { - obj.set(valuekey, valuevalue); - } else if (valuetype.equals("java.util.Date")) { - obj.set(valuekey, new Date(Long.parseLong(valuevalue))); - } else if (valuetype.equals("java.math.BigInteger")) { - obj.set(valuekey, new java.math.BigInteger(valuevalue)); - } else if (valuetype.equals("java.lang.Integer")) { - obj.set(valuekey, new Integer(valuevalue)); - } else if (valuetype.equals("com.netscape.certsrv.dbs.keydb.KeyState")) { - obj.set(valuekey, com.netscape.certsrv.dbs.keydb.KeyState.toKeyState(valuevalue)); - } else if (valuetype.equals("[B")) { - // byte array - - BASE64Decoder decoder = new BASE64Decoder(); - obj.set(valuekey, decoder.decodeBuffer(valuevalue)); - } else { - System.err.println("ERROR KeyRecord type - " + attr); - System.exit(0); - } - } else if (type.startsWith("java.util.Locale")) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - table.put(name, Locale.getDefault()); - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") - || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { - BASE64Decoder decoder = new BASE64Decoder(); - - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - com.netscape.certsrv.kra.ProofOfArchival obj = - buildPOA(decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.String[")) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.lang.String objs[] = (java.lang.String[])table.get(name); - if (objs == null) { - objs = new java.lang.String[size]; - table.put(name, objs); - } - objs[index] = new java.lang.String(value); - } else if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); - if (obj == null) { - obj = new Vector(); - table.put(name, obj); - } - obj.addElement(value); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertInfo[") - || type.startsWith("netscape.security.extensions.CertInfo[")) { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); - table.put(name, obj); - } else if( type.endsWith( "Exception" ) ) { - Class[] argClass = { String.class }; // the argument's class - Object[] argValue = { value }; // the argument's value - - Class x = Class.forName( type ); - Constructor ctr = x.getConstructor( argClass ); - Exception e = ( Exception ) ctr.newInstance( argValue ); - } else { - System.err.println("ERROR type - " + type + " - "+ attr); - System.exit(0); - } - } - - public com.netscape.certsrv.kra.ProofOfArchival buildPOA(byte data[]) - throws Exception - { - DerInputStream dis = new DerInputStream(data); - DerValue seq[] = dis.getSequence(0); - - BigInteger mSerialNo = seq[0].getInteger().toBigInteger(); - - // subject - DerValue subject = seq[1]; - netscape.security.x509.X500Name mSubject = - new netscape.security.x509.X500Name(subject.toByteArray()); - - // issuer - DerValue issuer = seq[2]; - netscape.security.x509.X500Name mIssuer = - new netscape.security.x509.X500Name(issuer.toByteArray()); - - // date of archival - DerInputStream dateOfArchival = new DerInputStream(seq[3].toByteArray()); - Date mDateOfArchival = dateOfArchival.getUTCTime(); - com.netscape.certsrv.kra.ProofOfArchival obj = - new com.netscape.certsrv.kra.ProofOfArchival(mSerialNo, - mSubject.toString(), mIssuer.toString(), mDateOfArchival); - return obj; - } -} - -class DummyAuthManager implements com.netscape.certsrv.authentication.IAuthManager -{ - public String getName() - { - return "dummy"; - } - - public String getImplName() - { - return "dummy"; - } - - public IAuthToken authenticate(IAuthCredentials authCred) - throws EMissingCredential, EInvalidCredentials, EBaseException - { - return null; - } - - /** - * Initialize this authentication manager. - * @param name The name of this authentication manager instance. - * @param implName The name of the authentication manager plugin. - * @param config The configuration store for this authentication manager. - * @exception EBaseException If an initialization error occurred. - */ - public void init(String name, String implName, IConfigStore config) - throws EBaseException - { - } - - public void shutdown() - { - } - - public String[] getRequiredCreds() - { - return null; - } - - /** - * Get configuration parameters for this implementation. - * The configuration parameters returned is passed to the - * configuration console so configuration for instances of this - * implementation can be made through the console. - * - * @param implName The authentication manager plugin name. - * @exception EBaseException If an internal error occurred - */ - public String[] getConfigParams() - throws EBaseException - { - return null; - } - - /** - * Get the configuration store for this authentication manager. - * @return The configuration store of this authentication manager. - */ - public IConfigStore getConfigStore() - { - return null; - } -} - diff --git a/base/migrate/TxtTo73/src/compile.bat b/base/migrate/TxtTo73/src/compile.bat deleted file mode 100755 index db46fa019..000000000 --- a/base/migrate/TxtTo73/src/compile.bat +++ /dev/null @@ -1,152 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "TxtTo73/classes/Main.class", -REM "TxtTo73/classes/CMS73LdifParser.class", and -REM "TxtTo73/classes/DummyAuthManager.class" which are -REM used to create a CS 7.3 ldif data file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CS <server_root> used to compile TxtTo73 -REM - -REM SET SERVER_ROOT=C:\cs73 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CS -REM -REM CS 7.3 NOTE: "WINNT" - 1.4.2 -REM - -REM SET JDK_VERSION=CS_7.3 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CS="CS 7.3" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO %CS% ldif data classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\cert\lib;%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile TxtTo73 - create "CMS73LdifParser.class", "DummyAuthManager.class", -REM and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\jre\lib\rt.jar;%SERVER_ROOT%\bin\cert\jars\nsutil.jar;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\cmscore.jar;%SERVER_ROOT%\bin\cert\jars\jss3.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/base/migrate/TxtTo73/src/compile.sh b/base/migrate/TxtTo73/src/compile.sh deleted file mode 100755 index a8230e673..000000000 --- a/base/migrate/TxtTo73/src/compile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "TxtTo73/classes/Main.class", ### -### "TxtTo73/classes/CMS73LdifParser.class", and ### -### "TxtTo73/classes/DummyAuthManager.class" which are ### -### used to create a CS 7.3 ldif data file. ### -### ### -##################################################################### - - -### -### Set JDK_PLATFORM - must be "HP-UX", "Linux", or "SunOS" -### - -JDK_PLATFORM=Linux -export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CS -### -### CS 7.3 NOTE: "Linux" - 1.5.0 (IBM) -### "SunOS" - 1.5.0 -### - -JDK_VERSION=PKI_7.3.0 -export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CS="CS 7.3" -export CS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " ${CS} ldif data classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform -### - -if [ ${OS_NAME} = "HP-UX" ] ; then - SHLIB_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/PA_RISC/native_threads - export SHLIB_PATH -elif [ ${OS_NAME} = "Linux" ] ; then - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads - export LD_LIBRARY_PATH -else # SunOS - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo73 - create "CMS73LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:/usr/share/java/rhpki/nsutil.jar:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/lib/java/rhpki/ca/ca.jar:/usr/lib/java/rhpki/tks/tks.jar:/usr/lib/java/rhpki/ocsp/ocsp.jar:/usr/lib/java/rhpki/kra/kra.jar:/usr/lib/java/dirsec/jss4.jar Main.java - diff --git a/base/migrate/TxtTo80/classes/CS80LdifParser.class b/base/migrate/TxtTo80/classes/CS80LdifParser.class Binary files differdeleted file mode 100644 index 1265fd153..000000000 --- a/base/migrate/TxtTo80/classes/CS80LdifParser.class +++ /dev/null diff --git a/base/migrate/TxtTo80/classes/Main.class b/base/migrate/TxtTo80/classes/Main.class Binary files differdeleted file mode 100644 index 0f162327d..000000000 --- a/base/migrate/TxtTo80/classes/Main.class +++ /dev/null diff --git a/base/migrate/TxtTo80/run.sh b/base/migrate/TxtTo80/run.sh deleted file mode 100755 index 6dde55758..000000000 --- a/base/migrate/TxtTo80/run.sh +++ /dev/null @@ -1,394 +0,0 @@ -#!/bin/sh - -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2009 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a normalized <Source CS Version> ldif ### -### text file (e. g. - created via a <Source CS Version>ToTxt ### -### script) into a CS 8.0 ldif data file. ### -### ### -### This CS 8.0 ldif data file can then be imported into ### -### the internal database of the desired CS 8.0 server ### -### using a utility such as ldif2db. ### -### ### -##################################################################### - -### -### Provide a usage function -### - -usage() { - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - a "normalized" CS ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the CS 8.0 ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the CS 8.0 ldif text" - echo " file will merely be echoed to stdout." - echo - exit 255 -} - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - usage -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - usage -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - usage -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - usage - fi -fi - - -### -### Set PKI_OS -### -### CS 8.0 NOTE: "Linux" -### "SunOS" -### - -PKI_OS=`uname` -export PKI_OS - -if [ "${PKI_OS}" != "Linux" ] && - [ "${PKI_OS}" != "SunOS" ]; then - printf "This '$0' script is ONLY executable\n" - printf "on either a 'Linux' or 'Solaris' machine!\n" - exit 255 -fi - - -### -### Set PKI_ARCHITECTURE -### -### CS 8.0 NOTE: "Linux i386" - 32-bit ("i386") -### "Linux x86_64" - 64-bit ("x86_64") -### "SunOS sparc" - 64-bit ("sparcv9") -### - -if [ "${PKI_OS}" == "Linux" ]; then - PKI_PLATFORM=`uname -i` - export PKI_PLATFORM - if [ "${PKI_PLATFORM}" == "i386" ] || - [ "${PKI_PLATFORM}" == "x86_64" ]; then - PKI_ARCHITECTURE="${PKI_PLATFORM}" - export PKI_ARCHITECTURE - else - printf "On 'Linux', this '$0' script is ONLY executable\n" - printf "on either an 'i386' or 'x86_64' architecture!\n" - exit 255 - fi -elif [ "${PKI_OS}" == "SunOS" ]; then - PKI_PLATFORM=`uname -p` - export PKI_PLATFORM - if [ "${PKI_PLATFORM}" == "sparc" ]; then - PKI_ARCHITECTURE="sparcv9" - export PKI_ARCHITECTURE - else - printf "On 'Solaris', this '$0' script is ONLY executable\n" - printf "on a 'sparcv9' architecture!\n" - exit 255 - fi -fi - - -### -### Set PKI_OS_DISTRIBUTION -### -### CS 8.0 NOTE: "Linux Fedora 8" - "Fedora" -### "Linux Fedora 9" - "Fedora" -### "Linux Fedora 10" - "Fedora" -### "Linux RHEL 5" - "Red Hat" -### "SunOS 5.9" - "Solaris" -### - -if [ "${PKI_OS}" == "Linux" ]; then - IS_FEDORA=`test -e /etc/fedora-release && echo 1 || echo 0` - if [ "${IS_FEDORA}" -eq 1 ]; then - PKI_DISTRIBUTION="Fedora" - export PKI_DISTRIBUTION - PKI_OS_RPM_VERSION=`rpm -qf --qf='%{VERSION}' /etc/fedora-release` - export PKI_OS_RPM_VERSION - PKI_OS_VERSION=`echo "${PKI_OS_RPM_VERSION}" | tr -d [A-Za-z]` - export PKI_OS_VERSION - else - IS_REDHAT=`test -e /etc/redhat-release && echo 1 || echo 0` - if [ "${IS_REDHAT}" -eq 1 ]; then - PKI_DISTRIBUTION="Red Hat" - export PKI_DISTRIBUTION - PKI_OS_RPM_VERSION=`rpm -qf --qf='%{VERSION}' /etc/redhat-release` - export PKI_OS_RPM_VERSION - PKI_OS_VERSION=`echo "${PKI_OS_RPM_VERSION}" | tr -d [A-Za-z]` - export PKI_OS_VERSION - else - printf "On 'Linux',this '$0' script is ONLY executable\n" - printf "on either a 'Fedora' or 'Red Hat' machine!\n" - exit 255 - fi - fi -elif [ "${PKI_OS}" == "SunOS" ]; then - PKI_DISTRIBUTION="Solaris" - export PKI_DISTRIBUTION - PKI_OS_VERSION=`uname -r | awk -F. '{print $2}'` - export PKI_OS_VERSION -fi - - -### -### Set JAVA_HOME -### -### CS 8.0 NOTE: "Linux Fedora 8" - JRE 1.7.0 (IcedTea) -### "Linux Fedora 9" - JRE 1.6.0 (OpenJDK) -### "Linux Fedora 10" - JRE 1.6.0 (OpenJDK) -### "Linux RHEL 5" - JRE 1.6.0 (OpenJDK) -### "SunOS 5.9" - JRE 1.6.0 (Sun JDK) -### -### "Linux" - ALWAYS set specific JAVA_HOME -### "SunOS" - ALLOW JAVA_HOME to be pre-defined -### - -if [ "${PKI_OS}" == "Linux" ]; then - if [ "${PKI_DISTRIBUTION}" == "Fedora" ]; then - if [ ${PKI_OS_VERSION} -eq 8 ]; then - if [ "${PKI_ARCHITECTURE}" == "i386" ]; then - JAVA_HOME="/usr/lib/jvm/jre-1.7.0-icedtea" - JAVA_ARCHITECTURE="i386" - else # "x86_64" - JAVA_HOME="/usr/lib/jvm/jre-1.7.0-icedtea.${PKI_ARCHITECTURE}" - JAVA_ARCHITECTURE="amd64" - fi - if [ ! -x "${JAVA_HOME}/bin/java" ] && - [ ! -f "${JAVA_HOME}/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}/native_threads" ]; then - printf "On 'Fedora 8', this '$0' script is ONLY executable\n" - printf "by 'JRE 1.7.0 (IcedTea)'!\n" - exit 255 - fi - elif [ ${PKI_OS_VERSION} -gt 8 ]; then - if [ "${PKI_ARCHITECTURE}" == "i386" ]; then - JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk" - JAVA_ARCHITECTURE="i386" - else # "x86_64" - JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk.${PKI_ARCHITECTURE}" - JAVA_ARCHITECTURE="amd64" - fi - if [ ! -x "${JAVA_HOME}/bin/java" ] && - [ ! -f "${JAVA_HOME}/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}/native_threads" ]; then - printf "On 'Fedora ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JRE 1.6.0 (OpenJDK)'!\n" - exit 255 - fi - else - printf "On 'Fedora', this '$0' script is ONLY executable\n" - printf "on 'Fedora 8' or later!\n" - exit 255 - fi - elif [ "${PKI_DISTRIBUTION}" == "Red Hat" ]; then - if [ ${PKI_OS_VERSION} -ge 5 ]; then - if [ "${PKI_ARCHITECTURE}" == "i386" ]; then - JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk" - JAVA_ARCHITECTURE="i386" - else # "x86_64" - JAVA_HOME="/usr/lib/jvm/jre-1.6.0-openjdk.${PKI_ARCHITECTURE}" - JAVA_ARCHITECTURE="amd64" - fi - if [ ! -x "${JAVA_HOME}/bin/java" ] && - [ ! -f "${JAVA_HOME}/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}/native_threads" ]; then - printf "On 'RHEL ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JRE 1.6.0 (OpenJDK)'!\n" - exit 255 - fi - else - printf "On 'Red Hat', this '$0' script is ONLY executable\n" - printf "on 'RHEL 5' or later!\n" - exit 255 - fi - fi - JRE_EXE="${JAVA_HOME}/bin/java" - export JRE_EXE - JRE_VERSION=`${JAVA_HOME}/bin/java -version 2>&1 | cut -b15-19 | sed -n '/[0-9]\.[0-9]\.[0-9]/p'` - export JRE_VERSION -elif [ "${PKI_OS}" == "SunOS" ]; then - if [ "${JAVA_HOME}" == "" ]; then - JAVA_HOME="/usr/java" - fi - JRE_EXE="${JAVA_HOME}/bin/${PKI_ARCHITECTURE}/java" - export JRE_EXE - JRE_VERSION=`${JAVA_HOME}/bin/${PKI_ARCHITECTURE}/java -version 2>&1 | cut -b15-19 | sed -n '/[0-9]\.[0-9]\.[0-9]/p'` - export JRE_VERSION - if [ ${PKI_OS_VERSION} -eq 9 ]; then - if [ "${JRE_VERSION}" != "1.6.0" ]; then - printf "On 'Solaris ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JRE 1.6.0'!\n" - exit 255 - fi - if [ ! -x "${JAVA_HOME}/bin/${PKI_ARCHITECTURE}/java" ] && - [ ! -f "${JAVA_HOME}/jre/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}/native_threads" ]; then - printf "On 'Solaris ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JRE 1.6.0 (Sun JDK)'!\n" - exit 255 - fi - else - printf "On 'Solaris', this '$0' script is ONLY executable\n" - printf "on 'Solaris 9'!\n" - exit 255 - fi -fi - - -### -### Setup the appropriate CLASSPATH and LD_LIBRARY_PATH -### environment variables based upon the platform -### -### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes -### have been moved from "i18n.jar" to "rt.jar". -### - -if [ ! -f "/usr/share/java/pki/cmscore.jar" ] && - [ ! -f "/usr/share/java/pki/certsrv.jar" ]; then - printf "This '$0' script must be EXECUTED against\n" - printf "the 'pki-common' package!\n" - exit 255 -fi -if [ ! -f "/usr/share/java/pki/nsutil.jar" ]; then - printf "This '$0' script must be EXECUTED against\n" - printf "the 'pki-util' package!\n" - exit 255 -fi -if [ ! -d "/usr/share/pki/migrate/TxtTo80/classes" ]; then - printf "This '$0' script must be EXECUTED against\n" - printf "the 'pki-migrate' package!\n" - exit 255 -fi - -if [ ${PKI_OS} = "Linux" ] ; then - if [ ! -f "/usr/lib/java/jss4.jar" ]; then - printf "This '$0' script must be EXECUTED against\n" - printf "the 'jss' package!\n" - exit 255 - fi - CLASSPATH=${JAVA_HOME}/lib/rt.jar - CLASSPATH=/usr/lib/java/jss4.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/nsutil.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/cmscore.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/certsrv.jar:${CLASSPATH} - CLASSPATH=/usr/share/pki/migrate/TxtTo80/classes:${CLASSPATH} - export CLASSPATH - if [ ${PKI_ARCHITECTURE} = "i386" ] ; then - LD_LIBRARY_PATH=${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}/native_threads - LD_LIBRARY_PATH=${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} - export LD_LIBRARY_PATH - else # "x86_64" - LD_LIBRARY_PATH=${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}/native_threads - LD_LIBRARY_PATH=${JAVA_HOME}/lib/${JAVA_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH} - export LD_LIBRARY_PATH - fi -else # "SunOS" - if [ ! -f "/usr/lib/java/dirsec/jss4.jar" ]; then - printf "This '$0' script must be EXECUTED against\n" - printf "the 'dirsec-jss' package!\n" - exit 255 - fi - CLASSPATH=${JAVA_HOME}/jre/lib/rt.jar - CLASSPATH=/usr/lib/java/dirsec/jss4.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/nsutil.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/cmscore.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/certsrv.jar:${CLASSPATH} - CLASSPATH=/usr/share/pki/migrate/TxtTo80/classes:${CLASSPATH} - export CLASSPATH - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}/native_threads - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib/${PKI_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib/${PKI_ARCHITECTURE}/dirsec:${LD_LIBRARY_PATH} - export LD_LIBRARY_PATH -fi - - -### -### Execute TxtTo80 to convert the "normalized" CS ldif data file in to -### a CS 8.0 ldif text file suitable for import in to a CS 8.0 LDAP DB. -### - -# printf "================================================================\n" -# printf "PKI_OS='${PKI_OS}'\n" -# printf "PKI_DISTRIBUTION='${PKI_DISTRIBUTION}'\n" -# printf "PKI_OS_VERSION='${PKI_OS_VERSION}'\n" -# printf "PKI_ARCHITECTURE='${PKI_ARCHITECTURE}'\n" -# printf "JAVA_HOME='${JAVA_HOME}'\n" -# printf "JRE_EXE='${JRE_EXE}'\n" -# printf "JRE_VERSION='${JRE_VERSION}'\n" -# printf "================================================================\n\n" - -${JRE_EXE} -classpath ${CLASSPATH} Main $1 $2 - diff --git a/base/migrate/TxtTo80/src/Main.java b/base/migrate/TxtTo80/src/Main.java deleted file mode 100644 index 320ea8507..000000000 --- a/base/migrate/TxtTo80/src/Main.java +++ /dev/null @@ -1,593 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2009 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -// -// "TxtTo80/src/Main.java" is based upon a copy "TxtTo80/src/Main.java". -// -// Always comment any new code sections with a "CS 8.0" header, and -// apply these changes forward to all other "TxtTo*/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "TxtTo*" version. -// -// This file should always be maintained by executing the following command: -// -// diff TxtTo73/src/Main.java TxtTo80/src/Main.java -// - -import java.math.*; -import java.io.*; -import java.util.*; -import org.mozilla.jss.*; // CMS 4.5 and later -import org.mozilla.jss.crypto.*; // CMS 4.5 and later -import com.netscape.certsrv.base.*; -import com.netscape.certsrv.authentication.*; -import netscape.security.util.*; -import java.lang.reflect.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.5 and later - CryptoManager.initialize("."); - // load JSS provider in CMS 4.5 and later - java.security.Security.removeProvider("SUN version 1.2"); - // The following call to "java.security.Security.insertProviderAt()" - // is no longer commented out in CMS 4.5 and later - java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CS80LdifParser parser = null; - if (args.length == 1) { - parser = new CS80LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CS80LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CS80LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CS 8.0 and later use "extdata-" - private static final String extAttrPrefix = - "extdata-"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CS80LdifParser(String filename) - { - mFilename = filename; - } - - public CS80LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - Vector requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.equals(BEGIN)) { - requestAttributes = new Vector(); - continue; - } - if (requestAttributes == null) { - // Since we are not in the midst of a Request Attribute, - // simply print out the line. - System.out.println(line); - - // New in CS 8.0: - if( line.equals( "objectClass: request" ) ) { - // Since Request Objects now contain individual undefined - // schema attributes (rather than a single serialized blob), - // we disable schema checking to allow them to be stored as - // Multi-Value strings by adding an "extensibleObject" - // objectclass to each Request Object entry. - System.out.println( "objectClass: extensibleObject" ); - } - continue; - } - if (line.equals(END)) { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - continue; - } - if (line.startsWith(" ")) { // beginning of attr - requestAttributes.addElement( - line.substring(1, line.length())); - } else { - // #737216 - skip unnecessary empty lines in attributes - if (line.trim().length() == 0) continue; - requestAttributes.setElementAt( - (String) - requestAttributes.lastElement() + - "\n" + - line, - requestAttributes.size() - 1); - } - } - } - - public String getKey( String dn, String attr ) - { - String key = null; - - int colon = attr.indexOf( ':' ); - if (colon == -1) { - return key; - } - - int equal = attr.indexOf( '=' ); - if( equal == -1 ) { - return key; - } - - key = attr.substring( 0, colon ); - if( key.startsWith( "serviceErrors" ) ) { - // #56953 - skip serviceErrors - return key; - } - - if( key.startsWith( "Error" ) ) { - // #56953 - skip Error - return key; - } - - return key; - } - - public void parseAttributes(String dn, Vector attrs) throws Exception - { - for( int i = 0; i < attrs.size(); i++ ) { - String attr = ( String ) attrs.elementAt( i ); - try { - translateAttributes( dn, attr ); - } catch( Exception e ) { - if( mErrorPrintWriter != null ) { - mErrorPrintWriter.println( dn ); - } - String key = getKey( dn, attr ); - if( key != null ) { - mErrorPrintWriter.println( "Skipped " + key ); - } - } - } - } - - /*************************************************************************/ - /* The following two functions: */ - /* */ - /* protected boolean isAlphaNum(char in) {} */ - /* */ - /* public String encodeKey(String key) {} */ - /* */ - /* were copied from the private class called: */ - /* */ - /* class ExtAttrDynMapper implements IDBDynAttrMapper {} */ - /* */ - /* in the file called: */ - /* */ - /* pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java */ - /* */ - /*************************************************************************/ - - protected boolean isAlphaNum(char in) { - if ((in >= 'a') && (in <= 'z')) { - return true; - } - if ((in >= 'A') && (in <= 'Z')) { - return true; - } - if ((in >= '0') && (in <= '9')) { - return true; - } - return false; - } - - /** - * Encoded extdata keys for storage in LDAP. - * - * The rules for encoding are trickier than decoding. We want to allow - * '-' by itself to be stored in the database (for the common case of keys - * like 'Foo-Bar'. Therefore we are using '--' as the encoding character. - * The rules are: - * 1) All characters [^-a-zA-Z0-9] are encoded as --XXXX where XXXX is the - * hex representation of the digit. - * 2) [a-zA-Z0-9] are always passed through unencoded - * 3) [-] is passed through as long as it is preceded and followed - * by [a-zA-Z0-9] (or if it's at the beginning/end of the string) - * 4) If [-] is preceded or followed by [^a-zA-Z0-9] then - * the - as well as all following [^a-zA-Z0-9] characters are encoded - * as --XXXX. - * - * This routine tries to be as efficient as possible with StringBuffer and - * large copies. However, the encoding unfortunately requires several - * objects to be allocated. - * - * @param key The key to encode - * @return The encoded key - */ - public String encodeKey(String key) { - StringBuffer output = null; - char[] input = key.toCharArray(); - int startCopyIndex = 0; - - int index = 0; - while (index < input.length) { - if (! isAlphaNum(input[index])) { - if ((input[index] == '-') && - ((index + 1) < input.length) && - (isAlphaNum(input[index + 1]))) { - index += 2; - } else if ((input[index] == '-') && - ((index + 1) == input.length)) { - index += 1; - } else { - if (output == null) { - output = new StringBuffer(input.length + 5); - } - output.append(input, startCopyIndex, index - startCopyIndex); - while ( (index < input.length) && - (! isAlphaNum(input[index])) ) { - output.append("--"); - String hexString = Integer.toHexString(input[index]); - int padding = 4 - hexString.length(); - while (padding > 0) { - output.append('0'); - padding--; - } - output.append(hexString); - index++; - } - startCopyIndex = index; - } - } else { - index++; - } - } - - if (output == null) { - return key; - } else { - output.append(input, startCopyIndex, index - startCopyIndex); - return output.toString(); - } - } - - public String formatData( String data ) { - StringBuffer output = null; - char[] input = data.toCharArray(); - int startCopyIndex = 0; - - // Every string buffer has a capacity. As long as the length of the - // character sequence contained in the string buffer does not exceed - // the capacity, it is not necessary to allocate a new internal buffer - // array. If the internal buffer overflows, it is automatically made - // larger. - // - // Start out with an output buffer at least as big as the input buffer. - output = new StringBuffer( input.length ); - - int index = 0; - while( index < input.length ) { - if( input[index] != '\n' ) { - output.append( input[index] ); - } else { - output.append( input[index] ); - if( index != ( input.length - 1 ) ) { - // Place an initial space after each carriage return - // with the exception of the last one - output.append( ' ' ); - } - } - - index++; - } - - return( output.toString() ); - } - - public void translateAttributes( String dn, String attr ) - throws Exception - { - // attribute format [key]:[type]=[data] - - int colon = attr.indexOf( ':' ); - if( colon == -1 ) { - if( mErrorPrintWriter != null ) { - if( dn != null ) { - mErrorPrintWriter.println( dn ); - } - mErrorPrintWriter.println( "Skipped " + attr ); - } - return; - } - int equal = attr.indexOf( '=' ); - if( equal == -1 ) { - if( mErrorPrintWriter != null ) { - if( dn != null ) { - mErrorPrintWriter.println( dn ); - } - mErrorPrintWriter.println( "Skipped " + attr ); - } - return; - } - - String key = attr.substring( 0, colon ); - String type = attr.substring( colon + 1, equal ); - String data = attr.substring( equal + 1 ); - - if( key.startsWith( "serviceErrors" ) ) { - // #56953 - skip serviceErrors - if( mErrorPrintWriter != null ) { - if( dn != null ) { - mErrorPrintWriter.println( dn ); - } - mErrorPrintWriter.println( "Skipped " + attr ); - } - return; - } - - if( key.startsWith( "Error" ) ) { - // #56953 - skip serviceErrors - if( mErrorPrintWriter != null ) { - if( dn != null ) { - mErrorPrintWriter.println( dn ); - } - mErrorPrintWriter.println( "Skipped " + attr ); - } - return; - } - - // To account for '47ToTxt' data files that have previously - // been generated, ALWAYS convert 'iplanet' to 'netscape'. - // - // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) - // Bugzilla Bug #483519 - // - String translation = null; - if( type.startsWith( "iplanet" ) ) { - translation = "netscape" - + type.substring( 7 ); - type = translation; - } else if( type.startsWith( "com.iplanet" ) ) { - translation = "com.netscape" - + type.substring( 11 ); - type = translation; - } - - if( type.startsWith( "com.netscape.certsrv.request.AgentApprovals" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "com.netscape.certsrv.base.ArgBlock" ) - || type.startsWith( "com.netscape.cmscore.base.ArgBlock" ) ) { - // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and - // moved old "com.netscape.certsrv.base.ArgBlock" - // to "com.netscape.cmscore.base.ArgBlock" - - // Bugzilla Bug #737217 - adding proper "ext-data" array format - int secondEqual = data.indexOf('='); - if (secondEqual == -1) { - if( mErrorPrintWriter != null ) { - if( dn != null ) { - mErrorPrintWriter.println( dn ); - } - mErrorPrintWriter.println( "Skipped " + attr ); - } - return; - } - String subKey = data.substring( 0, secondEqual ); - String subKeyData = data.substring( secondEqual + 1 ); - System.out.println( extAttrPrefix + encodeKey( key ) + ";" + - subKey + ": " + formatData( subKeyData ) ); - } else if( type.startsWith( "com.netscape.certsrv.authentication.AuthToken" ) ) { - // Processes 'java.math.BigInteger[]': - // - // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) - // - // Processes 'java.lang.String[]': - // - // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - // - - // Bugzilla Bug #737217 - adding proper "ext-data" array format - int secondColon = data.indexOf(':'); - int secondEqual = data.indexOf('='); - if (secondEqual == -1 || secondColon >= secondEqual) { - if( mErrorPrintWriter != null ) { - if( dn != null ) { - mErrorPrintWriter.println( dn ); - } - mErrorPrintWriter.println( "Skipped " + attr ); - } - return; - } - if (secondColon == -1) { - secondColon = secondEqual; - } - String subKey = data.substring( 0, secondColon ); - String subKeyData = data.substring( secondEqual + 1 ); - System.out.println( extAttrPrefix + encodeKey( key ) + ";" + - subKey + ": " + formatData( subKeyData ) ); - } else if( type.startsWith( "java.math.BigInteger[" ) ) { - // Bugzilla Bug #238779 - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "java.math.BigInteger" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "byte[]" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "byte[" ) ) { - // byte array - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "netscape.security.x509.CertificateAlgorithmId" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.equals( "netscape.security.x509.CertificateChain" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.equals( "netscape.security.x509.CertificateExtensions" ) ) { - // XXX - "db2ldif" appears dumps these as ":" values, but they - // always appear as "::" base-64 encoded values? - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateExtensions" - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.equals( "netscape.security.x509.CertificateSubjectName" ) ) { - // CMS 6.2: revised method of decoding objects of type - // "netscape.security.x509.CertificateSubjectName" - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "netscape.security.x509.CertificateValidity" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.equals( "netscape.security.x509.CertificateX509Key" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "com.netscape.certsrv.cert.CertInfo" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if (type.startsWith("java.util.Hashtable")) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "Integer[" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "java.lang.Integer" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "org.mozilla.jss.asn1.INTEGER" ) ) { - // CS 7.1 stores bodyPartId as INTEGER - // CS 7.2 fixed the problem by storing it as String - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "com.netscape.certsrv.dbs.keydb.KeyRecord" ) - || type.startsWith( "com.netscape.cmscore.dbs.KeyRecord" ) ) { - // Bugzilla Bug #508191 - These only apply to KRA; and in CS 8.0, - // since KRA requests only need to refer - // to the actual "keyRecord" referenced - // by the "keySerialNumber" data, - // all other "KeyRecord" request data is - // ignored, since it is already stored - // in the actual "keyRecord". - if( data.startsWith( "keySerialNumber" ) ) { - String keySerialNumber = data.substring( data.indexOf( "=" ) + 1 ); - System.out.println( extAttrPrefix + - encodeKey( key.toLowerCase() ) + ": " + - formatData( keySerialNumber ) ); - } - } else if( type.startsWith( "java.util.Locale" ) ) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "com.netscape.certsrv.kra.ProofOfArchival" ) - || type.startsWith( "com.netscape.cmscore.kra.ProofOfArchival" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "netscape.security.x509.RevokedCertImpl" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "java.lang.String[" ) ) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if (type.startsWith("java.lang.String")) { - // Examples: - // - // key.equals( "publickey" ) - // key.equals( "cert_request" ) - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "java.util.Vector" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "netscape.security.x509.X509CertImpl[" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.equals( "netscape.security.x509.X509CertImpl" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.startsWith( "netscape.security.x509.X509CertInfo[" ) - || type.startsWith( "netscape.security.extensions.CertInfo[" ) ) - { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.equals( "netscape.security.x509.X509CertInfo" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else if( type.endsWith( "Exception" ) ) { - System.out.println( extAttrPrefix + encodeKey( key ) + ": " + - formatData( data ) ); - } else { - System.err.println( "ERROR type - " + type + " - "+ attr ); - System.exit( 0 ); - } - } -} - diff --git a/base/migrate/TxtTo80/src/compile.sh b/base/migrate/TxtTo80/src/compile.sh deleted file mode 100755 index c8dd848e0..000000000 --- a/base/migrate/TxtTo80/src/compile.sh +++ /dev/null @@ -1,345 +0,0 @@ -#!/bin/bash - -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2009 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script creates: ### -### ### -### "TxtTo80/classes/CS80LdifParser.class", ### -### "TxtTo80/classes/DummyAuthManager.class", and ### -### "TxtTo80/classes/Main.class", ### -### ### -### which may be used to convert a "normalized" ldif data file ### -### exported from a version of CS prior to 8.0 into a CS 8.0 ### -### ldif data file suitable for import into a CS 8.0 LDAP DB. ### -### ### -##################################################################### - -### -### Provide a usage function -### - -usage() { - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " CS 8.0 ldif data classes." - echo - exit 255 -} - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - usage -fi - - -### -### Set PKI_OS -### -### CS 8.0 NOTE: "Linux" -### "SunOS" -### - -PKI_OS=`uname` -export PKI_OS - -if [ "${PKI_OS}" != "Linux" ] && - [ "${PKI_OS}" != "SunOS" ]; then - printf "This '$0' script is ONLY executable\n" - printf "on either a 'Linux' or 'Solaris' machine!\n" - exit 255 -fi - - -### -### Set PKI_ARCHITECTURE -### -### CS 8.0 NOTE: "Linux i386" - 32-bit ("i386") -### "Linux x86_64" - 64-bit ("x86_64") -### "SunOS sparc" - 64-bit ("sparcv9") -### - -if [ "${PKI_OS}" == "Linux" ]; then - PKI_PLATFORM=`uname -i` - export PKI_PLATFORM - if [ "${PKI_PLATFORM}" == "i386" ] || - [ "${PKI_PLATFORM}" == "x86_64" ]; then - PKI_ARCHITECTURE="${PKI_PLATFORM}" - export PKI_ARCHITECTURE - else - printf "On 'Linux', this '$0' script is ONLY executable\n" - printf "on either an 'i386' or 'x86_64' architecture!\n" - exit 255 - fi -elif [ "${PKI_OS}" == "SunOS" ]; then - PKI_PLATFORM=`uname -p` - export PKI_PLATFORM - if [ "${PKI_PLATFORM}" == "sparc" ]; then - PKI_ARCHITECTURE="sparcv9" - export PKI_ARCHITECTURE - else - printf "On 'Solaris', this '$0' script is ONLY executable\n" - printf "on a 'sparcv9' architecture!\n" - exit 255 - fi -fi - - -### -### Set PKI_OS_DISTRIBUTION -### -### CS 8.0 NOTE: "Linux Fedora 8" - "Fedora" -### "Linux Fedora 9" - "Fedora" -### "Linux Fedora 10" - "Fedora" -### "Linux RHEL 5" - "Red Hat" -### "SunOS 5.9" - "Solaris" -### - -if [ "${PKI_OS}" == "Linux" ]; then - IS_FEDORA=`test -e /etc/fedora-release && echo 1 || echo 0` - if [ "${IS_FEDORA}" -eq 1 ]; then - PKI_DISTRIBUTION="Fedora" - export PKI_DISTRIBUTION - PKI_OS_RPM_VERSION=`rpm -qf --qf='%{VERSION}' /etc/fedora-release` - export PKI_OS_RPM_VERSION - PKI_OS_VERSION=`echo "${PKI_OS_RPM_VERSION}" | tr -d [A-Za-z]` - export PKI_OS_VERSION - else - IS_REDHAT=`test -e /etc/redhat-release && echo 1 || echo 0` - if [ "${IS_REDHAT}" -eq 1 ]; then - PKI_DISTRIBUTION="Red Hat" - export PKI_DISTRIBUTION - PKI_OS_RPM_VERSION=`rpm -qf --qf='%{VERSION}' /etc/redhat-release` - export PKI_OS_RPM_VERSION - PKI_OS_VERSION=`echo "${PKI_OS_RPM_VERSION}" | tr -d [A-Za-z]` - export PKI_OS_VERSION - else - printf "On 'Linux',this '$0' script is ONLY executable\n" - printf "on either a 'Fedora' or 'Red Hat' machine!\n" - exit 255 - fi - fi -elif [ "${PKI_OS}" == "SunOS" ]; then - PKI_DISTRIBUTION="Solaris" - export PKI_DISTRIBUTION - PKI_OS_VERSION=`uname -r | awk -F. '{print $2}'` - export PKI_OS_VERSION -fi - - -### -### Set JAVA_HOME -### -### CS 8.0 NOTE: "Linux Fedora 8" - JDK 1.7.0 (IcedTea) -### "Linux Fedora 9" - JDK 1.6.0 (OpenJDK) -### "Linux Fedora 10" - JDK 1.6.0 (OpenJDK) -### "Linux RHEL 5" - JDK 1.6.0 (OpenJDK) -### "SunOS 5.9" - JDK 1.6.0 (Sun JDK) -### -### "Linux" - ALWAYS set specific JAVA_HOME -### "SunOS" - ALLOW JAVA_HOME to be pre-defined -### - -if [ "${PKI_OS}" == "Linux" ]; then - if [ "${PKI_DISTRIBUTION}" == "Fedora" ]; then - if [ ${PKI_OS_VERSION} -eq 8 ]; then - if [ "${PKI_ARCHITECTURE}" == "i386" ]; then - JAVA_HOME="/usr/lib/jvm/java-1.7.0-icedtea" - JAVA_ARCHITECTURE="i386" - else # "x86_64" - JAVA_HOME="/usr/lib/jvm/java-1.7.0-icedtea.${PKI_ARCHITECTURE}" - JAVA_ARCHITECTURE="amd64" - fi - if [ ! -x "${JAVA_HOME}/bin/javac" ] && - [ ! -f "${JAVA_HOME}/jre/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}/native_threads" ]; then - printf "On 'Fedora 8', this '$0' script is ONLY executable\n" - printf "by 'JDK 1.7.0 (IcedTea)'!\n" - exit 255 - fi - elif [ ${PKI_OS_VERSION} -gt 8 ]; then - if [ "${PKI_ARCHITECTURE}" == "i386" ]; then - JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk" - JAVA_ARCHITECTURE="i386" - else # "x86_64" - JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk.${PKI_ARCHITECTURE}" - JAVA_ARCHITECTURE="amd64" - fi - if [ ! -x "${JAVA_HOME}/bin/javac" ] && - [ ! -f "${JAVA_HOME}/jre/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}/native_threads" ]; then - printf "On 'Fedora ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JDK 1.6.0 (OpenJDK)'!\n" - exit 255 - fi - else - printf "On 'Fedora', this '$0' script is ONLY executable\n" - printf "on 'Fedora 8' or later!\n" - exit 255 - fi - elif [ "${PKI_DISTRIBUTION}" == "Red Hat" ]; then - if [ ${PKI_OS_VERSION} -ge 5 ]; then - if [ "${PKI_ARCHITECTURE}" == "i386" ]; then - JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk" - JAVA_ARCHITECTURE="i386" - else # "x86_64" - JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk.${PKI_ARCHITECTURE}" - JAVA_ARCHITECTURE="amd64" - fi - if [ ! -x "${JAVA_HOME}/bin/javac" ] && - [ ! -f "${JAVA_HOME}/jre/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}/native_threads" ]; then - printf "On 'RHEL ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JDK 1.6.0 (OpenJDK)'!\n" - exit 255 - fi - else - printf "On 'Red Hat', this '$0' script is ONLY executable\n" - printf "on 'RHEL 5' or later!\n" - exit 255 - fi - fi - JDK_EXE="${JAVA_HOME}/bin/javac" - export JDK_EXE - JDK_VERSION=`${JAVA_HOME}/bin/javac -version 2>&1 | cut -b7-11` - export JDK_VERSION -elif [ "${PKI_OS}" == "SunOS" ]; then - if [ "${JAVA_HOME}" == "" ]; then - JAVA_HOME="/usr/java" - fi - JDK_EXE="${JAVA_HOME}/bin/${PKI_ARCHITECTURE}/javac" - export JDK_EXE - JDK_VERSION=`${JAVA_HOME}/bin/${PKI_ARCHITECTURE}/javac -version 2>&1 | cut -b7-11` - export JDK_VERSION - if [ ${PKI_OS_VERSION} -eq 9 ]; then - if [ "${JDK_VERSION}" != "1.6.0" ]; then - printf "On 'Solaris ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JDK 1.6.0'!\n" - exit 255 - fi - if [ ! -x "${JAVA_HOME}/bin/${PKI_ARCHITECTURE}/javac" ] && - [ ! -f "${JAVA_HOME}/jre/lib/rt.jar" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}" ] && - [ ! -d "${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}/native_threads" ]; then - printf "On 'Solaris ${PKI_OS_VERSION}', " - printf "this '$0' script is ONLY executable\n" - printf "by 'JDK 1.6.0 (Sun JDK)'!\n" - exit 255 - fi - else - printf "On 'Solaris', this '$0' script is ONLY executable\n" - printf "on 'Solaris 9'!\n" - exit 255 - fi -fi - - -### -### Setup the appropriate CLASSPATH and LD_LIBRARY_PATH -### environment variables based upon the platform -### - -if [ ! -f "/usr/share/java/pki/cmscore.jar" ] && - [ ! -f "/usr/share/java/pki/certsrv.jar" ]; then - printf "This '$0' script must be COMPILED against\n" - printf "the 'pki-common' package!\n" - exit 255 -fi -if [ ! -f "/usr/share/java/pki/nsutil.jar" ]; then - printf "This '$0' script must be COMPILED against\n" - printf "the 'pki-util' package!\n" - exit 255 -fi - -if [ ${PKI_OS} = "Linux" ] ; then - if [ ! -f "/usr/lib/java/jss4.jar" ]; then - printf "This '$0' script must be COMPILED against\n" - printf "the 'jss' package!\n" - exit 255 - fi - CLASSPATH=${JAVA_HOME}/jre/lib/rt.jar - CLASSPATH=/usr/lib/java/jss4.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/nsutil.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/cmscore.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/certsrv.jar:${CLASSPATH} - export CLASSPATH - if [ ${PKI_ARCHITECTURE} = "i386" ] ; then - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}/native_threads - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} - export LD_LIBRARY_PATH - else # "x86_64" - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}/native_threads - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${JAVA_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH} - export LD_LIBRARY_PATH - fi -else # "SunOS" - if [ ! -f "/usr/lib/java/dirsec/jss4.jar" ]; then - printf "This '$0' script must be COMPILED against\n" - printf "the 'dirsec-jss' package!\n" - exit 255 - fi - CLASSPATH=${JAVA_HOME}/jre/lib/rt.jar - CLASSPATH=/usr/lib/java/dirsec/jss4.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/nsutil.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/cmscore.jar:${CLASSPATH} - CLASSPATH=/usr/share/java/pki/certsrv.jar:${CLASSPATH} - export CLASSPATH - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}/native_threads - LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/${PKI_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib/${PKI_ARCHITECTURE}:${LD_LIBRARY_PATH} - LD_LIBRARY_PATH=/usr/lib/${PKI_ARCHITECTURE}/dirsec:${LD_LIBRARY_PATH} - export LD_LIBRARY_PATH -fi - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile TxtTo80 - create "CS80LdifParser.class", "DummyAuthManager.class", -### and "Main.class" -### - -printf "================================================================\n" -printf "PKI_OS='${PKI_OS}'\n" -printf "PKI_DISTRIBUTION='${PKI_DISTRIBUTION}'\n" -printf "PKI_OS_VERSION='${PKI_OS_VERSION}'\n" -printf "PKI_ARCHITECTURE='${PKI_ARCHITECTURE}'\n" -printf "JAVA_HOME='${JAVA_HOME}'\n" -printf "JDK_EXE='${JDK_EXE}'\n" -printf "JDK_VERSION='${JDK_VERSION}'\n" -printf "================================================================\n\n" - -${JDK_EXE} -d ${TARGET} -classpath ${CLASSPATH} Main.java - diff --git a/base/migrate/kra/RecoverKey.class b/base/migrate/kra/RecoverKey.class Binary files differdeleted file mode 100755 index 756380e8d..000000000 --- a/base/migrate/kra/RecoverKey.class +++ /dev/null diff --git a/base/migrate/kra/RecoverKey.java b/base/migrate/kra/RecoverKey.java deleted file mode 100755 index 6a663ea97..000000000 --- a/base/migrate/kra/RecoverKey.java +++ /dev/null @@ -1,101 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - - -// package com.netscape.cmstools; - -import org.mozilla.jss.pkix.cmc.*; -import org.mozilla.jss.pkix.cms.*; -import org.mozilla.jss.pkix.cert.*; -import org.mozilla.jss.pkix.primitive.*; -import org.mozilla.jss.asn1.*; -import org.mozilla.jss.pkcs10.*; -import org.mozilla.jss.crypto.*; -import org.mozilla.jss.CryptoManager; -import org.mozilla.jss.crypto.CryptoToken; -import org.mozilla.jss.crypto.SignatureAlgorithm; -import org.mozilla.jss.crypto.DigestAlgorithm; -import org.mozilla.jss.crypto.X509Certificate; -import org.mozilla.jss.util.*; -import org.mozilla.jss.*; - -import sun.misc.BASE64Encoder; -import sun.misc.*; - -import java.io.*; -import java.util.*; - -import com.netscape.cmscore.shares.*; - -public class RecoverKey { - - public static void main(String args[]) throws Exception - { - if (args.length != 6) { - System.out.println("Usage: RecoverKey <alias directory> <prefix> <password> <pin> <nickname> <kra-key.db path>"); - System.exit(0); - } - - String alias = args[0]; - String prefix = args[1]; - String password = args[2]; - String pin = args[3]; - String nickname = args[4]; - String db_path = args[5]; - - CryptoManager.InitializationValues vals = - new CryptoManager.InitializationValues(alias, - prefix, prefix, "secmod.db"); - - CryptoManager.initialize(vals); - CryptoManager cm = CryptoManager.getInstance(); - - CryptoToken token = cm.getInternalKeyStorageToken(); - token.login(new Password(password.toCharArray())); - - // retrieve public key - X509Certificate cert = cm.findCertByNickname(nickname); - - // retrieve encrypted private key material - File priFile = new File(db_path); - byte priData[] = new byte[(new Long(priFile.length())).intValue()]; - FileInputStream fi = new FileInputStream(priFile); - fi.read(priData); - fi.close(); - - // recover private key - Password pass = new Password(pin.toCharArray()); - KeyGenerator kg = token.getKeyGenerator( - PBEAlgorithm.PBE_SHA1_DES3_CBC); - byte iv[] = {0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01}; - PBEKeyGenParams kgp = new PBEKeyGenParams(pass, - iv, 5); - - pass.clear(); - kg.initialize(kgp); - SymmetricKey sk = kg.generate(); - - KeyWrapper wrapper = token.getKeyWrapper(KeyWrapAlgorithm.DES3_CBC_PAD); - wrapper.initUnwrap(sk, new IVParameterSpec(iv)); - PrivateKey pk = wrapper.unwrapPrivate(priData, - PrivateKey.RSA, cert.getPublicKey()); - - System.out.println("=> Private is '" + pk + "'"); - } -} diff --git a/base/migrate/kra/RecoverPin.class b/base/migrate/kra/RecoverPin.class Binary files differdeleted file mode 100755 index 75db9d5f9..000000000 --- a/base/migrate/kra/RecoverPin.class +++ /dev/null diff --git a/base/migrate/kra/RecoverPin.java b/base/migrate/kra/RecoverPin.java deleted file mode 100755 index 921143154..000000000 --- a/base/migrate/kra/RecoverPin.java +++ /dev/null @@ -1,149 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - - -// package com.netscape.cmstools; - -import org.mozilla.jss.pkix.cmc.*; -import org.mozilla.jss.pkix.cms.*; -import org.mozilla.jss.pkix.cert.*; -import org.mozilla.jss.pkix.primitive.*; -import org.mozilla.jss.asn1.*; -import org.mozilla.jss.pkcs10.*; -import org.mozilla.jss.crypto.*; -import org.mozilla.jss.CryptoManager; -import org.mozilla.jss.crypto.CryptoToken; -import org.mozilla.jss.crypto.SignatureAlgorithm; -import org.mozilla.jss.crypto.DigestAlgorithm; -import org.mozilla.jss.crypto.X509Certificate; -import org.mozilla.jss.util.*; -import org.mozilla.jss.*; - -import sun.misc.BASE64Encoder; -import sun.misc.*; - -import java.io.*; -import java.util.*; - -import com.netscape.cmscore.shares.*; - -public class RecoverPin { - - public static String getPassword(Hashtable shares) throws Exception - { - System.out.println("Share size '" + shares.size() + "'"); - JoinShares j = new JoinShares(shares.size()); - - Enumeration e = shares.keys(); - while (e.hasMoreElements()) { - String next = (String) e.nextElement(); -System.out.println("Add share " + (int)(Integer.parseInt(next) + 1)); - j.addShare(Integer.parseInt(next) + 1, - (byte[]) shares.get(next)); - } - byte secret[] = j.recoverSecret(); - String pwd = new String(secret); - return pwd; - } - - public static byte[] resizeShare(byte share[]) { - byte data[] = new byte[share.length - 2]; - - for (int i = 2; i < share.length; i++) { - data[i - 2] = share[i]; - } - return data; - } - - public static Hashtable getShares(CryptoToken token, - Properties kra_mn_p) throws Exception - { - BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); - Hashtable v = new Hashtable(); - Enumeration e = kra_mn_p.keys(); - int n = Integer.parseInt((String)kra_mn_p.get("n")); - for (int i = 0; i < n; i++) { - String uid = (String)kra_mn_p.get("uid"+i); - System.out.println("Got uid '" + uid + "'"); - - String encrypted = (String)kra_mn_p.get("share"+i); - System.out.println("Got share '" + encrypted + "'"); - - BASE64Decoder decoder = new BASE64Decoder(); - byte share[] = decoder.decodeBuffer(encrypted); - System.out.println("Got encrypted share length '" + - share.length + "'"); - - System.out.println("Please input password for " + uid + ":"); - String pwd = br.readLine(); - System.out.println("Got password '" + pwd + "'"); - - Cipher cipher = token.getCipherContext( - EncryptionAlgorithm.DES3_CBC_PAD); - byte iv[] = {0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01}; - Password pass = new Password(pwd.toCharArray()); - KeyGenerator kg = token.getKeyGenerator( - PBEAlgorithm.PBE_SHA1_DES3_CBC); - PBEKeyGenParams kgp = new PBEKeyGenParams(pass, - iv, 5); - kg.initialize(kgp); - SymmetricKey sk = kg.generate(); - cipher.initDecrypt(sk, new IVParameterSpec(iv)); - byte dec[] = cipher.doFinal(share); - System.out.println("Got decrypted share length '" + dec.length + "'"); - System.out.println("Got share[0] '" + dec[0] + "'"); - System.out.println("Got share[1] '" + dec[1] + "'"); - byte res[] = resizeShare(dec); - v.put(Integer.toString(i), res); - } - return v; - } - - public static void main(String args[]) throws Exception - { - if (args.length != 4) { - System.out.println("Usage: RecoverPin <alias directory> <prefix> <password> <kra-mn.conf path>"); - System.exit(0); - } - - String alias = args[0]; - String prefix = args[1]; - String password = args[2]; - String path_kra_mn = args[3]; - - CryptoManager.InitializationValues vals = - new CryptoManager.InitializationValues(alias, - prefix, prefix, "secmod.db"); - - CryptoManager.initialize(vals); - CryptoManager cm = CryptoManager.getInstance(); - - // load files into properties - Properties kra_mn_p = new Properties(); - kra_mn_p.load(new FileInputStream(path_kra_mn)); - - CryptoToken token = cm.getInternalKeyStorageToken(); - token.login(new Password(password.toCharArray())); - - Hashtable shares = getShares(token, kra_mn_p); - - String pwd = getPassword(shares); - System.out.println("=> Pin is '" + pwd + "'"); - } -} diff --git a/base/migrate/kra/readme.txt b/base/migrate/kra/readme.txt deleted file mode 100755 index 8b7b69b49..000000000 --- a/base/migrate/kra/readme.txt +++ /dev/null @@ -1,130 +0,0 @@ -Date - - Tue Oct 17 16:11:07 PDT 2006 - -Version - - CMS 6.1 - -Overview - - In CMS6.1 Data Recovery Manager (DRM), it has deployed a - complicated key splitting scheme where software token and - hardware token are treated differently. - - Both software and hardware token requires a group of N recovery agents - to be present during the configuration. A Pin is randomly generated - and splitted into N pieces called shares. Each share is encrypted with - a password provided by the individual recovery agent. This is to - ensure no single recovery agent to access the pin. - - For software token, during configuration, a storage key pair is - generated, and the private key portion is then encrypted by the - Pin mentioned above. The encrypted key is stored in a file called - kra-key.db in the conf directory. The configuration deletes - the private key from the software token. For each recovery - operation, the private key is then reconstructed and imported - into the software token. - - For hardware token, during configuration, a storage key pair is - generated on the selected token, then the configuration changes the - hardware token's pin to the randomly generated pin mentioned above. - For each recovery operation, the token's pin is reconstructed and - private key is accessed. - - To provide migration on the user keys that were encrypted with the - storage keys of CS6.1, we need to be able to migrate the public and - private keys to the new system. To access the private key, we need - to have a way to reconstruct the pin. - - This support package provides 2 utilities that can assist the - migration. - -Programs - - RecoverPin - This command is to reconstruct the pin. It reads - the shares from conf/kra-mn.conf, and prompts for - agent passwords. It then reconstructs and prints the - pin to the screen. - - RecoverKey - For software token deployment, the encrypted private - key is stored in the file conf/kra-key.db. To recover - the private key, the user needs to use the pin obtained - from RecoverPin. Once the private key is recovered into - the security database. The user can use pk12util to - migrate key to the new installation. For hardware token - deployment, this command is not necessary. - -Examples - - Here is an example of RecoverPin usage - - java -classpath <server-root>/bin/cert/jars/cmscore.jar:<server-root>/bin/cert/jars/nsutil.jar:<server-root>/bin/cert/jars/jss3.jar:. RecoverPin <path to alias directory> <prefix> <password> <key splitting scheme file> - - For example, - - java -classpath /home/user/cs61/servers/bin/cert/jars/cmscore.jar:/export/home/user/cs61/servers/bin/cert/jars/nsutil.jar:/export/home/user/cs61/servers/bin/cert/jars/jss3.jar:. RecoverPin /export/home/user/cs61/servers/alias "cert-drm-sunburst-" netscape /export/home/user/cs61/servers/cert-drm/config/kra-mn.conf - - The output is: - - Got uid 'agent1' - Got share 'A23UO/q9f40=' - Got encrypted share length '8' - Please input password for agent1: - netscape1 - Got password 'netscape1' - Got decrypted share length '2' - Got share[0] '0' - Got share[1] '0' - Got uid 'agent2' - Got share 'R+zGVd5zczI=' - Got encrypted share length '8' - Please input password for agent2: - netscape2 - Got password 'netscape2' - Got decrypted share length '2' - Got share[0] '0' - Got share[1] '0' - Got uid 'agent3' - Got share 'lsipE7cM8jg=' - Got encrypted share length '8' - Please input password for agent3: - netscape3 - Got password 'netscape3' - Got decrypted share length '2' - Got share[0] '0' - Got share[1] '0' - Share size '3' - Add share 3 - Add share 2 - Add share 1 - => Pin is '' - - Here is an example of RecoverKey usage - - java -classpath <server-root>/bin/cert/jars/cmscore.jar:<server-root>/bin/cert/jars/nsutil.jar:<server-root>/bin/cert/jars/jss3.jar:. RecoverKey <alias path> <prefix> <db password> <pin from RecoverPin> <nickname> <key db path> - - For example, - - java -classpath /export/home/user/cs61/servers/bin/cert/jars/cmscore.jar:/export/home/user/cs61/servers/bin/cert/jars/nsutil.jar:/export/home/user/cs61/servers/bin/cert/jars/jss3.jar:. RecoverKey /export/home/user/cs61/servers/alias cert-drm-sunburst- "netscape" "" "kraStorageCert 1161121005622" /export/home/user/cs61/servers/cert-drm/config/kra-key.db - - The output is: - - => Private is 'org.mozilla.jss.pkcs11.PK11RSAPrivateKey@1ab8f9e' - -To make the private and public key exportable via pk12util. You need to first -backup the storage certificate, delete it, and then import it -again. For example, - - certutil -d . -P cert-drm-sunburst- \ - -n "kraStorageCert 1161121005622" -a > storageCert.txt - - certutil -d . -P cert-drm-sunburst- -D -n "kraStorageCert 1161121005622" - - certutil -d . -P cert-drm-sunburst- -A -t "u,u,u" \ - -n "kraStorageCert 1161121005622" -i storageCert.txt - -Finally, you can export the private and public key using pk12util - - pk12util -o storage.p12 -d . -P cert-drm-sunburst- \ - -n "kraStorageCert 1161121005622" diff --git a/scripts/compose_pki_migrate_packages b/scripts/compose_pki_migrate_packages deleted file mode 100755 index a93df2255..000000000 --- a/scripts/compose_pki_migrate_packages +++ /dev/null @@ -1,199 +0,0 @@ -#!/bin/bash -# BEGIN COPYRIGHT BLOCK -# (C) 2010 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK - -## -## Include common 'compose' functions -## - -COMPOSE_PWD=`dirname $0` -source ${COMPOSE_PWD}/compose_functions - - -## Always switch into the base directory three levels -## above this shell script prior to executing it so -## that all of its output is written to this directory - -cd `dirname $0`/../.. - - -## -## Retrieve the name of this base directory -## - -PKI_PWD=`pwd` - - -## -## Establish the 'pki-migrate' name and version information -## - -PKI_MIGRATE="pki-migrate" -PKI_MIGRATE_VERSION="10.2.0" - - -## -## Establish the SOURCE files/directories of the 'pki-migrate' source directory -## - -PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_MIGRATE}.spec" -PKI_COMPONENT_LIST="test migrate" - - -## -## Establish the TARGET files/directories of the 'pki-migrate' source/spec files -## - -if [ $WORK_DIR ]; then - PKI_PACKAGES="`cd $WORK_DIR ; pwd`" -else - PKI_PACKAGES="${PKI_PWD}/packages" -fi - -PKI_MIGRATE_BUILD_DIR="${PKI_PACKAGES}/BUILD" -PKI_MIGRATE_RPMS_DIR="${PKI_PACKAGES}/RPMS" -PKI_MIGRATE_SOURCES_DIR="${PKI_PACKAGES}/SOURCES" -PKI_MIGRATE_SPECS_DIR="${PKI_PACKAGES}/SPECS" -PKI_MIGRATE_SRPMS_DIR="${PKI_PACKAGES}/SRPMS" - -PKI_MIGRATE_TARBALL="${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}.tar.gz" -PKI_MIGRATE_SPEC_FILE="${PKI_MIGRATE_SPECS_DIR}/${PKI_MIGRATE}.spec" -PKI_MIGRATE_PACKAGE_SCRIPT="${PKI_PACKAGES}/package_${PKI_MIGRATE}" -PKI_MIGRATE_PACKAGE_COMMAND="${RPMBUILD_CMD} SPECS/${PKI_MIGRATE}.spec" - -PKI_MIGRATE_STAGING_DIR="${PKI_PACKAGES}/staging" -PKI_MIGRATE_DIR="${PKI_MIGRATE_STAGING_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}" -PKI_MIGRATE_BASE_DIR="${PKI_MIGRATE_DIR}/base" - - -## -## Always create a top-level 'packages' directory -## - -mkdir -p ${PKI_PACKAGES} - - -## -## Always create 'pki-migrate' package directories -## - -mkdir -p ${PKI_MIGRATE_BUILD_DIR} -mkdir -p ${PKI_MIGRATE_RPMS_DIR} -mkdir -p ${PKI_MIGRATE_SOURCES_DIR} -mkdir -p ${PKI_MIGRATE_SPECS_DIR} -mkdir -p ${PKI_MIGRATE_SRPMS_DIR} - - -## -## Always start with new 'pki-migrate' package files -## - -rm -rf ${PKI_MIGRATE_BUILD_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION} -rm -f ${PKI_MIGRATE_RPMS_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}*.rpm -rm -f ${PKI_MIGRATE_SOURCES_DIR}/${PKI_MIGRATE_TARBALL} -rm -f ${PKI_MIGRATE_SPEC_FILE} -rm -f ${PKI_MIGRATE_SRPMS_DIR}/${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}*.rpm - - -## -## Copy a new 'pki-migrate' spec file from the -## current contents of the PKI working repository -## - -cp -p ${PKI_SPECS_FILE} ${PKI_MIGRATE_SPECS_DIR} - - -## -## If specified, copy all Patches from the spec file URL to SOURCES -## - -if [ ${FETCH_PATCH_FILES} -eq 1 ] ; then - Fetch_Patch_Files ${PKI_SPECS_FILE} ${PKI_MIGRATE_SOURCES_DIR} -fi - - -## -## Copy the specified Source Tarball from the spec file URL to SOURCES, or -## Generate a fresh Source Tarball from the local source -## - -if [ ${FETCH_SOURCE_TARBALL} -eq 1 ] ; then - Fetch_Source_Tarball ${PKI_SPECS_FILE} ${PKI_MIGRATE_SOURCES_DIR} -else - ## - ## Always start with a new 'pki-migrate' staging directory - ## - - rm -rf ${PKI_MIGRATE_STAGING_DIR} - - - ## - ## To generate the 'pki-migrate' tarball, construct a staging area - ## consisting of the 'pki-migrate' source components from the - ## current contents of the PKI working repository - ## - - mkdir -p ${PKI_MIGRATE_DIR} - cd ${PKI_DIR} - for file in "${PKI_FILE_LIST}" ; - do - cp -p ${file} ${PKI_MIGRATE_DIR} - done - find ${PKI_CMAKE_DIR} \ - -name .svn -prune -o \ - -name *.swp -prune -o \ - -print | cpio -pdum ${PKI_MIGRATE_DIR} > /dev/null 2>&1 - cd - > /dev/null 2>&1 - - mkdir -p ${PKI_MIGRATE_BASE_DIR} - cd ${PKI_BASE_DIR} - cp -p ${PKI_BASE_MANIFEST} ${PKI_MIGRATE_BASE_DIR} - for component in "${PKI_COMPONENT_LIST}" ; - do - find ${component} \ - -name .svn -prune -o \ - -name *.swp -prune -o \ - -print | cpio -pdum ${PKI_MIGRATE_BASE_DIR} > /dev/null 2>&1 - done - cd - > /dev/null 2>&1 - - - ## - ## Create the 'pki-migrate' tarball - ## - - mkdir -p ${PKI_MIGRATE_SOURCES_DIR} - cd ${PKI_MIGRATE_STAGING_DIR} - gtar -zcvf ${PKI_MIGRATE_TARBALL} \ - "${PKI_MIGRATE}-${PKI_MIGRATE_VERSION}" > /dev/null 2>&1 - mv ${PKI_MIGRATE_TARBALL} ${PKI_MIGRATE_SOURCES_DIR} - cd - > /dev/null 2>&1 - - - ## - ## Always remove the PKI staging area - ## - - rm -rf ${PKI_MIGRATE_STAGING_DIR} -fi - - -## -## Always generate a fresh 'pki-migrate' package script -## - -rm -rf ${PKI_MIGRATE_PACKAGE_SCRIPT} -printf "#!/bin/bash\n\n" > ${PKI_MIGRATE_PACKAGE_SCRIPT} -printf "${PKI_MIGRATE_PACKAGE_COMMAND}\n\n" >> ${PKI_MIGRATE_PACKAGE_SCRIPT} -chmod 775 ${PKI_MIGRATE_PACKAGE_SCRIPT} - - -## -## Automatically invoke RPM/SRPM creation -## - -cd ${PKI_PACKAGES} ; -bash ./package_${PKI_MIGRATE} | tee package_${PKI_MIGRATE}.log 2>&1 - diff --git a/scripts/compose_pki_test_package b/scripts/compose_pki_test_package index a3bdeb952..2614ead0b 100755 --- a/scripts/compose_pki_test_package +++ b/scripts/compose_pki_test_package @@ -90,7 +90,6 @@ CLASSPATH=$CLASSPATH:$PKI_SOURCE_DIR/base/kra/functional/src CLASSPATH=$CLASSPATH:$PKI_SOURCE_DIR/base/ocsp/src CLASSPATH=$CLASSPATH:$PKI_SOURCE_DIR/base/tks/src CLASSPATH=$CLASSPATH:$PKI_SOURCE_DIR/base/tps/src -CLASSPATH=$CLASSPATH:$PKI_SOURCE_DIR/base/migrate/80 CLASSPATH=$CLASSPATH:/usr/share/java/junit4.jar CLASSPATH=$CLASSPATH:`pwd`/src CLASSPATH=$CLASSPATH:/usr/lib64/jss/jss4.jar diff --git a/specs/pki-migrate.spec b/specs/pki-migrate.spec deleted file mode 100644 index 3ebdf8a09..000000000 --- a/specs/pki-migrate.spec +++ /dev/null @@ -1,193 +0,0 @@ -Name: pki-migrate -Version: 10.2.0 -Release: 0.1%{?dist} -Summary: Red Hat Certificate System - PKI Migration Scripts -URL: http://pki.fedoraproject.org/ -License: GPLv2 -Group: System Environment/Base - -# Suppress automatic 'requires' and 'provisions' of multi-platform 'binaries' -AutoReqProv: no - -BuildArch: noarch - -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: cmake -BuildRequires: java-devel >= 1:1.7.0 -BuildRequires: jpackage-utils - -Requires: java >= 1:1.7.0 - -Source0: http://pki.fedoraproject.org/pki/sources/%{name}/%{name}-%{version}%{?prerel}.tar.gz - -%if 0%{?rhel} -ExcludeArch: ppc ppc64 ppcle ppc64le s390 s390x -%endif - -%global _binaries_in_noarch_packages_terminate_build 0 - -%description -Red Hat Certificate System (CS) is an enterprise software system designed -to manage enterprise Public Key Infrastructure (PKI) deployments. - -PKI Migration Scripts are used to export data from previous versions of -Netscape Certificate Management Systems, iPlanet Certificate Management -Systems, and Red Hat Certificate Systems into a flat-file which may then -be imported into this release of Red Hat Certificate System. - -Note that since this utility is platform-independent, it is generally possible -to migrate data from previous PKI deployments originally stored on other -hardware platforms as well as earlier versions of this operating system. - - -%prep - - -%setup -q -n %{name}-%{version}%{?prerel} - - -%clean -%{__rm} -rf %{buildroot} - - -%build -%{__mkdir_p} build -cd build -%cmake -DVERSION=%{version}-%{release} \ - -DVAR_INSTALL_DIR:PATH=/var \ - -DBUILD_PKI_MIGRATE:BOOL=ON \ - .. -%{__make} VERBOSE=1 %{?_smp_mflags} - - -%install -%{__rm} -rf %{buildroot} -cd build -%{__make} install DESTDIR=%{buildroot} INSTALL="install -p" - - -%files -%defattr(-,root,root,-) -%doc base/migrate/LICENSE -%dir %{_datadir}/pki -%{_datadir}/pki/migrate/ - - -%changelog -* Fri Nov 22 2013 Dogtag Team <pki-devel@redhat.com> 10.2.0-0.1 -- Updated version number to 10.2.0-0.1. - -* Fri Nov 15 2013 Ade Lee <alee@redhat.com> 10.1.0-1 -- Trac Ticket 788 - Clean up spec files -- Update release number for release build - -* Fri Jun 14 2013 Endi S. Dewata <edewata@redhat.com> 10.1.0-0.2 -- Updated dependencies to Java 1.7. - -* Tue May 7 2013 Ade Lee <alee@redhat.com> 10.1.0-0.1 -- Change release number for 10.1 development - -* Fri Apr 26 2013 Ade Lee <alee@redhat.com> 10.0.2-1 -- Change release number for official release. - -* Wed Mar 27 2013 Endi S. Dewata <edewata@redhat.com> 10.0.2-0.1 -- Updated version number to 10.0.2-0.1. - -* Fri Dec 7 2012 Ade Lee <alee@redhat.com> 10.0.0-1 -- Update to official release for rc1 - -* Mon Nov 12 2012 Ade Lee <alee@redhat.com> 10.0.0-0.4.b3 -- Update release to b3 - -* Mon Oct 29 2012 Ade Lee <alee@redhat.com> 10.0.0-0.3.b2 -- Update release to b2 - -* Mon Oct 8 2012 Ade Lee <alee@redhat.com> 10.0.0-0.2.b1 -- Update release to b1 - -* Mon Oct 1 2012 Ade Lee <alee@redhat.com> 10.0.0-0.2.a2 -- Update release to a2 - -* Sun Sep 30 2012 Endi S. Dewata <edewata@redhat.com> 10.0.0-0.2.a1 -- Modified CMake to use RPM version number - -* Wed Feb 1 2012 Nathan Kinder <nkinder@redhat.com> 10.0.0-0.1.a1 -- Updated package version number - -* Fri Oct 28 2011 Andrew Wnuk <awnuk@redhat.com> 9.0.2-1 -- Bugzilla Bug #737216 - unnecessary empty lines in "cert-info" attributes - created in 7.1->8.0 migration -- Bugzilla Bug #737217 - Migration tool is not using proper "ext-data" array - format. - -* Thu Jul 14 2011 Matthew Harmsen <mharmsen@redhat.com> 9.0.1-1 -- Bugzilla Bug #669226 - Remove Legacy Build System - -* Wed Dec 1 2010 Matthew Harmsen <mharmsen@redhat.com> 9.0.0-1 -- Updated Dogtag 1.3.x --> Dogtag 2.0.0 (internal) --> Dogtag 9.0.0 - -* Mon Jul 13 2009 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-17 -- Bugzilla Bug #511136 - Integrate EULA file into RHCS -- Release Candidate 4 build - -* Wed Jul 08 2009 Kevin Wright <kwright@redhat.com> 8.0.0-16 -- Bugzilla Bug #510352 - Release Candidate 3 build - -* Thu Jul 02 2009 Kevin Wright <kwright@redhat.com> 8.0.0-15 -- Bugzilla Bug #509447 - Release Candidate 2 build - -* Thu Jun 25 2009 Kevin Wright <kwright@redhat.com> 8.0.0-14 -- Bugzilla Bug #508179 - Remove base_phase ".beta" tag - -* Fri Jun 05 2009 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-13 -- Bugzilla Bug #499496 - pki-migrate package should include only the tools - we support - -* Mon May 18 2009 Ade Lee <alee@redhat.com> 8.0.0-12 -- Bugzilla Bug #493717 - migration scripts required for TPS groups - -* Mon May 04 2009 Kevin Wright <kwright@redhat.com> 8.0.0-11 -- Bugzilla Bug #499030 - Beta 2 Release - -* Fri Mar 27 2009 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-10 -- Bugzilla Bug #492502 - Redefine "base_phase" from ".alpha" to ".beta" - -* Sat Feb 28 2009 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-9 -- Bugzilla Bug #487896 - Introduce optional 'base_phase' release tag to - denote ".alpha", ".beta", etc. - -* Tue Feb 17 2009 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-8 -- Bugzilla Bug #485790 - Need changes made to spec files in various packages - to be able to build in koji/brew - -* Fri Jan 30 2009 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-7 -- Bugzilla Bug #253615 - RFE: migration tool needs to be written for the - serialization changes - Allowed 63ToTxt binaries to be published - -* Sat Nov 29 2008 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-6 -- Aligned RHEL 5, RHEL 4, and Solaris 9 "base_release" numbers -- Bugzilla Bug #445402 - Changed "base_url" from - "http://www.redhat.com/software/rha/certificate" to - "http://www.redhat.com/certificate_system" - -* Sat Nov 22 2008 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-5 -- Bugzilla Bug #472305 - "equality" tests in all spec files need to be fixed -- Bumped "java" and "java-devel" 1.4.2 and 1.5.0 dependencies to 1.6.0 -- Changed "java-sdk" to "java-devel" for consistency - -* Tue Oct 14 2008 Ade Lee <alee@redhat.com> 8.0.0-4 -- bugzilla bug #223361 - added 80 migration scripts - -* Fri Jun 08 2007 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-3 -- bugzilla bug #243480 - added legacy upgrade path - -* Tue Jun 05 2007 Matthew Harmsen <mharmsen@redhat.com> 8.0.0-2 -- bugzilla bug #242575 - Made numerous changes to spec file. - -* Mon May 21 2007 Kevin McCarthy <kmccarth@redhat.com> 8.0.0-1 -- Bump to version 8.0. - -* Thu Apr 05 2007 Thomas Kwan <nkwan@redhat.com> 1.0.0-1 -- Fixed change log to use the correct version - |