bip         01/05/22 13:37:24

  Added:       catalina/src/bin digest.bat digest.sh
  Log:
  scripts to Digest password.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-4.0/catalina/src/bin/digest.bat
  
  Index: digest.bat
  ===================================================================
  @echo off
  rem ---------------------------------------------------------------------------
  rem digest.bat - Digest password using the algorithm specificied
  rem
  rem   CATALINA_HOME (Optional) May point at your Catalina "build" directory.
  rem                 If not present, the current working directory is assumed.
  rem
  rem   JAVA_HOME     Must point at your Java Development Kit installation.
  rem
  rem   This script is assumed to run from the bin directory or have the
  rem   CATALINA_HOME env variable set.
  rem
  rem $Id: digest.bat,v 1.1 2001/05/22 20:37:19 bip Exp $
  rem ---------------------------------------------------------------------------
  
  
  rem ----- Save Environment Variables That May Change --------------------------
  
  set _CATALINA_HOME=%CATALINA_HOME%
  set _CLASSPATH=%CLASSPATH%
  set _CP=%CP%
  
  rem ----- Verify and Set Required Environment Variables -----------------------
  
  if not "%JAVA_HOME%" == "" goto gotJavaHome
  echo You must set JAVA_HOME to point at your Java Development Kit installation
  goto cleanup
  :gotJavaHome
  
  if not "%CATALINA_HOME%" == "" goto gotCatalinaHome
  set CATALINA_HOME=.
  if exist "%CATALINA_HOME%\server\lib\catalina.jar" goto okCatalinaHome
  set CATALINA_HOME=..
  :gotCatalinaHome
  if exist "%CATALINA_HOME%\server\lib\catalina.jar" goto okCatalinaHome
  echo Cannot find catalina.jar in %CATALINA_HOME%\server\lib
  echo Please check your CATALINA_HOME setting or run this script from the bin 
directory
  goto cleanup
  :okCatalinaHome
  
  
  rem ----- Prepare Appropriate Java Execution Commands -------------------------
  
  set _RUNJAVA="%JAVA_HOME%\bin\java"
  
  rem ----- Set Up The Runtime Classpath ----------------------------------------
  
  set CP=%CATALINA_HOME%\server\lib\catalina.jar
  set CLASSPATH=%CP%
  echo Using CLASSPATH: %CLASSPATH%
  
  
  rem ----- Execute The Requested Command ---------------------------------------
  
  if "%1" == "-a" (if "%2" neq "" (if "%3" neq "" goto doRun))
  
  :doUsage
  echo Usage:  digest -a [algorithm] [credentials]
  echo Commands:
  echo   algorithm   -   The algorithm to use, i.e. MD5, DES
  echo   credentials -   The credential to digest
  goto cleanup
  
  :doRun
  %_RUNJAVA% org.apache.catalina.realm.JDBCRealm %1 %2 %3
  goto cleanup
  
  
  rem ----- Restore Environment Variables ---------------------------------------
  
  :cleanup
  set CATALINA_HOME=%_CATALINA_HOME%
  set _CATALINA_HOME=
  set CLASSPATH=%_CLASSPATH%
  set _CLASSPATH=
  set CP=%_CP%
  set _CP=
  :finish
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/bin/digest.sh
  
  Index: digest.sh
  ===================================================================
  #!/bin/sh
  # -----------------------------------------------------------------------------
  # digest.bat - Digest password using the algorithm specificied
  #
  #   CATALINA_HOME (Optional) May point at your Catalina "build" directory.
  #                 If not present, the current working directory is assumed.
  #
  #   JAVA_HOME     Must point at your Java Development Kit installation.
  #
  #   This script is assumed to run from the bin directory or have the
  #   CATALINA_HOME env variable set.
  #
  # $Id: digest.sh,v 1.1 2001/05/22 20:37:21 bip Exp $
  # -----------------------------------------------------------------------------
  
  
  # ----- Verify and Set Required Environment Variables -------------------------
  
  if [ -z "$CATALINA_HOME" ] ; then
    ## resolve links - $0 may be a link to  home
    PRG=$0
    progname=`basename $0`
    
    while [ -h "$PRG" ] ; do
      ls=`ls -ld "$PRG"`
      link=`expr "$ls" : '.*-> \(.*\)$'`
      if expr "$link" : '.*/.*' > /dev/null; then
        PRG="$link"
      else
        PRG="`dirname $PRG`/$link"
      fi
    done
    
    CATALINA_HOME_1=`dirname "$PRG"`/..
    echo "Guessing CATALINA_HOME from digest.sh to ${CATALINA_HOME_1}" 
      if [ -d ${CATALINA_HOME_1}/conf ] ; then 
        CATALINA_HOME=${CATALINA_HOME_1}
        echo "Setting CATALINA_HOME to $CATALINA_HOME"
      fi
  fi
  
  if [ -z "$JAVA_HOME" ] ; then
    echo You must set JAVA_HOME to point at your Java Development Kit installation
    exit 1
  fi
  
  # ----- Set Up The System Classpath -------------------------------------------
  
  CP="$CATALINA_HOME/server/lib/catalina.jar"
  
  if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
    CP=$CP:"$JAVA_HOME/lib/tools.jar"
  fi
  
  # convert the existing path to windows
  if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
     CP=`cygpath --path --windows "$CP"`
     CATALINA_HOME=`cygpath --path --windows "$CATALINA_HOME"`
  fi
  
  echo "Using CLASSPATH: $CP"
  echo "Using CATALINA_HOME: $CATALINA_HOME"
  
  
  # ----- Execute The Requested Command -----------------------------------------
  
  if [ "$1" != "-a" ] || [ -z "$2" ] || [ -z "$3" ] ; then
  
    echo "Usage:  digest -a [algorithm] [credentials]"
    echo "Commands:"
    echo "  algorithm   -   The algorithm to use, i.e. MD5, DES"
    echo "  credentials -   The credential to digest"
  
    exit 1
  
  else
  
    shift
  
      $JAVA_HOME/bin/java -classpath $CP \
       org.apache.catalina.realm.JDBCRealm -a "$@"
  
  fi
  
  
  

Reply via email to