summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-05-15 19:56:25 +0400
committerMatthieu Patou <mat@samba.org>2011-05-17 00:31:09 +0200
commit3478e3add376a291e4b4e3acfe92b2df22287142 (patch)
treeade576ba422315f5a3943cbd49345c504068a890
parentd24a22fe9a414bf37859967848c45f2a7494193d (diff)
downloadsamba-3478e3add376a291e4b4e3acfe92b2df22287142.tar.gz
samba-3478e3add376a291e4b4e3acfe92b2df22287142.tar.bz2
samba-3478e3add376a291e4b4e3acfe92b2df22287142.zip
s4-dfs: fix bugs in idl and adapt code accordingly
-rw-r--r--librpc/idl/dfsblobs.idl17
-rw-r--r--source4/smb_server/smb/trans2.c40
2 files changed, 25 insertions, 32 deletions
diff --git a/librpc/idl/dfsblobs.idl b/librpc/idl/dfsblobs.idl
index 6151c3f77b..7b8795d29c 100644
--- a/librpc/idl/dfsblobs.idl
+++ b/librpc/idl/dfsblobs.idl
@@ -53,7 +53,6 @@ interface dfsblobs
[relative_short] nstring *DFS_path;
[relative_short] nstring *DFS_alt_path;
[relative_short] nstring *netw_address;
- /* As stated in MS DFSC 2.2.4.3.1 this array was guid but now MUST be 16 null bytes*/
} dfs_normal_referral;
typedef struct {
@@ -74,32 +73,20 @@ interface dfsblobs
} dfs_padding;
typedef [flag(NDR_NOALIGN)] struct {
+ uint16 size;
DFS_SERVER_TYPE server_type;
DFS_FLAGS_REFERRAL entry_flags;
uint32 ttl;
[switch_is(entry_flags & DFS_FLAG_REFERRAL_DOMAIN_RESP)] dfs_referral referrals;
- } dfs_referral_v3_remaining;
-
- typedef [flag(NDR_NOALIGN)] struct {
- uint16 size;
- dfs_referral_v3_remaining data;
/* this is either 0 or 16 bytes */
[switch_is(size - 18)] dfs_padding service_site_guid;
} dfs_referral_v3;
- typedef struct {
- uint16 size;
- DFS_SERVER_TYPE server_type;
- DFS_FLAGS_REFERRAL entry_flags;
- uint32 ttl;
- dfs_normal_referral r1;
- } dfs_referral_v4;
-
typedef [nodiscriminant] union {
[case(1)] dfs_referral_v1 v1;
[case(2)] dfs_referral_v2 v2;
[case(3)] dfs_referral_v3 v3;
- [case(4)] dfs_referral_v4 v4;
+ [case(4)] dfs_referral_v3 v4;
[default];
} dfs_referral_version;
diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c
index 0a6c014e88..fbddc177ed 100644
--- a/source4/smb_server/smb/trans2.c
+++ b/source4/smb_server/smb/trans2.c
@@ -872,15 +872,15 @@ static NTSTATUS fill_normal_dfs_referraltype(struct dfs_referral_type *ref,
case 3:
ZERO_STRUCTP(ref);
ref->version = version;
- ref->referral.v3.data.server_type = DFS_SERVER_NON_ROOT;
+ ref->referral.v3.server_type = DFS_SERVER_NON_ROOT;
/* "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 */
- ref->referral.v3.data.referrals.r1.DFS_path = dfs_path;
- ref->referral.v3.data.referrals.r1.DFS_alt_path = dfs_path;
- ref->referral.v3.data.referrals.r1.netw_address = server_path;
+ ref->referral.v3.entry_flags = 0;
+ ref->referral.v3.ttl = 600; /* As w2k3 */
+ ref->referral.v3.referrals.r1.DFS_path = dfs_path;
+ ref->referral.v3.referrals.r1.DFS_alt_path = dfs_path;
+ ref->referral.v3.referrals.r1.netw_address = server_path;
return NT_STATUS_OK;
case 4:
ZERO_STRUCTP(ref);
@@ -892,10 +892,10 @@ static NTSTATUS fill_normal_dfs_referraltype(struct dfs_referral_type *ref,
if (isfirstoffset) {
ref->referral.v4.entry_flags = DFS_HEADER_FLAG_TARGET_BCK;
}
- ref->referral.v4.ttl = 600; /* As w2k3 */
- ref->referral.v4.r1.DFS_path = dfs_path;
- ref->referral.v4.r1.DFS_alt_path = dfs_path;
- ref->referral.v4.r1.netw_address = server_path;
+ ref->referral.v4.ttl = 900; /* As w2k8r2 */
+ ref->referral.v4.referrals.r1.DFS_path = dfs_path;
+ ref->referral.v4.referrals.r1.DFS_alt_path = dfs_path;
+ ref->referral.v4.referrals.r1.netw_address = server_path;
return NT_STATUS_OK;
}
@@ -915,17 +915,23 @@ static NTSTATUS fill_domain_dfs_referraltype(struct dfs_referral_type *ref,
case 3:
ZERO_STRUCTP(ref);
ref->version = version;
- ref->referral.v3.data.server_type = DFS_SERVER_NON_ROOT;
+ ref->referral.v3.server_type = DFS_SERVER_NON_ROOT;
/* 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;
- ref->referral.v3.data.referrals.r2.nb_expanded_names = numnames;
+ if (numnames == 0) {
+ /* Windows return without the guid when returning domain list
+ */
+ ref->referral.v3.size = 18;
+ } else {
+ ref->referral.v3.size = 34;
+ }
+ ref->referral.v3.entry_flags = DFS_FLAG_REFERRAL_DOMAIN_RESP;
+ ref->referral.v3.ttl = 600; /* As w2k3 */
+ ref->referral.v3.referrals.r2.special_name = domain;
+ ref->referral.v3.referrals.r2.nb_expanded_names = numnames;
/* Put the final terminator */
if (names) {
const char **names2 = talloc_array(ref, const char *, numnames+1);
@@ -936,7 +942,7 @@ static NTSTATUS fill_domain_dfs_referraltype(struct dfs_referral_type *ref,
NT_STATUS_HAVE_NO_MEMORY(names2[i]);
}
names2[numnames] = 0;
- ref->referral.v3.data.referrals.r2.expanded_names = names2;
+ ref->referral.v3.referrals.r2.expanded_names = names2;
}
return NT_STATUS_OK;
}