diff options
author | Günther Deschner <gd@samba.org> | 2009-08-21 20:41:03 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-08-28 10:08:43 +0200 |
commit | 3a519fac8a1bf352fc8895458d4d27311a215c81 (patch) | |
tree | f6ab295ccd55aa10baeb721998b6035d2bce1fc1 /librpc | |
parent | 4d1c88123980dc7ac92c5881aa05c016d2d060f6 (diff) | |
download | samba-3a519fac8a1bf352fc8895458d4d27311a215c81.tar.gz samba-3a519fac8a1bf352fc8895458d4d27311a215c81.tar.bz2 samba-3a519fac8a1bf352fc8895458d4d27311a215c81.zip |
ntlmssp: add ndr_print_ntlmssp_{nt,lm}_response() function.
Guenther
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/ndr/ndr_ntlmssp.c | 56 | ||||
-rw-r--r-- | librpc/ndr/ndr_ntlmssp.h | 8 |
2 files changed, 64 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_ntlmssp.c b/librpc/ndr/ndr_ntlmssp.c index b91b1433e2..d90495fe9b 100644 --- a/librpc/ndr/ndr_ntlmssp.c +++ b/librpc/ndr/ndr_ntlmssp.c @@ -107,3 +107,59 @@ _PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_f } return NDR_ERR_SUCCESS; } + +_PUBLIC_ void ndr_print_ntlmssp_nt_response(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *ic, + const DATA_BLOB *nt_response, + bool ntlmv2) +{ + enum ndr_err_code ndr_err; + + if (ntlmv2) { + struct NTLMv2_RESPONSE nt; + if (nt_response->length > 24) { + ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, ic, &nt, + (ndr_pull_flags_fn_t)ndr_pull_NTLMv2_RESPONSE); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NDR_PRINT_DEBUG(NTLMv2_RESPONSE, &nt); + } + } + } else { + struct NTLM_RESPONSE nt; + if (nt_response->length == 24) { + ndr_err = ndr_pull_struct_blob(nt_response, mem_ctx, ic, &nt, + (ndr_pull_flags_fn_t)ndr_pull_NTLM_RESPONSE); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NDR_PRINT_DEBUG(NTLM_RESPONSE, &nt); + } + } + } +} + +_PUBLIC_ void ndr_print_ntlmssp_lm_response(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *ic, + const DATA_BLOB *lm_response, + bool ntlmv2) +{ + enum ndr_err_code ndr_err; + + if (ntlmv2) { + struct LMv2_RESPONSE lm; + if (lm_response->length == 24) { + ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, ic, &lm, + (ndr_pull_flags_fn_t)ndr_pull_LMv2_RESPONSE); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NDR_PRINT_DEBUG(LMv2_RESPONSE, &lm); + } + } + } else { + struct LM_RESPONSE lm; + if (lm_response->length == 24) { + ndr_err = ndr_pull_struct_blob(lm_response, mem_ctx, ic, &lm, + (ndr_pull_flags_fn_t)ndr_pull_LM_RESPONSE); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NDR_PRINT_DEBUG(LM_RESPONSE, &lm); + } + } + } +} diff --git a/librpc/ndr/ndr_ntlmssp.h b/librpc/ndr/ndr_ntlmssp.h index 4b21b4fa10..6d76be20ca 100644 --- a/librpc/ndr/ndr_ntlmssp.h +++ b/librpc/ndr/ndr_ntlmssp.h @@ -23,3 +23,11 @@ _PUBLIC_ size_t ndr_ntlmssp_string_length(uint32_t negotiate_flags, const char * _PUBLIC_ uint32_t ndr_ntlmssp_negotiated_string_flags(uint32_t negotiate_flags); _PUBLIC_ enum ndr_err_code ndr_push_AV_PAIR_LIST(struct ndr_push *ndr, int ndr_flags, const struct AV_PAIR_LIST *r); _PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR_LIST *r); +_PUBLIC_ void ndr_print_ntlmssp_nt_response(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *ic, + const DATA_BLOB *nt_response, + bool ntlmv2); +_PUBLIC_ void ndr_print_ntlmssp_lm_response(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *ic, + const DATA_BLOB *lm_response, + bool ntlmv2); |