summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-05-07 15:21:41 +0200
committerGünther Deschner <gd@samba.org>2008-05-09 14:59:18 +0200
commit64cb9461fb60d293db70d24369227d7482b2fd2b (patch)
tree4587e7ea9ebe388e887267a3a6a6ced11401fd4d /source3
parentfcdee399884ae73eaf10663fb718f148bb4aff24 (diff)
downloadsamba-64cb9461fb60d293db70d24369227d7482b2fd2b.tar.gz
samba-64cb9461fb60d293db70d24369227d7482b2fd2b.tar.bz2
samba-64cb9461fb60d293db70d24369227d7482b2fd2b.zip
dsgetdcname: add pull_mailslot_cldap_reply().
Guenther (This used to be commit 95fb01d8702342265f8837a368dc42f4a4d394d5)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/dsgetdcname.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index c7eb8005bc..98c9997575 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -1023,3 +1023,87 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
return status;
}
+
+/****************************************************************
+****************************************************************/
+
+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;
+}