[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Sep 11 12:13:02 MDT 2011


The branch, master has been updated
       via  6f4264a s4:samba-tool/domain.py - rename arguments "domain" -> "domain-level", "forest" -> "forest-level"
       via  7e460a0 s4:samba-tool/domain.py - restore domain raise functionality
       via  80f6932 ldb:ldb_controls.c - remove duplicate definition of "LDB_CONTROL_CMP"
       via  e3213bb ldb:pyldb.c - point out that "PyLdbResult_AsResult" does not convert everything
      from  86b1f45 lib/util/charset: the comparsion must be against our charset modules

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6f4264a72efe3995d92cff631cf1886f7b5bdaf3
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Sep 11 17:31:38 2011 +0200

    s4:samba-tool/domain.py - rename arguments "domain" -> "domain-level", "forest" -> "forest-level"
    
    This should clarify the scope of them.
    
    Reviewed-by: Jelmer
    
    Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
    Autobuild-Date: Sun Sep 11 20:12:52 CEST 2011 on sn-devel-104

commit 7e460a04f79c9056b7b0b6c927caa2db96229633
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Fri Sep 9 15:27:25 2011 +0200

    s4:samba-tool/domain.py - restore domain raise functionality
    
    The samba-tool command has accidentally been damaged by commit
    2d4988c3d79e501003875cd26b7f9aaa72402b31.
    
    Reviewed-by: Jelmer

commit 80f6932e3ef4cfc25b6ed717ba2f499314ec5226
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Wed Jun 22 14:48:33 2011 +0200

    ldb:ldb_controls.c - remove duplicate definition of "LDB_CONTROL_CMP"
    
    And fix the comment
    
    Reviewed-by: Jelmer

commit e3213bb4d0d6b1492e41a3b79f2e211493410d8c
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Tue Jun 21 11:11:04 2011 +0200

    ldb:pyldb.c - point out that "PyLdbResult_AsResult" does not convert everything
    
    Reviewed-by: Jelmer

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/common/ldb_controls.c                   |   14 ++------
 lib/ldb/pyldb.c                                 |    5 ++-
 source4/scripting/python/samba/netcmd/domain.py |   39 ++++++++++++++++-------
 3 files changed, 34 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/common/ldb_controls.c b/lib/ldb/common/ldb_controls.c
index 81f3c7a..3856167 100644
--- a/lib/ldb/common/ldb_controls.c
+++ b/lib/ldb/common/ldb_controls.c
@@ -389,9 +389,9 @@ char *ldb_control_to_string(TALLOC_CTX *mem_ctx, const struct ldb_control *contr
 
 /*
  * A little trick to allow to use constants defined in headers rather than
- * hardwritten in the file hardwritten in the file
- * sizeof will return the \0 char as well so it will take the place of ":" in the
- * length of the string
+ * hardwritten in the file.
+ * "sizeof" will return the \0 char as well so it will take the place of ":"
+ * in the length of the string.
  */
 #define LDB_CONTROL_CMP(control, NAME) strncmp(control, NAME ":", sizeof(NAME))
 
@@ -1000,14 +1000,6 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
 	return NULL;
 }
 
-/*
- * A little trick to allow to use constants defined in headers rather than
- * hardwritten in the file hardwritten in the file
- * sizeof will return the \0 char as well so it will take the place of ":" in the
- * length of the string
- */
-#define LDB_CONTROL_CMP(control, NAME) strncmp(control, NAME ":", sizeof(NAME))
-
 /* Parse controls from the format used on the command line and in ejs */
 struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char **control_strings)
 {
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index 40efbb5..7991296 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -325,9 +325,12 @@ static PyObject *PyLdbResult_FromResult(struct ldb_result *result)
 }
 
 /**
- * Create a LDB Result from a Python object. 
+ * Create a LDB Result from a Python object.
  * If conversion fails, NULL will be returned and a Python exception set.
  *
+ * Note: the result object only includes the messages at the moment; extended
+ * result, controls and referrals are ignored.
+ *
  * @param mem_ctx Memory context in which to allocate the LDB Result
  * @param obj Python object to convert
  * @return a ldb_result, or NULL if the conversion failed
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index 884ea64..d76b092 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -129,14 +129,16 @@ class cmd_domain_level(Command):
         Option("-H", "--URL", help="LDB URL for database or target server", type=str,
                metavar="URL", dest="H"),
         Option("--quiet", help="Be quiet", action="store_true"),
-        Option("--forest", type="choice", choices=["2003", "2008", "2008_R2"],
+        Option("--forest-level", type="choice", choices=["2003", "2008", "2008_R2"],
             help="The forest function level (2003 | 2008 | 2008_R2)"),
+        Option("--domain-level", type="choice", choices=["2003", "2008", "2008_R2"],
+            help="The domain function level (2003 | 2008 | 2008_R2)")
             ]
 
     takes_args = ["subcommand"]
 
-    def run(self, subcommand, H=None, forest=None, domain=None, quiet=False,
-            credopts=None, sambaopts=None, versionopts=None):
+    def run(self, subcommand, H=None, forest_level=None, domain_level=None,
+            quiet=False, credopts=None, sambaopts=None, versionopts=None):
         lp = sambaopts.get_loadparm()
         creds = credopts.get_credentials(lp, fallback_machine=True)
 
@@ -219,17 +221,29 @@ class cmd_domain_level(Command):
                 outstr = "2008 R2"
             else:
                 outstr = "higher than 2008 R2"
+            self.message("Domain function level: (Windows) " + outstr)
+
+            if min_level_dc == DS_DOMAIN_FUNCTION_2000:
+                outstr = "2000"
+            elif min_level_dc == DS_DOMAIN_FUNCTION_2003:
+                outstr = "2003"
+            elif min_level_dc == DS_DOMAIN_FUNCTION_2008:
+                outstr = "2008"
+            elif min_level_dc == DS_DOMAIN_FUNCTION_2008_R2:
+                outstr = "2008 R2"
+            else:
+                outstr = "higher than 2008 R2"
             self.message("Lowest function level of a DC: (Windows) " + outstr)
 
         elif subcommand == "raise":
             msgs = []
 
-            if domain is not None:
-                if domain == "2003":
+            if domain_level is not None:
+                if domain_level == "2003":
                     new_level_domain = DS_DOMAIN_FUNCTION_2003
-                elif domain == "2008":
+                elif domain_level == "2008":
                     new_level_domain = DS_DOMAIN_FUNCTION_2008
-                elif domain == "2008_R2":
+                elif domain_level == "2008_R2":
                     new_level_domain = DS_DOMAIN_FUNCTION_2008_R2
 
                 if new_level_domain <= level_domain and level_domain_mixed == 0:
@@ -261,7 +275,8 @@ class cmd_domain_level(Command):
                 # Directly on the base DN
                 m = ldb.Message()
                 m.dn = ldb.Dn(samdb, domain_dn)
-                m["msDS-Behavior-Version"]= ldb.MessageElement(                                                                                             str(new_level_domain), ldb.FLAG_MOD_REPLACE,
+                m["msDS-Behavior-Version"]= ldb.MessageElement(
+                  str(new_level_domain), ldb.FLAG_MOD_REPLACE,
                             "msDS-Behavior-Version")
                 samdb.modify(m)
                 # Under partitions
@@ -280,12 +295,12 @@ class cmd_domain_level(Command):
                 level_domain = new_level_domain
                 msgs.append("Domain function level changed!")
 
-            if forest is not None:
-                if forest == "2003":
+            if forest_level is not None:
+                if forest_level == "2003":
                     new_level_forest = DS_DOMAIN_FUNCTION_2003
-                elif forest == "2008":
+                elif forest_level == "2008":
                     new_level_forest = DS_DOMAIN_FUNCTION_2008
-                elif forest == "2008_R2":
+                elif forest_level == "2008_R2":
                     new_level_forest = DS_DOMAIN_FUNCTION_2008_R2
                 if new_level_forest <= level_forest:
                     raise CommandError("Forest function level can't be smaller equal to the actual one!")


-- 
Samba Shared Repository


More information about the samba-cvs mailing list