From 8a0095b930f7ad2a4451f56f204fb0bd73bce66b Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sat, 4 Sep 2010 01:03:53 +0400 Subject: [PATCH] dfs: Fix wrong size of referral, change order of dc referral Order of referral is now like w2k8/w2k8r2 as it seems it has an influence on how clients manage to get it. --- source4/smb_server/smb/trans2.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c index 38381fd2c1e..aae85d6be9d 100644 --- a/source4/smb_server/smb/trans2.c +++ b/source4/smb_server/smb/trans2.c @@ -873,7 +873,8 @@ static NTSTATUS fill_normal_dfs_referraltype(struct dfs_referral_type *ref, ZERO_STRUCTP(ref); ref->version = version; ref->referral.v3.data.server_type = DFS_SERVER_NON_ROOT; - ref->referral.v3.size = 18; + /* "normal" referral seems to always include the GUID */ + ref->referral.v3.size = 34; ref->referral.v3.data.entry_flags = 0; ref->referral.v3.data.ttl = 600; /* As w2k3 */ @@ -885,7 +886,8 @@ static NTSTATUS fill_normal_dfs_referraltype(struct dfs_referral_type *ref, ZERO_STRUCTP(ref); ref->version = version; ref->referral.v4.server_type = DFS_SERVER_NON_ROOT; - ref->referral.v4.size = 18; + /* "normal" referral seems to always include the GUID */ + ref->referral.v4.size = 34; if (isfirstoffset) { ref->referral.v4.entry_flags = DFS_HEADER_FLAG_TARGET_BCK; @@ -914,7 +916,12 @@ static NTSTATUS fill_domain_dfs_referraltype(struct dfs_referral_type *ref, ZERO_STRUCTP(ref); ref->version = version; ref->referral.v3.data.server_type = DFS_SERVER_NON_ROOT; - ref->referral.v3.size = 34; + /* It's hard coded ... don't think it's a good way but the sizeof return not the + * correct values + * + * We have 18 if the GUID is not included 34 otherwise + */ + ref->referral.v3.size = 18; ref->referral.v3.data.entry_flags = DFS_FLAG_REFERRAL_DOMAIN_RESP; ref->referral.v3.data.ttl = 600; /* As w2k3 */ ref->referral.v3.data.referrals.r2.special_name = domain; @@ -1249,7 +1256,7 @@ static NTSTATUS dodomain_referral(TALLOC_CTX *ctx, referral = talloc(tab, struct dfs_referral_type); NT_STATUS_HAVE_NO_MEMORY_AND_FREE(referral, context); - referral_str = talloc_asprintf(referral, "\\%s", dns_domain); + referral_str = talloc_asprintf(referral, "\\%s", netbios_domain); NT_STATUS_HAVE_NO_MEMORY_AND_FREE(referral_str, context); status = fill_domain_dfs_referraltype(referral, 3, referral_str, @@ -1265,7 +1272,7 @@ static NTSTATUS dodomain_referral(TALLOC_CTX *ctx, referral = talloc(tab, struct dfs_referral_type); NT_STATUS_HAVE_NO_MEMORY_AND_FREE(referral, context); - referral_str = talloc_asprintf(referral, "\\%s", netbios_domain); + referral_str = talloc_asprintf(referral, "\\%s", dns_domain); NT_STATUS_HAVE_NO_MEMORY_AND_FREE(referral_str, context); status = fill_domain_dfs_referraltype(referral, 3, referral_str, -- 2.11.4.GIT