|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include <stdio.h> |
|
6 #include <stdlib.h> |
|
7 |
|
8 #include "nss.h" |
|
9 #include "secerr.h" |
|
10 |
|
11 /* |
|
12 * Regression test for bug 495097. |
|
13 * |
|
14 * NSS_InitReadWrite("sql:<dbdir>") should fail with SEC_ERROR_BAD_DATABASE |
|
15 * if the directory <dbdir> doesn't exist. |
|
16 */ |
|
17 |
|
18 int main() |
|
19 { |
|
20 SECStatus status; |
|
21 int error; |
|
22 |
|
23 status = NSS_InitReadWrite("sql:/no/such/db/dir"); |
|
24 if (status == SECSuccess) { |
|
25 fprintf(stderr, "NSS_InitReadWrite succeeded unexpectedly\n"); |
|
26 exit(1); |
|
27 } |
|
28 error = PORT_GetError(); |
|
29 if (error != SEC_ERROR_BAD_DATABASE) { |
|
30 fprintf(stderr, "NSS_InitReadWrite failed with the wrong error code: " |
|
31 "%d\n", error); |
|
32 exit(1); |
|
33 } |
|
34 printf("PASS\n"); |
|
35 return 0; |
|
36 } |