~ubuntu-branches/ubuntu/raring/nss/raring-security

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-25 13:46:06 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100325134606-bl6liuok2w9l7snv
Tags: 3.12.6-0ubuntu1
* New upstream release 3.12.6 RTM (NSS_3_12_6_RTM)
  - fixes CVE-2009-3555 aka US-CERT VU#120541
* Adjust patches to changed upstream code base
  - update debian/patches/38_kbsd.patch
  - update debian/patches/38_mips64_build.patch
  - update debian/patches/85_security_load.patch
* Remove patches that are merged upstream
  - delete debian/patches/91_nonexec_stack.patch
  - update debian/patches/series
* Bump nspr dependency to 4.8
  - update debian/control
* Add new symbols for 3.12.6
  - update debian/libnss3-1d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh  
 
2
#
 
3
# ***** BEGIN LICENSE BLOCK *****
 
4
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
5
#
 
6
# The contents of this file are subject to the Mozilla Public License Version
 
7
# 1.1 (the "License"); you may not use this file except in compliance with
 
8
# the License. You may obtain a copy of the License at
 
9
# http://www.mozilla.org/MPL/
 
10
#
 
11
# Software distributed under the License is distributed on an "AS IS" basis,
 
12
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
13
# for the specific language governing rights and limitations under the
 
14
# License.
 
15
#
 
16
# The Original Code is the Netscape security libraries.
 
17
#
 
18
# The Initial Developer of the Original Code is
 
19
# Netscape Communications Corporation.
 
20
# Portions created by the Initial Developer are Copyright (C) 1994-2000
 
21
# the Initial Developer. All Rights Reserved.
 
22
#
 
23
# Contributor(s):
 
24
#   Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
 
25
#
 
26
# Alternatively, the contents of this file may be used under the terms of
 
27
# either the GNU General Public License Version 2 or later (the "GPL"), or
 
28
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
29
# in which case the provisions of the GPL or the LGPL are applicable instead
 
30
# of those above. If you wish to allow use of your version of this file only
 
31
# under the terms of either the GPL or the LGPL, and not to allow others to
 
32
# use your version of this file under the terms of the MPL, indicate your
 
33
# decision by deleting the provisions above and replace them with the notice
 
34
# and other provisions required by the GPL or the LGPL. If you do not delete
 
35
# the provisions above, a recipient may use your version of this file under
 
36
# the terms of any one of the MPL, the GPL or the LGPL.
 
37
#
 
38
# ***** END LICENSE BLOCK *****
 
39
 
 
40
########################################################################
 
41
#
 
42
# mozilla/security/nss/tests/multinit/multinit.sh
 
43
#
 
44
# Script to test NSS multinit
 
45
#
 
46
# needs to work on all Unix and Windows platforms
 
47
#
 
48
# special strings
 
49
# ---------------
 
50
#   FIXME ... known problems, search for this string
 
51
#   NOTE .... unexpected behavior
 
52
#
 
53
########################################################################
 
54
 
 
55
############################## multinit_init ##############################
 
56
# local shell function to initialize this script
 
57
########################################################################
 
58
multinit_init()
 
