From 43adda56b6a175fa2a9e4c6f20ca921e0b1c5fab Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 9 Oct 2005 13:03:52 +0000 Subject: r10847: Fix up new 'decrypt samlogon reply' routine to be more robust, and use it in the RPC-SAMLOGON test. Andrew Bartlett (This used to be commit 675b7df2eedbcb7ea89c0411f76429d8e2357222) --- source4/libcli/auth/credentials.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'source4/libcli/auth') diff --git a/source4/libcli/auth/credentials.c b/source4/libcli/auth/credentials.c index 7cfccf446c..3f055a657d 100644 --- a/source4/libcli/auth/credentials.c +++ b/source4/libcli/auth/credentials.c @@ -322,18 +322,32 @@ void creds_decrypt_samlogon(struct creds_CredentialState *creds, { static const char zeros[16]; - struct netr_SamBaseInfo *base; + struct netr_SamBaseInfo *base = NULL; switch (validation_level) { case 2: - base = &validation->sam2->base; + if (validation->sam2) { + base = &validation->sam2->base; + } break; case 3: - base = &validation->sam3->base; + if (validation->sam3) { + base = &validation->sam3->base; + } break; case 6: - base = &validation->sam6->base; + if (validation->sam6) { + base = &validation->sam6->base; + } break; + default: + /* If we can't find it, we can't very well decrypt it */ + return; } + + if (!base) { + return; + } + /* find and decyrpt the session keys, return in parameters above */ if (validation_level == 6) { /* they aren't encrypted! */ -- cgit