~ubuntu-branches/ubuntu/jaunty/nss/jaunty-proposed

« back to all changes in this revision

Viewing changes to mozilla/security/nss/tests/cert/cert.sh

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Fabien Tassin, Alexander Sack
  • Date: 2009-01-11 15:06:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090111150617-iz4lw05qgy2odorl
Tags: 3.12.2~rc1-0ubuntu1
* New upstream snapshot: 3.12.2 RC1

[ Fabien Tassin <fta@ubuntu.com> ]
* Remove patch applied upstream:
  - drop debian/patches/80_security_tools.patch
  - update debian/patches/series
* Update diverged patches:
  - update debian/patches/38_kbsd.patch
  - update debian/patches/38_mips64_build.patch
* Add new symbols to symbols file
  - update debian/libnss3-1d.symbols

[ Alexander Sack <asac@ubuntu.com> ]
* disable soname patch to become binary compatible with upstream
  - update debian/patches/series
* flip links: libnss3.so <- libnss3.so.1d (before: libnss3.so ->
  libnss3.so.1d); same link flipping was done for all other previously
  soname patched libs: libnssutil3.so, libsmime3.so.1d, libssl3.so.1d
  - update debian/libnss3-1d.links
  - update debian/libnss3-1d.symbols
* properly transition links in preinst and postrm; also cover abort-
  cases in the other maintainer scripts
  - add debian/libnss3-1d.postinst
  - add debian/libnss3-1d.postrm
  - add debian/libnss3-1d.preinst
  - add debian/libnss3-1d.prerm
* remove hack from debian/rules that debian uses to recreate
  libsoftokn3.so with a versioned SONAME
  - update debian/rules
* install the unversioned .so binaries
  - update debian/rules
* only install the 4 main libraries into /usr/lib; all the others
  go to pkglibdir
  - update debian/rules
* higher bar for libnspr4 Build-Depend to >= 4.7.3~, which is
  the version where the soname droppage is going to happen
  - update debian/control
* explitily pass libraries to be used for dpkg-gensymbols run of
  dh_makeshlibs
  - update debian/rules
* fix lintian complain about no-shlibs-control-file
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
  if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
101
101
        ROOTCERTSFILE=`cygpath -m ${ROOTCERTSFILE}`
102
102
  fi
103
 
 
104
 
 
105
 
  ################## Generate noise for our CA cert. ######################
106
 
  # NOTE: these keys are only suitable for testing, as this whole thing 
107
 
  # bypasses the entropy gathering. Don't use this method to generate 
108
 
  # keys and certs for product use or deployment.
109
 
  #
110
 
  ps -efl > ${NOISE_FILE} 2>&1
111
 
  ps aux >> ${NOISE_FILE} 2>&1
112
 
  noise
113
 
 
114
103
}
115
104
 
116
105
cert_log() ######################    write the cert_status file
119
108
    echo $* >>${CERT_LOG_FILE}
120
109
}
121
110
 
122
 
################################ noise ##################################
123
 
# Generate noise for our certs
124
 
#
125
 
# NOTE: these keys are only suitable for testing, as this whole thing bypasses
126
 
# the entropy gathering. Don't use this method to generate keys and certs for
127
 
# product use or deployment.
128
 
#########################################################################
129
 
noise()
130
 
{
131
 
    #netstat >> ${NOISE_FILE} 2>&1
132
 
    date >> ${NOISE_FILE} 2>&1
133
 
}
134
 
 
135
111
################################ certu #################################
136
112
# local shell function to call certutil, also: writes action and options to
137
113
# stdout, sets variable RET and writes results to the html file results
1096
1072
 
1097
1073
  fi # if NSS_ENABLE_ECC=1
1098
1074
}
 
1075
 
 
1076
########################### cert_extensions_test #############################
 
1077
# local shell function to test cert extensions generation
 
1078
##############################################################################
 
1079
cert_extensions_test()
 
