[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-689-g34ee56e

Andrew Tridgell tridge at samba.org
Tue Mar 24 05:29:27 GMT 2009


The branch, master has been updated
       via  34ee56eadce9f84d52a1c9668cf321e04ede2bc0 (commit)
       via  2a8f367b0ff567223144bd41e97684301d540f57 (commit)
       via  0e3339a46b1747156f35d136dbbc93b503b85b1c (commit)
       via  7f113904eba5361d963075bcea7e36fd98ca34aa (commit)
       via  9709ddcd3db3a96ff4d86aa1a5daf7f9261f13d3 (commit)
       via  844a1b3cd27f323087b707e494c5e3860340eb27 (commit)
      from  130582f170cdcc2b6eb2a950ca4ebda916c8399a (commit)

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


- Log -----------------------------------------------------------------
commit 34ee56eadce9f84d52a1c9668cf321e04ede2bc0
Merge: 2a8f367b0ff567223144bd41e97684301d540f57 130582f170cdcc2b6eb2a950ca4ebda916c8399a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 24 16:29:24 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba

commit 2a8f367b0ff567223144bd41e97684301d540f57
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 24 16:28:39 2009 +1100

    the start of a possibleInferiors test suite
    
    we haven't implemented possibleInferiors yet. This test is meant to
    help us understand how it works. It tries to construct
    possibleInferiors via searches on other attributes, and compares it to
    the servers constructed possibleInferiors attribute for each class in
    the servers schema.
    
    see [MS-ADTS] section 3.1.1.4.5.21

commit 0e3339a46b1747156f35d136dbbc93b503b85b1c
Merge: 7f113904eba5361d963075bcea7e36fd98ca34aa 36b957b5b7a1f70e39eeef224820739f24b999c9
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 24 10:53:06 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba

commit 7f113904eba5361d963075bcea7e36fd98ca34aa
Merge: 9709ddcd3db3a96ff4d86aa1a5daf7f9261f13d3 979a1b06d01817a01967d9137e4f70f222fa8eab
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Mar 23 11:47:38 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba

commit 9709ddcd3db3a96ff4d86aa1a5daf7f9261f13d3
Merge: 844a1b3cd27f323087b707e494c5e3860340eb27 3a4638db0351368d3b148bf547546f28fa0b1479
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Mar 20 10:01:17 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba

commit 844a1b3cd27f323087b707e494c5e3860340eb27
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 19 16:07:07 2009 +1100

    flush after showing the prompt in smbclient

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

Summary of changes:
 .../samdb/ldb_modules/tests/possibleinferiors.py   |  155 ++++++++++++++++++++
 source4/lib/smbreadline/smbreadline.c              |    1 +
 2 files changed, 156 insertions(+), 0 deletions(-)
 create mode 100755 source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py
new file mode 100755
index 0000000..0e74456
--- /dev/null
+++ b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py
@@ -0,0 +1,155 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Andrew Tridgell 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#   
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#   
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""Tests the possibleInferiors generation in the schema_fsmo ldb module"""
+
+import optparse
+import sys
+
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
+import samba
+from samba import getopt as options, Ldb
+import ldb
+
+parser = optparse.OptionParser("possibleinferiors.py <URL> [<CLASS>]")
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
+credopts = options.CredentialsOptions(parser)
+parser.add_option_group(credopts)
+parser.add_option_group(options.VersionOptions(parser))
+
+opts, args = parser.parse_args()
+
+if len(args) < 1:
+    parser.print_usage()
+    sys.exit(1)
+
+url = args[0]
+if (len(args) > 1):
+    objectclass = args[1]
+else:
+    objectclass = None
+
+def uniq_list(alist):
+    """return a unique list"""
+    set = {}
+    return [set.setdefault(e,e) for e in alist if e not in set]
+
+
+lp_ctx = sambaopts.get_loadparm()
+
+creds = credopts.get_credentials(lp_ctx)
+db = Ldb(url, credentials=creds, lp=lp_ctx, options=["modules:paged_searches"])
+
+# get the rootDSE
+res = db.search(base="", expression="",
+                scope=ldb.SCOPE_BASE,
+                attrs=["schemaNamingContext"])
+rootDse = res[0]
+
+schema_base = rootDse["schemaNamingContext"][0]
+
+def possible_inferiors_search(db, oc):
+    """return the possible inferiors via a search for the possibleInferiors attribute"""
+    res = db.search(base=schema_base,
+                    expression=("ldapdisplayname=%s" % oc),
+                    attrs=["possibleInferiors"])
+
+    poss=[]
+    if len(res) == 0 or res[0].get("possibleInferiors") is None:
+        return poss
+    for item in res[0]["possibleInferiors"]:
+        poss.append(str(item))
+    poss = uniq_list(poss)
+    poss.sort()
+    return poss;
+
+
+
+# see [MS-ADTS] section 3.1.1.4.5.21
+# for this algorithm
+
+# !systemOnly=TRUE
+# !objectClassCategory=2
+# !objectClassCategory=3
+
+def POSSINFERIORS(db, oc):
+    """returns a list of possible inferiors to a class. Returned list has the ldapdisplayname, systemOnly and objectClassCategory for each element"""
+    expanded = [oc]
+    res = db.search(base=schema_base,
+                    expression=("subclassof=%s" % str(oc["ldapdisplayname"][0])),
+                    attrs=["ldapdisplayname", "systemOnly", "objectClassCategory"])
+    for r in res:
+        expanded.extend(POSSINFERIORS(db,r))
+    return expanded
+
+def possible_inferiors_constructed(db, oc):
+    """return the possbible inferiors via a recursive search and match"""
+    res = db.search(base=schema_base,
+                    expression=("(&(objectclass=classSchema)(|(posssuperiors=%s)(systemposssuperiors=%s)))" % (oc,oc)),
+                    attrs=["ldapdisplayname", "systemOnly", "objectClassCategory"])
+
+    poss = []
+    for r in res:
+        poss.extend(POSSINFERIORS(db,r))
+        
+    poss2 = []
+    for p in poss:
+        if (not (p["systemOnly"][0] == "TRUE" or
+                 int(p["objectClassCategory"][0]) == 2 or
+                 int(p["objectClassCategory"][0]) == 3)):
+            poss2.append(p["ldapdisplayname"][0])
+            
+    poss2 = uniq_list(poss2)
+    poss2.sort()
+    return poss2
+
+def test_class(db, oc):
+    """test to see if one objectclass returns the correct possibleInferiors"""
+    poss1 = possible_inferiors_search(db, oc)
+    poss2 = possible_inferiors_constructed(db, oc)
+    if poss1 != poss2:
+        print "Returned incorrect list for objectclass %s" % oc
+        print poss1
+        print poss2
+        for i in range(0,min(len(poss1),len(poss2))):
+            print "%30s %30s" % (poss1[i], poss2[i])
+        exit(1)
+
+def get_object_classes(db):
+    """return a list of all object classes"""
+    res = db.search(base=schema_base,
+                    expression="objectClass=classSchema",
+                    attrs=["ldapdisplayname"])
+    list=[]
+    for item in res:
+        list.append(item["ldapdisplayname"][0])
+    return list
+
+if objectclass is None:
+    for oc in get_object_classes(db):
+        print "testing objectClass %s" % oc
+        test_class(db,oc)
+else:
+    test_class(db,objectclass)
+
+print "Lists match OK"
diff --git a/source4/lib/smbreadline/smbreadline.c b/source4/lib/smbreadline/smbreadline.c
index 5fb3bf4..b074173 100644
--- a/source4/lib/smbreadline/smbreadline.c
+++ b/source4/lib/smbreadline/smbreadline.c
@@ -83,6 +83,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
 	char *ret;
 
 	printf("%s", prompt);
+	fflush(stdout);
 
 	line = (char *)malloc(BUFSIZ);
 	if (!line) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list