~ubuntu-branches/ubuntu/quantal/nss/quantal-updates

« back to all changes in this revision

Viewing changes to mozilla/security/nss/tests/common/init.sh

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-11-14 14:58:07 UTC
  • mfrom: (1.1.19)
  • Revision ID: package-import@ubuntu.com-20131114145807-vj6v4erz8xj6kwz3
Tags: 3.15.3-0ubuntu0.12.10.1
* SECURITY UPDATE: New upstream release to fix multiple security issues
  and add TLSv1.2 support.
  - CVE-2013-1739
  - CVE-2013-1741
  - CVE-2013-5605
  - CVE-2013-5606
* Adjusted packaging for 3.15.3:
  - debian/patches/*: refreshed.
  - debian/patches/lower-dhe-priority.patch: removed, no longer needed,
    was a workaround for an old version of firefox.
  - debian/libnss3.symbols: added new symbols.
  - debian/rules: updated for new source layout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/bash
2
 
#
3
 
# This Source Code Form is subject to the terms of the Mozilla Public
4
 
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
 
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
 
 
7
 
########################################################################
8
 
#
9
 
# mozilla/security/nss/tests/common/init.sh
10
 
#
11
 
# initialization for NSS QA, can be included multiple times
12
 
# from all.sh and the individual scripts
13
 
#
14
 
# variables, utilities and shellfunctions global to NSS QA
15
 
# needs to work on all Unix and Windows platforms
16
 
#
17
 
# included from 
18
 
# -------------
19
 
#   all.sh
20
 
#   ssl.sh
21
 
#   sdr.sh
22
 
#   cipher.sh
23
 
#   perf.sh
24
 
#   cert.sh
25
 
#   smime.sh
26
 
#   tools.sh
27
 
#   fips.sh
28
 
#
29
 
# special strings
30
 
# ---------------
31
 
#   FIXME ... known problems, search for this string
32
 
#   NOTE .... unexpected behavior
33
 
#
34
 
# NOTE:
35
 
# -----
36
 
#    Unlike the old QA this is based on files sourcing each other
37
 
#    This is done to save time, since a great portion of time is lost
38
 
#    in calling and sourcing the same things multiple times over the
39
 
#    network. Also, this way all scripts have all shell function  available
40
 
#    and a completely common environment
41
 
#
42
 
########################################################################
43
 
 
44
 
NSS_STRICT_SHUTDOWN=1
45
 
export NSS_STRICT_SHUTDOWN
46
 
 
47
 
# Init directories based on HOSTDIR variable
48
 
if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
49
 
    init_directories()
50
 
    {
51
 
        TMP=${HOSTDIR}      #TMP=${TMP-/tmp}
52
 
        TEMP=${TMP}
53
 
        TMPDIR=${TMP}
54
 
 
55
 
        CADIR=${HOSTDIR}/CA
56
 
        SERVERDIR=${HOSTDIR}/server
57
 
        CLIENTDIR=${HOSTDIR}/client
58
 
        ALICEDIR=${HOSTDIR}/alicedir
59
 
        BOBDIR=${HOSTDIR}/bobdir
60
 
        DAVEDIR=${HOSTDIR}/dave
61
 
        EVEDIR=${HOSTDIR}/eve
62
 
        FIPSDIR=${HOSTDIR}/fips
63
 
        DBPASSDIR=${HOSTDIR}/dbpass
64
 
        ECCURVES_DIR=${HOSTDIR}/eccurves
65
 
        DISTRUSTDIR=${HOSTDIR}/distrust
66
 
 
67
 
        SERVER_CADIR=${HOSTDIR}/serverCA
68
 
        CLIENT_CADIR=${HOSTDIR}/clientCA
69
 
        EXT_SERVERDIR=${HOSTDIR}/ext_server
70
 
        EXT_CLIENTDIR=${HOSTDIR}/ext_client
71
 
 
72
 
        IOPR_CADIR=${HOSTDIR}/CA_iopr
73
 
        IOPR_SSL_SERVERDIR=${HOSTDIR}/server_ssl_iopr
74
 
        IOPR_SSL_CLIENTDIR=${HOSTDIR}/client_ssl_iopr
75
 
        IOPR_OCSP_CLIENTDIR=${HOSTDIR}/client_ocsp_iopr
76
 
 
77
 
        CERT_EXTENSIONS_DIR=${HOSTDIR}/cert_extensions
78
 
 
79
 
        PWFILE=${HOSTDIR}/tests.pw
80
 
        NOISE_FILE=${HOSTDIR}/tests_noise
81
 
        CORELIST_FILE=${HOSTDIR}/clist
82
 
 
83
 
        FIPSPWFILE=${HOSTDIR}/tests.fipspw
84
 
        FIPSBADPWFILE=${HOSTDIR}/tests.fipsbadpw
85
 
        FIPSP12PWFILE=${HOSTDIR}/tests.fipsp12pw
86
 
 
87
 
        echo "fIps140" > ${FIPSPWFILE}
88
 
        echo "fips104" > ${FIPSBADPWFILE}
89
 
        echo "pKcs12fips140" > ${FIPSP12PWFILE}
90
 
 
91
 
        noise
92
 
 
93
 
        P_SERVER_CADIR=${SERVER_CADIR}
94
 
        P_CLIENT_CADIR=${CLIENT_CADIR}
95
 
    
96
 
        if [ -n "${MULTIACCESS_DBM}" ]; then
97
 
            P_SERVER_CADIR="multiaccess:${D_SERVER_CA}"
98
 
            P_CLIENT_CADIR="multiaccess:${D_CLIENT_CA}"
99
 
        fi
100
 
 
101
 
 
102
 
        # a new log file, short - fast to search, mostly for tools to
103
 
        # see if their portion of the cert has succeeded, also for me -
104
 
        CERT_LOG_FILE=${HOSTDIR}/cert.log      #the output.log is so crowded...
105
 
 
106
 
        TEMPFILES=foobar   # keep "${PWFILE} ${NOISE_FILE}" around
107
 
 
108
 
        export HOSTDIR
109
 
    }
110
 
 
111
 
# Generate noise file
112
 
    noise()
113
 
    {
114
 
        # NOTE: these keys are only suitable for testing, as this whole thing 
115
 
        # bypasses the entropy gathering. Don't use this method to generate 
116
 
        # keys and certs for product use or deployment.
117
 
        ps -efl > ${NOISE_FILE} 2>&1
118
 
        ps aux >> ${NOISE_FILE} 2>&1
119
 
        date >> ${NOISE_FILE} 2>&1
120
 
    }
121
 
 
122
 
# Print selected environment variable (used for backup)
123
 
    env_backup()
124
 
    {
125
 
        echo "HOSTDIR=\"${HOSTDIR}\""
126
 
        echo "TABLE_ARGS="
127
 
        echo "NSS_TEST_DISABLE_CRL=${NSS_TEST_DISABLE_CRL}"
128
 
        echo "NSS_SSL_TESTS=\"${NSS_SSL_TESTS}\""
129
 
        echo "NSS_SSL_RUN=\"${NSS_SSL_RUN}\""
130
 
        echo "NSS_DEFAULT_DB_TYPE=${NSS_DEFAULT_DB_TYPE}"
131
 
        echo "export NSS_DEFAULT_DB_TYPE"
132
 
        echo "NSS_ENABLE_PKIX_VERIFY=${NSS_ENABLE_PKIX_VERIFY}"
133
 
        echo "export NSS_ENABLE_PKIX_VERIFY"
134
 
        echo "init_directories"
135
 
    }
136
 
 
137
 
# Exit shellfunction to clean up at exit (error, regular or signal)
138
 
    Exit()
139
 
    {
140
 
        if [ -n "$1" ] ; then
141
 
            echo "$SCRIPTNAME: Exit: $* - FAILED"
142
 
            html_failed "$*"
143
 
        fi
144
 
        echo "</TABLE><BR>" >> ${RESULTS}
145
 
        if [ -n "${SERVERPID}" -a -f "${SERVERPID}" ]; then
146
 
            ${KILL} `cat ${SERVERPID}`
147
 
        fi
148
 
        cd ${QADIR}
149
 
        . common/cleanup.sh
150
 
        case $1 in
151
 
            [0-4][0-9]|[0-9])
152
 
                exit $1;
153
 
                ;;
154
 
            *)
155
 
                exit 1
156
 
                ;;
157
 
        esac
158
 
    }
159
 
 
160
 
    detect_core()
161
 
    {
162
 
        [ ! -f $CORELIST_FILE ] && touch $CORELIST_FILE
163
 
        mv $CORELIST_FILE ${CORELIST_FILE}.old
164
 
        coreStr=`find $HOSTDIR -type f -name '*core*'`
165
 
        res=0
166
 
        if [ -n "$coreStr" ]; then
167
 
            sum $coreStr > $CORELIST_FILE
168
 
            res=`cat $CORELIST_FILE ${CORELIST_FILE}.old | sort | uniq -u | wc -l`
169
 
        fi
170
 
        return $res
171
 
    }
172
 
 
173
 
#html functions to give the resultfiles a consistant look
174
 
    html() #########################    write the results.html file
175
 
    {      # 3 functions so we can put targets in the output.log easier
176
 
        echo $* >>${RESULTS}
177
 
    }
178
 
    html_passed()
179
 
    {
180
 
        html_detect_core "$@" || return
181
 
        MSG_ID=`cat ${MSG_ID_FILE}`
182
 
        MSG_ID=`expr ${MSG_ID} + 1`
183
 
        echo ${MSG_ID} > ${MSG_ID_FILE}
184
 
        html "<TR><TD>#${MSG_ID}: $1 ${HTML_PASSED}"
185
 
        echo "${SCRIPTNAME}: #${MSG_ID}: $* - PASSED"
186
 
    }
187
 
    html_failed()
188
 
    {
189
 
        html_detect_core "$@" || return
190
 
        MSG_ID=`cat ${MSG_ID_FILE}`
191
 
        MSG_ID=`expr ${MSG_ID} + 1`
192
 
        echo ${MSG_ID} > ${MSG_ID_FILE}
193
 
        html "<TR><TD>#${MSG_ID}: $1 ${HTML_FAILED}"
194
 
        echo "${SCRIPTNAME}: #${MSG_ID}: $* - FAILED"
195
 
    }
196
 
    html_unknown()
197
 
    {
198
 
        html_detect_core "$@" || return
199
 
        MSG_ID=`cat ${MSG_ID_FILE}`
200
 
        MSG_ID=`expr ${MSG_ID} + 1`
201
 
        echo ${MSG_ID} > ${MSG_ID_FILE}
202
 
        html "<TR><TD>#${MSG_ID}: $1 ${HTML_UNKNOWN}"
203
 
        echo "${SCRIPTNAME}: #${MSG_ID}: $* - UNKNOWN"
204
 
    }
205
 
    html_detect_core()
206
 
    {
207
 
        detect_core
208
 
        if [ $? -ne 0 ]; then
209
 
            MSG_ID=`cat ${MSG_ID_FILE}`
210
 
            MSG_ID=`expr ${MSG_ID} + 1`
211
 
            echo ${MSG_ID} > ${MSG_ID_FILE}
212
 
            html "<TR><TD>#${MSG_ID}: $* ${HTML_FAILED_CORE}"
213
 
            echo "${SCRIPTNAME}: #${MSG_ID}: $* - Core file is detected - FAILED"
214
 
            return 1
215
 
        fi
216
 
        return 0
217
 
    }
218
 
    html_head()
219
 
    {
220
 
        
221
 
        html "<TABLE BORDER=1 ${TABLE_ARGS}><TR><TH COLSPAN=3>$*</TH></TR>"
222
 
        html "<TR><TH width=500>Test Case</TH><TH width=50>Result</TH></TR>" 
223
 
        echo "$SCRIPTNAME: $* ==============================="
224
 
    }
225
 
    html_msg()
226
 
    {
227
 
        if [ "$1" -ne "$2" ] ; then
228
 
            html_failed "$3" "$4"
229
 
        else
230
 
            html_passed "$3" "$4"
231
 
        fi
232
 
    }
233
 
    HTML_FAILED='</TD><TD bgcolor=red>Failed</TD><TR>'
234
 
    HTML_FAILED_CORE='</TD><TD bgcolor=red>Failed Core</TD><TR>'
235
 
    HTML_PASSED='</TD><TD bgcolor=lightGreen>Passed</TD><TR>'
236
 
    HTML_UNKNOWN='</TD><TD>Unknown/TD><TR>'
237
 
    TABLE_ARGS=
238
 
 
239
 
 
240
 
#directory name init
241
 
    SCRIPTNAME=init.sh
242
 
 
243
 
    mozilla_root=`(cd ../../../..; pwd)`
244
 
    MOZILLA_ROOT=${MOZILLA_ROOT-$mozilla_root}
245
 
 
246
 
    qadir=`(cd ..; pwd)`
247
 
    QADIR=${QADIR-$qadir}
248
 
 
249
 
    common=${QADIR}/common
250
 
    COMMON=${TEST_COMMON-$common}
251
 
    export COMMON
252
 
 
253
 
    DIST=${DIST-${MOZILLA_ROOT}/dist}
254
 
    SECURITY_ROOT=${SECURITY_ROOT-${MOZILLA_ROOT}/security/nss}
255
 
    TESTDIR=${TESTDIR-${MOZILLA_ROOT}/tests_results/security}
256
 
 
257
 
    # Allow for override options from a config file
258
 
    if [ -n "${OBJDIR}" -a -f ${DIST}/${OBJDIR}/platform.cfg ]; then
259
 
        . ${DIST}/${OBJDIR}/platform.cfg
260
 
    fi
261
 
 
262
 
    # only need make if we don't already have certain variables set
263
 
    if [ -z "${OBJDIR}" -o -z "${OS_ARCH}" -o -z "${DLL_PREFIX}" -o -z "${DLL_SUFFIX}" ]; then
264
 
        MAKE=gmake
265
 
        $MAKE -v >/dev/null 2>&1 || MAKE=make
266
 
        $MAKE -v >/dev/null 2>&1 || { echo "You are missing make."; exit 5; }
267
 
        MAKE="$MAKE --no-print-directory"
268
 
    fi
269
 
 
270
 
    if [ "${OBJDIR}" = "" ]; then
271
 
        OBJDIR=`(cd $COMMON; $MAKE objdir_name)`
272
 
    fi
273
 
    if [ "${OS_ARCH}" = "" ]; then
274
 
        OS_ARCH=`(cd $COMMON; $MAKE os_arch)`
275
 
    fi
276
 
    if [ "${DLL_PREFIX}" = "" ]; then
277
 
        DLL_PREFIX=`(cd $COMMON; $MAKE dll_prefix)`
278
 
    fi
279
 
    if [ "${DLL_SUFFIX}" = "" ]; then
280
 
        DLL_SUFFIX=`(cd $COMMON; $MAKE dll_suffix)`
281
 
    fi
282
 
    OS_NAME=`uname -s | sed -e "s/-[0-9]*\.[0-9]*//" | sed -e "s/-WOW64//"`
