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 <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ++left; | 58 ++left; |
59 ++right; | 59 ++right; |
60 } | 60 } |
61 if ('=' == cleft && '\0' == cright) { | 61 if ('=' == cleft && '\0' == cright) { |
62 return 0; | 62 return 0; |
63 } | 63 } |
64 return (0xff & cleft) - (0xff & cright); | 64 return (0xff & cleft) - (0xff & cright); |
65 } | 65 } |
66 | 66 |
67 int NaClEnvInWhitelist(char const *env_entry) { | 67 int NaClEnvInWhitelist(char const *env_entry) { |
68 return NULL != bsearch((void const *) &env_entry, | 68 int retval = NULL != bsearch((void const *) &env_entry, |
69 (void const *) kNaClEnvWhitelist, | 69 (void const *) kNaClEnvWhitelist, |
70 NACL_ARRAY_SIZE(kNaClEnvWhitelist) - 1, /* NULL */ | 70 NACL_ARRAY_SIZE(kNaClEnvWhitelist) - 1, /* NULL */ |
71 sizeof kNaClEnvWhitelist[0], | 71 sizeof kNaClEnvWhitelist[0], |
72 EnvCmp); | 72 EnvCmp); |
| 73 printf("inwhitelist: %s %d\n", env_entry, retval); |
| 74 return retval; |
73 } | 75 } |
74 | 76 |
75 /* PRE: sizeof(char *) is a power of 2 */ | 77 /* PRE: sizeof(char *) is a power of 2 */ |
76 | 78 |
77 /* | 79 /* |
78 * Initializes the object with a filtered environment. | 80 * Initializes the object with a filtered environment. |
79 * | 81 * |
80 * May return false on errors, e.g., out-of-memory. | 82 * May return false on errors, e.g., out-of-memory. |
81 */ | 83 */ |
82 int NaClEnvCleanserInit(struct NaClEnvCleanser *self, char const *const *envp) { | 84 int NaClEnvCleanserInit(struct NaClEnvCleanser *self, char const *const *envp) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 140 } |
139 | 141 |
140 char const *const *NaClEnvCleanserEnvironment(struct NaClEnvCleanser *self) { | 142 char const *const *NaClEnvCleanserEnvironment(struct NaClEnvCleanser *self) { |
141 return (char const *const *) self->cleansed_environ; | 143 return (char const *const *) self->cleansed_environ; |
142 } | 144 } |
143 | 145 |
144 void NaClEnvCleanserDtor(struct NaClEnvCleanser *self) { | 146 void NaClEnvCleanserDtor(struct NaClEnvCleanser *self) { |
145 free((void *) self->cleansed_environ); | 147 free((void *) self->cleansed_environ); |
146 self->cleansed_environ = NULL; | 148 self->cleansed_environ = NULL; |
147 } | 149 } |
OLD | NEW |