1 |
|
---|
2 | #include "config_xor.h"
|
---|
3 |
|
---|
4 | #include <string.h>
|
---|
5 | #include "CuTest.h"
|
---|
6 | #include "samhain.h"
|
---|
7 | #include "sh_utils.h"
|
---|
8 |
|
---|
9 | void Test_sh_util_obscure_ok (CuTest *tc) {
|
---|
10 |
|
---|
11 | int ret = 0;
|
---|
12 | #if defined(SH_WITH_CLIENT) || defined(SH_STANDALONE)
|
---|
13 | char input[16] = "foobar";
|
---|
14 |
|
---|
15 | ret = sh_util_obscure_ok ("0xA1,0xA2,0xA3");
|
---|
16 | CuAssertIntEquals(tc, ret, 0);
|
---|
17 |
|
---|
18 | ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
|
---|
19 | CuAssertIntEquals(tc, ret, 0);
|
---|
20 |
|
---|
21 | input[0] = '\t';
|
---|
22 | ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
|
---|
23 | CuAssertIntEquals(tc, ret, -1);
|
---|
24 |
|
---|
25 | input[0] = 0xA1;
|
---|
26 | ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
|
---|
27 | CuAssertIntEquals(tc, ret, 0);
|
---|
28 |
|
---|
29 | input[0] = 0xA2;
|
---|
30 | ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
|
---|
31 | CuAssertIntEquals(tc, ret, 0);
|
---|
32 |
|
---|
33 | input[0] = 0xA3;
|
---|
34 | ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
|
---|
35 | CuAssertIntEquals(tc, ret, 0);
|
---|
36 |
|
---|
37 | input[0] = 0xA4;
|
---|
38 | ret = sh_util_obscurename (0, input, S_FALSE /* no log message */);
|
---|
39 | CuAssertIntEquals(tc, ret, -1);
|
---|
40 |
|
---|
41 | #else
|
---|
42 | CuAssertIntEquals(tc, ret, 0);
|
---|
43 | #endif
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|