283
 
 
284
 
    BINDIR="${DIST}/${OBJDIR}/bin"
285
 
 
286
 
    # Pathnames constructed from ${TESTDIR} are passed to NSS tools
287
 
    # such as certutil, which don't understand Cygwin pathnames.
288
 
    # So we need to convert ${TESTDIR} to a Windows pathname (with
289
 
    # regular slashes).
290
 
    if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
291
 
        TESTDIR=`cygpath -m ${TESTDIR}`
292
 
        QADIR=`cygpath -m ${QADIR}`
293
 
    fi
294
 
 
295
 
    # Same problem with MSYS/Mingw, except we need to start over with pwd -W
296
 
    if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "MINGW32_NT" ]; then
297
 
                mingw_mozilla_root=`(cd ../../../..; pwd -W)`
298
 
                MINGW_MOZILLA_ROOT=${MINGW_MOZILLA_ROOT-$mingw_mozilla_root}
299
 
                TESTDIR=${MINGW_TESTDIR-${MINGW_MOZILLA_ROOT}/tests_results/security}
300
 
    fi
301
 
 
302
 
    # Same problem with MSYS/Mingw, except we need to start over with pwd -W
303
 
    if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "MINGW32_NT" ]; then
304
 
                mingw_mozilla_root=`(cd ../../../..; pwd -W)`
