1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/tests/dbupgrade/dbupgrade.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,106 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +######################################################################## 1.11 +# 1.12 +# mozilla/security/nss/tests/dbupgrade/dbupgrade.sh 1.13 +# 1.14 +# Script to upgrade databases to Shared DB 1.15 +# 1.16 +# needs to work on all Unix and Windows platforms 1.17 +# 1.18 +# special strings 1.19 +# --------------- 1.20 +# FIXME ... known problems, search for this string 1.21 +# NOTE .... unexpected behavior 1.22 +# 1.23 +######################################################################## 1.24 + 1.25 +############################ dbupgrade_init ############################ 1.26 +# local shell function to initialize this script 1.27 +######################################################################## 1.28 +dbupgrade_init() 1.29 +{ 1.30 + if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then 1.31 + cd ${QADIR}/common 1.32 + . ./init.sh 1.33 + fi 1.34 + 1.35 + if [ ! -r "${CERT_LOG_FILE}" ]; then # we need certificates here 1.36 + cd ${QADIR}/cert 1.37 + . ./cert.sh 1.38 + fi 1.39 + 1.40 + if [ ! -d ${HOSTDIR}/SDR ]; then # we also need sdr as well 1.41 + cd ${QADIR}/sdr 1.42 + . ./sdr.sh 1.43 + fi 1.44 + 1.45 + SCRIPTNAME=dbupgrade.sh 1.46 + if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for 1.47 + CLEANUP="${SCRIPTNAME}" # cleaning this script will do it 1.48 + fi 1.49 + 1.50 + echo "$SCRIPTNAME: DB upgrade tests ===============================" 1.51 +} 1.52 + 1.53 +############################ dbupgrade_main ############################ 1.54 +# local shell function to upgrade certificate databases 1.55 +######################################################################## 1.56 +dbupgrade_main() 1.57 +{ 1.58 + # 'reset' the databases to initial values 1.59 + echo "Reset databases to their initial values:" 1.60 + cd ${HOSTDIR} 1.61 + ${BINDIR}/certutil -D -n objsigner -d alicedir 2>&1 1.62 + ${BINDIR}/certutil -M -n FIPS_PUB_140_Test_Certificate -t "C,C,C" -d fips -f ${FIPSPWFILE} 2>&1 1.63 + ${BINDIR}/certutil -L -d fips 2>&1 1.64 + rm -f smime/alicehello.env 1.65 + 1.66 + # test upgrade to the new database 1.67 + echo "nss" > ${PWFILE} 1.68 + html_head "Legacy to shared Library update" 1.69 + dirs="alicedir bobdir CA cert_extensions client clientCA dave eccurves eve ext_client ext_server SDR server serverCA stapling tools/copydir" 1.70 + for i in $dirs 1.71 + do 1.72 + echo $i 1.73 + if [ -d $i ]; then 1.74 + echo "upgrading db $i" 1.75 + ${BINDIR}/certutil -G -g 512 -d sql:$i -f ${PWFILE} -z ${NOISE_FILE} 2>&1 1.76 + html_msg $? 0 "Upgrading $i" 1.77 + else 1.78 + echo "skipping db $i" 1.79 + html_msg 0 0 "No directory $i" 1.80 + fi 1.81 + done 1.82 + 1.83 + if [ -d fips ]; then 1.84 + echo "upgrading db fips" 1.85 + ${BINDIR}/certutil -S -g 512 -n tmprsa -t "u,u,u" -s "CN=tmprsa, C=US" -x -d sql:fips -f ${FIPSPWFILE} -z ${NOISE_FILE} 2>&1 1.86 + html_msg $? 0 "Upgrading fips" 1.87 + # remove our temp certificate we created in the fist token 1.88 + ${BINDIR}/certutil -F -n tmprsa -d sql:fips -f ${FIPSPWFILE} 2>&1 1.89 + ${BINDIR}/certutil -L -d sql:fips 2>&1 1.90 + fi 1.91 + 1.92 + html "</TABLE><BR>" 1.93 +} 1.94 + 1.95 +########################## dbupgrade_cleanup ########################### 1.96 +# local shell function to finish this script (no exit since it might be 1.97 +# sourced) 1.98 +######################################################################## 1.99 +dbupgrade_cleanup() 1.100 +{ 1.101 + cd ${QADIR} 1.102 + . common/cleanup.sh 1.103 +} 1.104 + 1.105 +################################# main ################################# 1.106 + 1.107 +dbupgrade_init 1.108 +dbupgrade_main 1.109 +dbupgrade_cleanup