1080
{
 
1081
    COUNT=`expr ${COUNT} + 1`
 
1082
    CERTNAME=TestExt${COUNT}
 
1083
    CU_SUBJECT="CN=${CERTNAME}, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
 
1084
 
 
1085
    echo
 
1086
    echo certutil -d ${CERT_EXTENSIONS_DIR} -S -n ${CERTNAME} \
 
1087
        -t "u,u,u" -o /tmp/cert -s "${CU_SUBJECT}" -x -f ${R_PWFILE} \
 
1088
        -z "${R_NOISE_FILE}" -${OPT} \< ${TARG_FILE}
 
1089
    echo "certutil options:"
 
1090
    cat ${TARG_FILE}
 
1091
    ${BINDIR}/certutil -d ${CERT_EXTENSIONS_DIR} -S -n ${CERTNAME} \
 
1092
        -t "u,u,u" -o /tmp/cert -s "${CU_SUBJECT}" -x -f ${R_PWFILE} \
 
1093
        -z "${R_NOISE_FILE}" -${OPT} < ${TARG_FILE}
 
1094
    RET=$?
 
1095
    if [ "${RET}" -ne 0 ]; then
 
1096
        CERTFAILED=1
 
1097
        html_failed "${TESTNAME} (${COUNT}) - Create and Add Certificate" 
 
1098
        cert_log "ERROR: ${TESTNAME} - Create and Add Certificate failed" 
 
1099
        return 1
 
1100
    fi
 
1101
 
 
1102
    echo certutil -d ${CERT_EXTENSIONS_DIR} -L -n ${CERTNAME} 
 
1103
    EXTLIST=`${BINDIR}/certutil -d ${CERT_EXTENSIONS_DIR} -L -n ${CERTNAME}`
 
1104
    RET=$?
 
1105
    echo "${EXTLIST}"
 
1106
    if [ "${RET}" -ne 0 ]; then
 
1107
        CERTFAILED=1
 
1108
        html_failed "${TESTNAME} (${COUNT}) - List Certificate" 
 
1109
        cert_log "ERROR: ${TESTNAME} - List Certificate failed" 
 
1110
        return 1
 
1111
    fi
 
1112
 
 
1113
    for FL in `echo ${FILTERLIST} | tr \| ' '`; do
 
1114
        FL="`echo ${FL} | tr _ ' '`"
 
1115
        EXPSTAT=0
 
1116
        if [ X`echo "${FL}" | cut -c 1` = 'X!' ]; then
 
1117
            EXPSTAT=1
 
1118
            FL=`echo ${FL} | tr -d '!'`
 
1119
        fi
 
1120
        echo "${EXTLIST}" | grep "${FL}" >/dev/null 2>&1
 
1121
        RET=$?
 
1122
        if [ "${RET}" -ne "${EXPSTAT}" ]; then
 
1123
            CERTFAILED=1
 
1124
            html_failed "${TESTNAME} (${COUNT}) - Looking for ${FL}" "returned ${RET}, expected is ${EXPSTAT}" 
 
1125
            cert_log "ERROR: ${TESTNAME} - Looking for ${FL} failed"
 
1126
            return 1
 
1127
        fi
 
1128
    done
 
1129
 
 
1130
    html_passed "${TESTNAME} (${COUNT})"
 
1131
    return 0
 
1132
}
 
1133
 
1099
1134
############################## cert_extensions ###############################
1100
 
# local shell function to test cert extensions generation.
 
1135
# local shell function to run cert extensions tests
1101
1136
##############################################################################
1102
 
 
1103
 
checkRes()
1104
 