305
 
                MINGW_MOZILLA_ROOT=${MINGW_MOZILLA_ROOT-$mingw_mozilla_root}
306
 
                TESTDIR=${MINGW_TESTDIR-${MINGW_MOZILLA_ROOT}/tests_results/security}
307
 
    fi
308
 
    echo testdir is $TESTDIR
309
 
 
310
 
#in case of backward comp. tests the calling scripts set the
311
 
#PATH and LD_LIBRARY_PATH and do not want them to be changed
312
 
    if [ -z "${DON_T_SET_PATHS}" -o "${DON_T_SET_PATHS}" != "TRUE" ] ; then
313
 
        if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME"  != "CYGWIN_NT" -a "$OS_NAME" != "MINGW32_NT" ]; then
314
 
            PATH=.\;${DIST}/${OBJDIR}/bin\;${DIST}/${OBJDIR}/lib\;$PATH
315
 
            PATH=`perl ../path_uniq -d ';' "$PATH"`
316
 
        elif [ "${OS_ARCH}" = "Android" ]; then
317
 
            # android doesn't have perl, skip the uniq step
318
 
            PATH=.:${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:$PATH
319
 
        else 
320
 
            PATH=.:${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:/bin:/usr/bin:$PATH
321
 
            # added /bin and /usr/bin in the beginning so a local perl will 
322
 
            # be used
323
 
            PATH=`perl ../path_uniq -d ':' "$PATH"`
324
 
        fi
325
 
 
326
 
        LD_LIBRARY_PATH=${DIST}/${OBJDIR}/lib:$LD_LIBRARY_PATH
327
 
        SHLIB_PATH=${DIST}/${OBJDIR}/lib:$SHLIB_PATH
328
 
        LIBPATH=${DIST}/${OBJDIR}/lib:$LIBPATH
329
 
        DYLD_LIBRARY_PATH=${DIST}/${OBJDIR}/lib:$DYLD_LIBRARY_PATH
330
 
    fi
331
 
 
332
 
    if [ ! -d "${TESTDIR}" ]; then
333
 
        echo "$SCRIPTNAME init: Creating ${TESTDIR}"
334
 
        mkdir -p ${TESTDIR}
335
 
    fi
336
 
 
337
 
#HOST and DOMSUF are needed for the server cert
338
 
 
339
 
    DOMAINNAME=`which domainname`
340
 
    if [ -z "${DOMSUF}" -a $? -eq 0 -a -n "${DOMAINNAME}" ]; then
341
 
        DOMSUF=`domainname`
342
 
    fi
343
 
 
344
 
    case $HOST in
345
 
        *\.*)
346
 
            if [ -z "${DOMSUF}" ]; then
347
 
                DOMSUF=`echo $HOST | sed -e "s/^[^.]*\.//"`
348
 
            fi
349
 
            HOST=`echo $HOST | sed -e "s/\..*//"`
350
 
            ;;
351
 
        ?*)
