sd-schema: order DRS classes on the wire in reverse order
authorAndrew Tridgell <tridge@samba.org>
Mon, 21 Dec 2009 09:59:57 +0000 (20:59 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 1 Jan 2010 21:16:52 +0000 (08:16 +1100)
windows sends objectclasses in DRS in the opposite order to what LDAP
uses

source4/dsdb/schema/schema_syntax.c

index e958605707dfa75a7d98c3bc68a5780293afff11..0873779811412e7ad2e27f05e1e7ae18fcbed4e2 100644 (file)
@@ -735,7 +735,10 @@ static WERROR _dsdb_syntax_OID_obj_ldb_to_drsuapi(struct ldb_context *ldb,
                blobs[i] = data_blob_talloc(blobs, NULL, 4);
                W_ERROR_HAVE_NO_MEMORY(blobs[i].data);
 
-               obj_class = dsdb_class_by_lDAPDisplayName(schema, (const char *)in->values[i].data);
+               /* in DRS windows puts the classes in the opposite
+                  order to the order used in ldap */
+               obj_class = dsdb_class_by_lDAPDisplayName(schema,
+                                                         (const char *)in->values[(in->num_values-1)-i].data);
                if (!obj_class) {
                        return WERR_FOOBAR;
                }