From 0c9ee5b82f84182fe7c0182257bd8b67cc93ca37 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 23 Dec 2014 11:09:04 +0000 Subject: [PATCH] libcli/netlogon: We need to handle a bug in FreeIPA (at least <= 4.1.2). They include the ip address information without setting NETLOGON_NT_VERSION_5EX_WITH_IP, while using ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX instead of ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags. Signed-off-by: Stefan Metzmacher Reviewed-by: Guenther Deschner --- libcli/netlogon/netlogon.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libcli/netlogon/netlogon.c b/libcli/netlogon/netlogon.c index d82a2013b8f..58a331d70ad 100644 --- a/libcli/netlogon/netlogon.c +++ b/libcli/netlogon/netlogon.c @@ -91,9 +91,18 @@ NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, ndr, NDR_SCALARS|NDR_BUFFERS, &response->data.nt5_ex, ntver); if (ndr->offset < ndr->data_size) { - ndr_err = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES, - "not all bytes consumed ofs[%u] size[%u]", - ndr->offset, ndr->data_size); + TALLOC_FREE(ndr); + /* + * We need to handle a bug in FreeIPA (at least <= 4.1.2). + * + * They include the ip address information without setting + * NETLOGON_NT_VERSION_5EX_WITH_IP, while using + * ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX instead of + * ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags. + */ + ndr_err = ndr_pull_struct_blob_all(data, mem_ctx, + &response->data.nt5, + (ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX); } response->ntver = NETLOGON_NT_VERSION_5EX; if (NDR_ERR_CODE_IS_SUCCESS(ndr_err) && DEBUGLEVEL >= 10) {