59
{
 
60
  SCRIPTNAME=multinit.sh      # sourced - $0 would point to all.sh
 
61
 
 
62
  if [ -z "${CLEANUP}" ] ; then     # if nobody else is responsible for
 
63
      CLEANUP="${SCRIPTNAME}"       # cleaning this script will do it
 
64
  fi
 
65
 
 
66
  if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
 
67
      cd ../common
 
68
      . ./init.sh
 
69
  fi
 
70
  if [ ! -r $CERT_LOG_FILE ]; then  # we need certificates here
 
71
      cd ../cert
 
72
      . ./cert.sh
 
73
  fi
 
74
  SCRIPTNAME=multinit.sh
 
75
 
 
76
  html_head "MULTI Tests"
 
77
 
 
78
  grep "SUCCESS: SMIME passed" $CERT_LOG_FILE >/dev/null || {
 
79
      Exit 11 "Fatal - S/MIME of cert.sh needs to pass first"
 
80
  }
 
81
 
 
82
  # set up our directories
 
83
  MULTINITDIR=${HOSTDIR}/multinit
 
84
  MULTINITDIR_1=${MULTINITDIR}/dir1
 
85
  MULTINITDIR_2=${MULTINITDIR}/dir2
 
86
  MULTINITDIR_3=${MULTINITDIR}/dir3
 
87
  R_MULINITDIR=../multinit
 
88
  R_MULTINITDIR_1=${R_MULTINITDIR}/dir1
 
89
  R_MULTINITDIR_2=${R_MULTINITDIR}/dir2
 
90
  R_MULTINITDIR_3=${R_MULTINITDIR}/dir3
 
91
  # first create them all
 
92
  mkdir -p ${MULTINITDIR}
 
93
  mkdir -p ${MULTINITDIR_1}
 
94
  mkdir -p ${MULTINITDIR_2}
 
95
  mkdir -p ${MULTINITDIR_3}
 
96
  # now copy them fro alice, bob, and dave
 
97
  cd ${MULTINITDIR}
 
98
  cp ${P_R_ALICEDIR}/* ${MULTINITDIR_1}/
 
99
  cp ${P_R_BOBDIR}/*   ${MULTINITDIR_2}/
 
100
  cp ${P_R_DAVEDIR}/*  ${MULTINITDIR_3}/
 
101
  # finally delete the RootCerts module to keep the certificate noice in the
 
102
  # summary lines down
 
103
  echo | modutil -delete RootCerts -dbdir ${MULTINITDIR_1}
 
104
  echo | modutil -delete RootCerts -dbdir ${MULTINITDIR_2}
 
105
  echo | modutil -delete RootCerts -dbdir ${MULTINITDIR_3}
 
106
  MULTINIT_TESTS=${QADIR}/multinit/multinit.txt
 
107
}
 
108
 
 
109
 
 
110
############################## multinit_main ##############################
 
111
# local shell function to test basic signed and enveloped messages 
 
112
# from 1 --> 2"
 
113
########################################################################
 
114
multinit_main()
 
115
{
 
116
  html_head "Multi init interface testing"
 
117
  exec < ${MULTINIT_TESTS}
 
118
  while read order commands shutdown_type dirs readonly testname
 
119
  do
 
120
    if [ "$order" != "#" ]; then
 
121
        read tag expected_result
 
122
 
 
123
        # handle the case where we expect different results based on
 
124
        # the database type.
 
125
        if [ "$tag" != "all" ]; then
 
126
            read tag2 expected_result2
 
127
            if [ "$NSS_DEFAULT_DB_TYPE" == "$tag2" ]; then
 
128
                expected_result=$expected_result2
 
129
            fi
 
130
        fi
 
131
 
 
132
        # convert shutdown type to option flags
 
133
        shutdown_command="";
 
134
        if [ "$shutdown_type" == "old" ]; then
 
135
           shutdown_command="--oldStype"
 
136
        fi
 
137
 
 
138
        # convert read only to option flags
 
139
        ro_command="";
 
140
        case $readonly in
 
141
        all)  ro_command="--main_readonly --lib1_readonly --lib2_readonly";;
 
142
        libs) ro_command="--lib1_readonly --lib2_readonly";;
 
143
        main) ro_command="--main_readonly";;
 
144
        lib1) ro_command="--lib1_readonly";;
 
145
        lib2) ro_command="--lib2_readonly";;
 
146
        none) ;;
 
147
        *) ;;
 
148
        esac
 
149
 
 
150
        # convert commands to option flags
 
151
        main_command=`echo $commands | sed -e 's;,.*$;;'`
 
152
        lib1_command=`echo $commands | sed -e 's;,.*,;+&+;' -e 's;^.*+,;;' -e 's;,+.*$;;'`
 
153
        lib2_command=`echo $commands | sed -e 's;^.*,;;'`
 
154
 
 
155
        # convert db's to option flags
 
156
        main_db=`echo $dirs | sed -e 's;,.*$;;'`
 
157
        lib1_db=`echo $dirs | sed -e 's;,.*,;+&+;' -e 's;^.*+,;;' -e 's;,+.*$;;'`
 
158
        lib2_db=`echo $dirs | sed -e 's;^.*,;;'`
 
159
 
 
160
        # show us the command we are executing
 
161
        echo ${PROFILETOOL} ${BINDIR}/multinit --order $order --main_command $main_command --lib1_command $lib1_command --lib2_command $lib2_command $shutdown_command --main_db $main_db --lib1_db $lib1_db --lib2_db $lib2_db $ro_command --main_token_name "Main" --lib1_token_name "Lib1" --lib2_token_name "Lib2" --verbose --summary 
 
162
 
 
163
        # execute the command an collect the result. Most of the user
 
164
        # visible output goes to stderr, so it's not captured by the pipe
 
165
        actual_result=`${PROFILETOOL} ${BINDIR}/multinit --order $order --main_command $main_command --lib1_command $lib1_command --lib2_command $lib2_command $shutdown_command --main_db $main_db --lib1_db $lib1_db --lib2_db $lib2_db $ro_command --main_token_name "Main" --lib1_token_name "Lib1" --lib2_token_name "Lib2" --verbose --summary | grep "^result=" | sed -e 's;^result=;;'` 
 
166
 
 
167
        # show what we got and what we expected for diagnostic purposes
 
168
        echo "actual   = |$actual_result|"
 
169
        echo "expected = |$expected_result|"
 
170
        test  "$actual_result" == "$expected_result" 
 
171
        html_msg $? 0 "$testname"
 
172
    fi
 
173
  done
 
174
}
 
175
  
 
176
############################## multinit_cleanup ###########################
 
177
# local shell function to finish this script (no exit since it might be
 
178
# sourced)
 
179
########################################################################
 
180
multinit_cleanup()
 
181
{
 
182
  html "</TABLE><BR>"
 
183
  cd ${QADIR}
 
184
  . common/cleanup.sh
 
185
}
 
186
 
 
187
################## main #################################################
 
188
 
 
189
multinit_init
 
190
multinit_main
 
191
multinit_cleanup