summaryrefslogtreecommitdiff
path: root/libcli/auth
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2022-07-25 12:12:52 +0200
committerAndreas Schneider <asn@cryptomilk.org>2022-07-28 11:51:29 +0000
commit63c4b16d2fce6f8f547cb99f9bc626668e6ad379 (patch)
tree5db9635cf5c3ab0d442407060234fbd8a3d16937 /libcli/auth
parent2f4a80322b9e4b1617839e8e1185a9e620b89a51 (diff)
downloadsamba-63c4b16d2fce6f8f547cb99f9bc626668e6ad379.tar.gz
libcli:auth: Add test for decode_pwd_string_from_buffer514()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'libcli/auth')
-rw-r--r--libcli/auth/tests/test_encode_decode.c17
1 files changed, 17 insertions, 0 deletions
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) {