1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

s4:drsuapi: try to behave more like windows for usn order (bug #9508)

We don't behave completely like a Windows server, but it's much more
identical than before.

The partition head is always the first object followed by the rest
sorted by uSNChanged.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jan  1 21:09:42 CET 2013 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2012-12-15 10:18:08 +01:00
parent 16aef75c4f
commit f77bfed088

View File

@ -700,20 +700,27 @@ static int site_res_cmp_usn_order(struct drsuapi_changed_objects *m1,
struct drsuapi_changed_objects *m2,
struct drsuapi_getncchanges_state *getnc_state)
{
unsigned usnchanged1, usnchanged2;
unsigned cn1, cn2;
int ret;
cn1 = ldb_dn_get_comp_num(m1->dn);
cn2 = ldb_dn_get_comp_num(m2->dn);
if (cn1 != cn2) {
return cn1 > cn2 ? 1 : -1;
ret = ldb_dn_compare(getnc_state->ncRoot_dn, m1->dn);
if (ret == 0) {
return -1;
}
usnchanged1 = m1->usn;
usnchanged2 = m2->usn;
if (usnchanged1 == usnchanged2) {
return 0;
ret = ldb_dn_compare(getnc_state->ncRoot_dn, m2->dn);
if (ret == 0) {
return 1;
}
return usnchanged1 > usnchanged2 ? 1 : -1;
if (m1->usn == m2->usn) {
return ldb_dn_compare(m2->dn, m1->dn);
}
if (m1->usn < m2->usn) {
return -1;
}
return 1;
}