From 8c53b863e910e213be20f6fc8b8093d98644d945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 26 Dec 2006 00:26:11 +0000 Subject: [PATCH] Verify infotarget. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19495 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/ntlm/test_ntlm.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/ntlm/test_ntlm.c b/lib/ntlm/test_ntlm.c index 0364e0180..2fb623e42 100644 --- a/lib/ntlm/test_ntlm.c +++ b/lib/ntlm/test_ntlm.c @@ -167,8 +167,8 @@ test_keys(void) *target = "TESTNT"; const unsigned char serverchallange[8] = "\x67\x7f\x1c\x55\x7a\x5e\xe9\x6c"; - struct ntlm_buf infotarget, answer, key; - unsigned char ntlmv2[16]; + struct ntlm_buf infotarget, infotarget2, answer, key; + unsigned char ntlmv2[16], ntlmv2_1[16]; int ret; infotarget.length = 70; @@ -194,8 +194,29 @@ test_keys(void) &infotarget, ntlmv2, &answer); + if (ret) + errx(1, "heim_ntlm_calculate_ntlm2"); - + ret = heim_ntlm_verify_ntlm2(key.data, + key.length, + username, + target, + 0, + serverchallange, + &answer, + &infotarget2, + ntlmv2_1); + if (ret) + errx(1, "heim_ntlm_verify_ntlm2"); + + if (memcmp(ntlmv2, ntlmv2_1, sizeof(ntlmv2)) != 0) + errx(1, "ntlm master key not same"); + + if (infotarget.length != infotarget2.length) + errx(1, "infotarget length"); + + if (memcmp(infotarget.data, infotarget2.data, infotarget.length) != 0) + errx(1, "infotarget not the same"); return 0; }