| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The Native Client Authors. All rights reserved. | 2 * Copyright 2009 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 printf("Checking %s\n", kValidEnvs[i]); | 143 printf("Checking %s\n", kValidEnvs[i]); |
| 144 if (0 == NaClEnvInWhitelist(kValidEnvs[i])) { | 144 if (0 == NaClEnvInWhitelist(kValidEnvs[i])) { |
| 145 ++errors; | 145 ++errors; |
| 146 printf("ERROR\n"); | 146 printf("ERROR\n"); |
| 147 } else { | 147 } else { |
| 148 printf("OK\n"); | 148 printf("OK\n"); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 printf("\nEnvironment Filtering\n"); | 152 printf("\nEnvironment Filtering\n"); |
| 153 NaClEnvCleanserCtor(&nec); | 153 NaClEnvCleanserCtor(&nec, 1); |
| 154 if (!NaClEnvCleanserInit(&nec, kMurkyEnv)) { | 154 if (!NaClEnvCleanserInit(&nec, kMurkyEnv, NULL)) { |
| 155 printf("FAILED: NaClEnvCleanser Init failed\n"); | 155 printf("FAILED: NaClEnvCleanser Init failed\n"); |
| 156 ++errors; | 156 ++errors; |
| 157 } else { | 157 } else { |
| 158 if (!StrTblsHaveSameEntries(NaClEnvCleanserEnvironment(&nec), | 158 if (!StrTblsHaveSameEntries(NaClEnvCleanserEnvironment(&nec), |
| 159 kFilteredEnv)) { | 159 kFilteredEnv)) { |
| 160 printf("ERROR: filtered env wrong\n"); | 160 printf("ERROR: filtered env wrong\n"); |
| 161 ++errors; | 161 ++errors; |
| 162 | 162 |
| 163 PrintStrTbl("Original environment", kMurkyEnv); | 163 PrintStrTbl("Original environment", kMurkyEnv); |
| 164 PrintStrTbl("Filtered environment", NaClEnvCleanserEnvironment(&nec)); | 164 PrintStrTbl("Filtered environment", NaClEnvCleanserEnvironment(&nec)); |
| 165 PrintStrTbl("Expected environment", kFilteredEnv); | 165 PrintStrTbl("Expected environment", kFilteredEnv); |
| 166 } else { | 166 } else { |
| 167 printf("OK\n"); | 167 printf("OK\n"); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 NaClEnvCleanserDtor(&nec); | 170 NaClEnvCleanserDtor(&nec); |
| 171 | 171 |
| 172 printf("%s\n", (0 == errors) ? "PASSED" : "FAILED"); | 172 printf("%s\n", (0 == errors) ? "PASSED" : "FAILED"); |
| 173 return 0 != errors; | 173 return 0 != errors; |
| 174 } | 174 } |
| OLD | NEW |