1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

cmdline:tests: extend cmdline_burn tests

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15674

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
This commit is contained in:
Douglas Bagnall 2024-06-27 15:05:03 +12:00 committed by Douglas Bagnall
parent f17a2b1b25
commit 05128a1f5f
2 changed files with 26 additions and 7 deletions

View File

@ -24,6 +24,7 @@
#include <cmocka.h>
#include <time.h>
#include <sys/time.h>
#include "replace.h"
#include "lib/cmdline/cmdline.h"
@ -62,19 +63,36 @@ static void torture_cmdline_sanity_check_bad(void **state)
static void torture_cmdline_burn(void **state)
{
char arg1[] = "-U Administrator%secret";
char arg2[] = "--user=Administrator%secret";
char arg3[] = "--user=Administrator%super%secret";
char arg4[] = "--password=super%secret";
char arg2[] = "--no-no-no-not-secret=not%secret";
char arg3[] = "--user=Administrator%secret";
char arg4[] = "--user=Administrator%super%secret";
char arg5[] = "--password=super%secret";
char arg6[] = "--no-no-no-not-secret=not%secret";
char arg7[] = "-U";
char arg8[] = "fish%chips";
char arg9[] = "--password";
char arg10[] = "fish%chips";
char arg11[] = "--password2";
char arg12[] = "fish%chips";
char *argv[] = { arg1, arg2, arg3, arg4, NULL };
int argc = 4;
char *argv[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
arg9, arg10, arg11, arg12, NULL };
int argc = ARRAY_SIZE(argv) - 1;
samba_cmdline_burn(argc, argv);
assert_string_equal(arg1, "-U Administrator");
assert_string_equal(arg2, "--user=Administrator");
assert_string_equal(arg2, "--no-no-no-not-secret=not%secret");
assert_string_equal(arg3, "--user=Administrator");
assert_string_equal(arg4, "--password");
assert_string_equal(arg4, "--user=Administrator");
assert_string_equal(arg5, "--password");
assert_string_equal(arg6, "--no-no-no-not-secret=not%secret");
assert_string_equal(arg7, "-U");
assert_string_equal(arg8, "fish");
assert_string_equal(arg9, "--password");
assert_string_equal(arg10, "");
assert_string_equal(arg11, "--password2");
assert_string_equal(arg12, "");
}
int main(int argc, char *argv[])

View File

@ -0,0 +1 @@
^samba.unittests.cmdline.torture_cmdline_burn.none.$