From 4bd94c8338bef61477170bc41a8073739d55d812 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 7 May 2008 21:31:59 +0200 Subject: cldap: move out cldap object to fix the build. Guenther (This used to be commit 56be9c98d24e64bf855439df21766d30f448f407) --- source3/libads/cldap.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'source3/libads') diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c index e4fa965a0f..3a5a8b0647 100644 --- a/source3/libads/cldap.c +++ b/source3/libads/cldap.c @@ -281,3 +281,87 @@ bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx, return true; } + +/**************************************************************** +****************************************************************/ + +bool pull_mailslot_cldap_reply(TALLOC_CTX *mem_ctx, + const DATA_BLOB *blob, + union nbt_cldap_netlogon *r, + uint32_t *nt_version) +{ + enum ndr_err_code ndr_err; + uint32_t nt_version_query = ((*nt_version) & 0x000000ff); + uint16_t command = 0; + + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &command, + (ndr_pull_flags_fn_t)ndr_pull_uint16); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return false; + } + + switch (command) { + case 0x13: /* 19 */ + case 0x15: /* 21 */ + case 0x17: /* 23 */ + break; + default: + DEBUG(1,("got unexpected command: %d (0x%08x)\n", + command, command)); + return false; + } + + ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query, + (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + goto done; + } + + /* when the caller requested just those nt_version bits that the server + * was able to reply to, we are fine and all done. otherwise we need to + * assume downgraded replies which are painfully parsed here - gd */ + + if (nt_version_query & NETLOGON_VERSION_WITH_CLOSEST_SITE) { + nt_version_query &= ~NETLOGON_VERSION_WITH_CLOSEST_SITE; + } + ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query, + (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + goto done; + } + if (nt_version_query & NETLOGON_VERSION_5EX_WITH_IP) { + nt_version_query &= ~NETLOGON_VERSION_5EX_WITH_IP; + } + ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query, + (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + goto done; + } + if (nt_version_query & NETLOGON_VERSION_5EX) { + nt_version_query &= ~NETLOGON_VERSION_5EX; + } + ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query, + (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + goto done; + } + if (nt_version_query & NETLOGON_VERSION_5) { + nt_version_query &= ~NETLOGON_VERSION_5; + } + ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query, + (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + goto done; + } + + return false; + + done: + if (DEBUGLEVEL >= 10) { + NDR_PRINT_UNION_DEBUG(nbt_cldap_netlogon, nt_version_query, r); + } + + *nt_version = nt_version_query; + + return true; +} -- cgit