From: Andreas Schneider Date: Mon, 25 Jul 2022 10:12:52 +0000 (+0200) Subject: libcli:auth: Add test for decode_pwd_string_from_buffer514() X-Git-Tag: samba-4.17.0rc1~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=63c4b16d2fce6f8f547cb99f9bc626668e6ad379;p=thirdparty%2Fsamba.git libcli:auth: Add test for decode_pwd_string_from_buffer514() Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- diff --git a/libcli/auth/tests/test_encode_decode.c b/libcli/auth/tests/test_encode_decode.c index 34940e9352c..4683edf7ce5 100644 --- a/libcli/auth/tests/test_encode_decode.c +++ b/libcli/auth/tests/test_encode_decode.c @@ -126,12 +126,29 @@ static void torture_extract_pwd_blob_from_buffer514(void **state) data_blob_free(&new_password); } +static void torture_decode_pwd_string_from_buffer514(void **state) +{ + DATA_BLOB decoded_password = { + .length = 0, + }; + bool ok; + + ok = decode_pwd_string_from_buffer514(NULL, + plaintext_data, + CH_UTF16, + &decoded_password); + assert_true(ok); + assert_memory_equal(decoded_password.data, "Pa$$w0rd@2", decoded_password.length); + data_blob_free(&decoded_password); +} + int main(int argc, char *argv[]) { int rc; const struct CMUnitTest tests[] = { cmocka_unit_test(torture_encode_pwd_buffer514_from_str), cmocka_unit_test(torture_extract_pwd_blob_from_buffer514), + cmocka_unit_test(torture_decode_pwd_string_from_buffer514), }; if (argc == 2) {