{
1105
 
    res=$1
1106
 
    filterList=$2
1107
 
    
1108
 
    [ $res -ne 0 ] && return 1
1109
 
 
1110
 
    for fl in `echo $filterList | tr \| ' '`; do
1111
 
        fl="`echo $fl | tr _ ' '`"
1112
 
        expStat=0
1113
 
        if [ X`echo "$fl" | cut -c 1` = 'X!' ]; then
1114
 
            expStat=1
1115
 
            fl=`echo $fl | tr -d '!'`
1116
 
        fi
1117
 
        ${BINDIR}/certutil -d ${CERT_EXTENSIONS_DIR} -L -n $CERTNAME | grep "$fl" >/dev/null 2>&1
1118
 
        [ $? -ne $expStat ] && return 1
1119
 
    done
1120
 
    return 0
1121
 
}
1122
 
 
1123
 
 
1124
1137
cert_extensions()
1125
1138
{
1126
 
 
1127
1139
    CERTNAME=TestExt
1128
 
    cert_create_cert ${CERT_EXTENSIONS_DIR} $CERTNAME 90 ${D_CERT_EXTENSTIONS}
 
1140
    cert_create_cert ${CERT_EXTENSIONS_DIR} ${CERTNAME} 90 ${D_CERT_EXTENSTIONS}
1129
1141
    TARG_FILE=${CERT_EXTENSIONS_DIR}/test.args
1130
1142
 
1131
 
    CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
1132
 
 
1133
 
    count=0
1134
 
    while read arg opt filterList; do
1135
 
        if [ X"`echo $arg | cut -c 1`" = "X#" ]; then
1136
 
            continue
1137
 
        fi
1138
 
        if [ X"`echo $arg | cut -c 1`" = "X!" ]; then
1139
 
            testName="$filterList"
1140
 
            continue
1141
 
        fi
1142
 
        if [ X"$arg" = "X=" ]; then
1143
 
            count=`expr $count + 1`
1144
 
            echo "#################################################"
1145
 
            CU_ACTION="Testing $testName"
1146
 
            ${BINDIR}/certutil -d ${CERT_EXTENSIONS_DIR} -D -n $CERTNAME
1147
 
            echo certutil -d ${CERT_EXTENSIONS_DIR} -S -n $CERTNAME \
1148
 
                -t "u,u,u" -o /tmp/cert -s "${CU_SUBJECT}" -x -f ${R_PWFILE} \
1149
 
                -z "${R_NOISE_FILE}" -$opt < $TARG_FILE
1150
 
            ${BINDIR}/certutil -d ${CERT_EXTENSIONS_DIR} -S -n $CERTNAME -t "u,u,u" \
1151
 
                -o /tmp/cert -s "${CU_SUBJECT}" -x -f ${R_PWFILE} \
1152
 
                -z "${R_NOISE_FILE}" -$opt < $TARG_FILE
1153
 
            ret=$?  
1154
 
            echo "certutil options:"
1155
 
            cat $TARG_FILE
1156
 
            checkRes $ret "$filterList"
1157
 
            RET=$?
1158
 
            if [ "$RET" -ne 0 ]; then
1159
 
                CERTFAILED=$RET
1160
 
                html_failed "${CU_ACTION} ($RET) " 
1161
 
                cert_log "ERROR: ${CU_ACTION} failed $RET"
1162
 
            else
1163
 
                html_passed "${CU_ACTION}"
1164
 
            fi
1165
 
            rm -f $TARG_FILE
 
1143
    COUNT=0
 
1144
    while read ARG OPT FILTERLIST; do
 
1145
        if [ X"`echo ${ARG} | cut -c 1`" = "X#" ]; then
 
1146
            continue
 
1147
        fi
 
1148
        if [ X"`echo ${ARG} | cut -c 1`" = "X!" ]; then
 
1149
            TESTNAME="${FILTERLIST}"
 
1150
            continue
 
1151
        fi
 
1152
        if [ X"${ARG}" = "X=" ]; then
 
1153
            cert_extensions_test
 
1154
            rm -f ${TARG_FILE}
1166
1155
        else
1167
 
            echo $arg >> $TARG_FILE
 
1156
            echo ${ARG} >> ${TARG_FILE}
1168
1157
        fi
1169
1158
    done < ${QADIR}/cert/certext.txt
1170
1159
}
1171
1160
 
1172
 
 
1173
1161
############################## cert_crl_ssl ############################
1174
1162
# local shell function to generate certs and crls for SSL tests
1175
1163
########################################################################
1397
1385
  CU_SUBJECT="CN=${CERTNAME}, E=password@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
1398
1386
  certu -S -n PasswordCert -c PasswordCA -t "u,u,u" -d "${PROFILEDIR}" -f "${R_FIPSPWFILE}" -z "${R_NOISE_FILE}" 2>&1
1399
1387
  if [ "$RET" -eq 0 ]; then
1400
 
    cert_log "SUCCESS: PASSORD passed"
 
1388
    cert_log "SUCCESS: PASSWORD passed"
1401
1389
  fi
1402
1390
  CU_ACTION="Verify Certificate for ${CERTNAME} with new password"
1403
1391
  certu -V -n PasswordCert -u S -d "${PROFILEDIR}" -f "${R_FIPSPWFILE}" 2>&1