352
 
            ;;
353
 
        *)
354
 
            HOST=`uname -n`
355
 
            case $HOST in
356
 
                *\.*)
357
 
                    if [ -z "${DOMSUF}" ]; then
358
 
                        DOMSUF=`echo $HOST | sed -e "s/^[^.]*\.//"`
359
 
                    fi
360
 
                    HOST=`echo $HOST | sed -e "s/\..*//"`
361
 
                    ;;
362
 
                ?*)
363
 
                    ;;
364
 
                *)
365
 
                    echo "$SCRIPTNAME: Fatal HOST environment variable is not defined."
366
 
                    exit 1 #does not need to be Exit, very early in script
367
 
                    ;;
368
 
            esac
369
 
            ;;
370
 
    esac
371
 
 
372
 
    if [ -z "${DOMSUF}" -a "${OS_ARCH}" != "Android" ]; then
373
 
        echo "$SCRIPTNAME: Fatal DOMSUF env. variable is not defined."
374
 
        exit 1 #does not need to be Exit, very early in script
375
 
    fi
376
 
 
377
 
#HOSTADDR was a workaround for the dist. stress test, and is probably 
378
 
#not needed anymore (purpose: be able to use IP address for the server 
379
 
#cert instead of PC name which was not in the DNS because of dyn IP address
380
 
    if [ -z "$USE_IP" -o "$USE_IP" != "TRUE" ] ; then
