s4-dsdb: fixed the fetch of the server site name
authorAndrew Tridgell <tridge@samba.org>
Fri, 26 Feb 2010 01:36:17 +0000 (12:36 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 26 Feb 2010 02:22:12 +0000 (13:22 +1100)
when the ntds objects were moved by a recent change it broke the
calculation of the server site

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/common/util.c

index 134d4284618b9c4388aa99793ff1b8175670bb6c..cc75f7fdc9f2135f557a79b1c849ad0977b6affe 100644 (file)
@@ -1452,12 +1452,18 @@ struct ldb_dn *samdb_server_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
 struct ldb_dn *samdb_server_site_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
 {
        struct ldb_dn *server_dn;
+       struct ldb_dn *servers_dn;
        struct ldb_dn *server_site_dn;
 
+       /* TODO: there must be a saner way to do this!! */
+
        server_dn = samdb_server_dn(ldb, mem_ctx);
        if (!server_dn) return NULL;
 
-       server_site_dn = ldb_dn_get_parent(mem_ctx, server_dn);
+       servers_dn = ldb_dn_get_parent(mem_ctx, server_dn);
+       if (!servers_dn) return NULL;
+
+       server_site_dn = ldb_dn_get_parent(mem_ctx, servers_dn);
 
        talloc_free(server_dn);
        return server_site_dn;