s4:dsdb/common/util.c - provide a call which returns the forest function level
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 9 Aug 2010 17:52:00 +0000 (19:52 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Tue, 10 Aug 2010 17:08:56 +0000 (19:08 +0200)
Sooner or later we'll need this too since not all operations depend only on the
current's domain function level (see the MS-ADTS docs).

source4/dsdb/common/util.c

index 685c94a411b41a65677f7ae88d73f6edefd65646..7c5fd8a1b48ef000c5bbd510a2f989ccaff8311e 100644 (file)
@@ -2965,8 +2965,7 @@ const char *samdb_cn_to_lDAPDisplayName(TALLOC_CTX *mem_ctx, const char *cn)
 }
 
 /*
-  return domain functional level
-  returns DS_DOMAIN_FUNCTION_*
+ * This detects and returns the domain functional level (DS_DOMAIN_FUNCTION_*)
  */
 int dsdb_functional_level(struct ldb_context *ldb)
 {
@@ -2979,6 +2978,20 @@ int dsdb_functional_level(struct ldb_context *ldb)
        return *domainFunctionality;
 }
 
+/*
+ * This detects and returns the forest functional level (DS_DOMAIN_FUNCTION_*)
+ */
+int dsdb_forest_functional_level(struct ldb_context *ldb)
+{
+       int *forestFunctionality =
+               talloc_get_type(ldb_get_opaque(ldb, "forestFunctionality"), int);
+       if (!forestFunctionality) {
+               DEBUG(0,(__location__ ": WARNING: forestFunctionality not setup\n"));
+               return DS_DOMAIN_FUNCTION_2000;
+       }
+       return *forestFunctionality;
+}
+
 /*
   set a GUID in an extended DN structure
  */