381
 
        if [ -z "${DOMSUF}" ]; then
382
 
            HOSTADDR=${HOST}
383
 
        else
384
 
            HOSTADDR=${HOST}.${DOMSUF}
385
 
        fi
386
 
    else
387
 
        HOSTADDR=${IP_ADDRESS}
388
 
    fi
389
 
 
390
 
#if running remote side of the distributed stress test we need to use 
391
 
#the files that the server side gives us...
392
 
    if [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then
393
 
        for w in `ls -rtd ${TESTDIR}/${HOST}.[0-9]* 2>/dev/null |
394
 
            sed -e "s/.*${HOST}.//"` ; do
395
 
                version=$w
396
 
        done
397
 
        HOSTDIR=${TESTDIR}/${HOST}.$version
398
 
        echo "$SCRIPTNAME init: HOSTDIR $HOSTDIR"
399
 
        echo $HOSTDIR
400
 
        if [ ! -d $HOSTDIR ] ; then
401
 
            echo "$SCRIPTNAME: Fatal: Remote side of dist. stress test "
402
 
            echo "       - server HOSTDIR $HOSTDIR does not exist"
403
 
            exit 1 #does not need to be Exit, very early in script
404
 
        fi
405
 
    fi
406
 
 
407
 
#find the HOSTDIR, where the results are supposed to go
408
 
    if [ -n "${HOSTDIR}" ]; then
409
 
        version=`echo $HOSTDIR | sed  -e "s/.*${HOST}.//"` 
410
 
    else
411
 
        if [ -f "${TESTDIR}/${HOST}" ]; then
412
 
            version=`cat ${TESTDIR}/${HOST}`
413
 
        else
414
 
            version=1
415
 
        fi
416
 
#file has a tendency to disappear, messing up the rest of QA - 
417
 
#workaround to find the next higher number if version file is not there
418
 
        if [ -z "${version}" ]; then    # for some strange reason this file
419
 
                                        # gets truncated at times... Windos
420
 
            for w in `ls -d ${TESTDIR}/${HOST}.[0-9]* 2>/dev/null |
421
 
                sort -t '.' -n | sed -e "s/.*${HOST}.//"` ; do
422
 
                version=`expr $w + 1`
423
 
            done
424
 
            if [ -z "${version}" ]; then
425
 
                version=1
426
 
            fi
427
 
        fi
428
 
        expr $version + 1 > ${TESTDIR}/${HOST}
429
 
 
430
 
        HOSTDIR=${TESTDIR}/${HOST}'.'$version
431
 
 
432
 
        mkdir -p ${HOSTDIR}
433
 
    fi
434
 
 
435
 
#result and log file and filename init,
436
 
    if [ -z "${LOGFILE}" ]; then
437
 
        LOGFILE=${HOSTDIR}/output.log
438
 
    fi
439
 
    if [ ! -f "${LOGFILE}" ]; then
440
 
        touch ${LOGFILE}
441
 
    fi
442
 
    if [ -z "${RESULTS}" ]; then
443
 
        RESULTS=${HOSTDIR}/results.html
444
 
    fi
445
 
    if [ ! -f "${RESULTS}" ]; then
446
 
        cp ${COMMON}/results_header.html ${RESULTS}
447
 
        html "<H4>Platform: ${OBJDIR}<BR>" 
448
 
        html "Test Run: ${HOST}.$version</H4>" 
449
 
        html "${BC_ACTION}"
450
 
        html "<HR><BR>" 
451
 
        html "<HTML><BODY>" 
452
 
 
453
 
        echo "********************************************" | tee -a ${LOGFILE}
454
 
        echo "   Platform: ${OBJDIR}"                       | tee -a ${LOGFILE}
455
 
        echo "   Results: ${HOST}.$version"                 | tee -a ${LOGFILE}
456
 
        echo "********************************************" | tee -a ${LOGFILE}
457
 
        echo "$BC_ACTION"                                   | tee -a ${LOGFILE}
458
 
#if running remote side of the distributed stress test 
459
 
# let the user know who it is...
460
 
    elif [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then
461
 
        echo "********************************************" | tee -a ${LOGFILE}
462
 
        echo "   Platform: ${OBJDIR}"                       | tee -a ${LOGFILE}
463
 
        echo "   Results: ${HOST}.$version"                 | tee -a ${LOGFILE}
464
 
        echo "   remote side of distributed stress test "   | tee -a ${LOGFILE}
465
 
        echo "   `uname -n -s`"                             | tee -a ${LOGFILE}
466
 
        echo "********************************************" | tee -a ${LOGFILE}
467
 
    fi
468
 
 
469
 
    echo "$SCRIPTNAME init: Testing PATH $PATH against LIB $LD_LIBRARY_PATH" |\
470
 
        tee -a ${LOGFILE}
471
 
 
472
 
    KILL="kill"
473
 
 
474
 
    if [ `uname -s` = "SunOS" ]; then
475
 
        PS="/usr/5bin/ps"
476
 
    else
477
 
        PS="ps"
478
 
    fi
479
 
#found 3 rsh's so far that do not work as expected - cygnus mks6 
480
 
#(restricted sh) and mks 7 - if it is not in c:/winnt/system32 it
481
 
#needs to be set in the environ.ksh
482
 
    if [ -z "$RSH" ]; then
483
 
        if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME"  = "CYGWIN_NT" ]; then
484
 
            RSH=/cygdrive/c/winnt/system32/rsh
485
 
        elif [ "${OS_ARCH}" = "WINNT" ]; then
486
 
            RSH=c:/winnt/system32/rsh
487
 
        else
488
 
            RSH=rsh
489
 
        fi
490
 
    fi
491
 
   
492
 
 
493
 
#more filename and directoryname init
494
 
    CURDIR=`pwd`
495
 
 
496
 
    CU_ACTION='Unknown certutil action'
497
 
 
498
 
    # would like to preserve some tmp files, also easier to see if there 
499
 
    # are "leftovers" - another possibility ${HOSTDIR}/tmp
500
 
 
501
 
    init_directories
502
 
 
503
 
    FIPSCERTNICK="FIPS_PUB_140_Test_Certificate"
504
 
 
505
 
    # domains to handle ipc based access to databases
506
 
    D_CA="TestCA.$version"
507
 
    D_ALICE="Alice.$version"
508
 
    D_BOB="Bob.$version"
509
 
    D_DAVE="Dave.$version"
510
 
    D_EVE="Eve.$version"
511
 
    D_SERVER_CA="ServerCA.$version"
512
 
    D_CLIENT_CA="ClientCA.$version"
513
 
    D_SERVER="Server.$version"
514
 
    D_CLIENT="Client.$version"
515
 
    D_FIPS="FIPS.$version"
516
 
    D_DBPASS="DBPASS.$version"
517
 
    D_ECCURVES="ECCURVES.$version"
518
 
    D_EXT_SERVER="ExtendedServer.$version"
519
 
    D_EXT_CLIENT="ExtendedClient.$version"
520
 
    D_CERT_EXTENSTIONS="CertExtensions.$version"
521
 
    D_DISTRUST="Distrust.$version"
522
 
 
523
 
    # we need relative pathnames of these files abd directories, since our 
524
 
    # tools can't handle the unix style absolut pathnames on cygnus
525
 
 
526
 
    R_CADIR=../CA
527
 
    R_SERVERDIR=../server
528
 
    R_CLIENTDIR=../client
529
 
    R_IOPR_CADIR=../CA_iopr
530
 
    R_IOPR_SSL_SERVERDIR=../server_ssl_iopr
531
 
    R_IOPR_SSL_CLIENTDIR=../client_ssl_iopr
532
 
    R_IOPR_OCSP_CLIENTDIR=../client_ocsp_iopr
533
 
    R_ALICEDIR=../alicedir
534
 
    R_BOBDIR=../bobdir
535
 
    R_DAVEDIR=../dave
536
 
    R_EVEDIR=../eve
537
 
    R_EXT_SERVERDIR=../ext_server
538
 
    R_EXT_CLIENTDIR=../ext_client
539
 
    R_CERT_EXT=../cert_extensions
540
 
 
541
 
    #
542
 
    # profiles are either paths or domains depending on the setting of
543
 
    # MULTIACCESS_DBM
544
 
    #
545
 
    P_R_CADIR=${R_CADIR}
546
 
    P_R_ALICEDIR=${R_ALICEDIR}
547
 
    P_R_BOBDIR=${R_BOBDIR}
548
 
    P_R_DAVEDIR=${R_DAVEDIR}
549
 
    P_R_EVEDIR=${R_EVEDIR}
550
 
    P_R_SERVERDIR=${R_SERVERDIR}
551
 
    P_R_CLIENTDIR=${R_CLIENTDIR}
552
 
    P_R_EXT_SERVERDIR=${R_EXT_SERVERDIR}
553
 
    P_R_EXT_CLIENTDIR=${R_EXT_CLIENTDIR}
554
 
    if [ -n "${MULTIACCESS_DBM}" ]; then
555
 
        P_R_CADIR="multiaccess:${D_CA}"
556
 
        P_R_ALICEDIR="multiaccess:${D_ALICE}"
557
 
        P_R_BOBDIR="multiaccess:${D_BOB}"
558
 
        P_R_DAVEDIR="multiaccess:${D_DAVE}"
559
 
        P_R_EVEDIR="multiaccess:${D_EVE}"
560
 
        P_R_SERVERDIR="multiaccess:${D_SERVER}"
561
 
        P_R_CLIENTDIR="multiaccess:${D_CLIENT}"
562
 
        P_R_EXT_SERVERDIR="multiaccess:${D_EXT_SERVER}"
563
 
        P_R_EXT_CLIENTDIR="multiaccess:${D_EXT_CLIENT}"
564
 
    fi
565
 
 
566
 
    R_PWFILE=../tests.pw
567
 
    R_NOISE_FILE=../tests_noise
568
 
 
569
 
    R_FIPSPWFILE=../tests.fipspw
570
 
    R_FIPSBADPWFILE=../tests.fipsbadpw
571
 
    R_FIPSP12PWFILE=../tests.fipsp12pw
572
 
 
573
 
    trap "Exit $0 Signal_caught" 2 3
574
 
 
575
 
    export PATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH DYLD_LIBRARY_PATH
576
 
    export DOMSUF HOSTADDR
577
 
    export KILL PS
578
 
    export MOZILLA_ROOT SECURITY_ROOT DIST TESTDIR OBJDIR QADIR
579
 
    export LOGFILE SCRIPTNAME
580
 
 
581
 
#used for the distributed stress test, the server generates certificates 
582
 
#from GLOB_MIN_CERT to GLOB_MAX_CERT 
583
 
# NOTE - this variable actually gets initialized by directly by the 
584
 
# ssl_dist_stress.shs sl_ds_init() before init is called - need to change 
585
 
# in  both places. speaking of data encapsulatioN...
586
 
 
587
 
    if [ -z "$GLOB_MIN_CERT" ] ; then
588
 
        GLOB_MIN_CERT=0
589
 
    fi
590
 
    if [ -z "$GLOB_MAX_CERT" ] ; then
591
 
        GLOB_MAX_CERT=200
592
 
    fi
593
 
    if [ -z "$MIN_CERT" ] ; then
594
 
        MIN_CERT=$GLOB_MIN_CERT
595
 
    fi
596
 
    if [ -z "$MAX_CERT" ] ; then
597
 
        MAX_CERT=$GLOB_MAX_CERT
598
 
    fi
599
 
 
600
 
    #################################################
601
 
    # CRL SSL testing constatnts
602
 
    #
603
 
 
604
 
 
605
 
    CRL_GRP_1_BEGIN=40
606
 
    CRL_GRP_1_RANGE=3
607
 
    UNREVOKED_CERT_GRP_1=41
608
 
 
609
 
    CRL_GRP_2_BEGIN=43
610
 
    CRL_GRP_2_RANGE=6
611
 
    UNREVOKED_CERT_GRP_2=46
612
 
 
613
 
    CRL_GRP_3_BEGIN=49
614
 
    CRL_GRP_3_RANGE=4
615
 
    UNREVOKED_CERT_GRP_3=51
616
 
 
617
 
    TOTAL_CRL_RANGE=`expr ${CRL_GRP_1_RANGE} + ${CRL_GRP_2_RANGE} + \
618
 
                     ${CRL_GRP_3_RANGE}`
619
 
 
620
 
    TOTAL_GRP_NUM=3
621
 
    
622
 
    RELOAD_CRL=1
623
 
 
624
 
    NSS_DEFAULT_DB_TYPE="dbm"
625
 
    export NSS_DEFAULT_DB_TYPE
626
 
 
627
 
    MSG_ID_FILE="${HOSTDIR}/id"
628
 
    MSG_ID=0
629
 
    echo ${MSG_ID} > ${MSG_ID_FILE}
630
 
 
631
 
    #################################################
632
 
    # Interoperability testing constatnts
633
 
    #
634
 
    # if suite is setup for testing, IOPR_HOSTADDR_LIST should have
635
 
    # at least one host name(FQDN)
636
 
    # Example   IOPR_HOSTADDR_LIST="goa1.SFBay.Sun.COM"
637
 
 
638
 
    if [ -z "`echo ${IOPR_HOSTADDR_LIST} | grep '[A-Za-z]'`" ]; then
639
 
        IOPR=0
640
 
    else
641
 
        IOPR=1
642
 
    fi
643
 
    #################################################
644
 
 
645
 
    if [ "${OS_ARCH}" != "WINNT" -a "${OS_ARCH}" != "Android" ]; then
646
 
        ulimit -c unlimited
647
 
    fi 
648
 
 
649
 
    SCRIPTNAME=$0
650
 
    INIT_SOURCED=TRUE   #whatever one does - NEVER export this one please
651
 
fi