[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-972-g65ad2ce

Andrew Tridgell tridge at samba.org
Thu Apr 9 04:51:58 GMT 2009


The branch, master has been updated
       via  65ad2ced6049f2901080cff61489fee7f4929c74 (commit)
       via  9d50c6b60364462daa68887fd64b59dd761a5133 (commit)
       via  87506b4a192eceeced856d33a0770deebada7ff5 (commit)
       via  fd7c52231fc4ca6e4ad2a72955a053f321cb0fb4 (commit)
       via  26f5225ae2c75103147f15f953ef3dbc2b403399 (commit)
       via  37254b7a76a458ee40fabd673e2adaf0dcd663cc (commit)
       via  481fb8aa138b753d83527efc18ced6c8c8eb84c4 (commit)
       via  6abca12aa0a39b80feaa86d9b4425485364ae0a3 (commit)
       via  4f69d7067da6a8ee88950ab15aaf5a5849574fdd (commit)
       via  db29383797e10496dab16fc4729272dcfe090858 (commit)
       via  54f7523db1848d75f61a8f02968de30bd6c49804 (commit)
       via  217628f88119d1cadfa88dbfd57d0e9e94693838 (commit)
       via  b202911123ea6c867c6f7553ce3cb0bbb28829c2 (commit)
       via  9181637170a994ef93bfb8c0fa69ab7b89837f0d (commit)
       via  ef6c6ab4c6cee26ea84c2e2a0041ad62f428ad01 (commit)
       via  6e6094d780d372d0bc6cdf3bbdab360b5cd61219 (commit)
       via  2f04b7d29a9e93152ff40a04afa50d3755ff0a25 (commit)
       via  354ba5e2e35c0adb2dd04f81a6ce7d1d721f31dc (commit)
       via  c7ed9bc477d5090b496631dbd74c3c387cc68add (commit)
       via  1a17fcdf66262d4db6cc3fbc2844560227c4a0ab (commit)
       via  a6a29682e5ee3a2ed0ca37e0ca5435a2fac0eec0 (commit)
       via  9539e2b508b3340b49575e5022c365ec382b2097 (commit)
       via  1bc9c3923574d548810733b512716d5758814328 (commit)
       via  8680be7059280186e59cf4a995f249b62a5a36d4 (commit)
       via  2fe17ae61e4f80b7c864bd6777c71557c97c0125 (commit)
       via  15e6def45d528b10f9ac2ecb917ff13ca6187711 (commit)
       via  631e688c821b78d09d77f5940074800525c554aa (commit)
       via  13be4d7ff42bd2b8bf5702a499c482404e5cd164 (commit)
       via  27c6eca04c4c1bb40ff36f3a08748e2f45770aa8 (commit)
       via  1f25b71d199a072f5ee1bdd8786e5c1c157f5888 (commit)
       via  5ffe7de34845839f2306484cf882a43d2ea2acf1 (commit)
       via  3d0a727f575942b767e396b694f6529259528a17 (commit)
       via  c218d3e1173355acf025471a10b4b6425b9c086b (commit)
       via  6ac77d19b5a25a53459a58e4828fa9eac0bf11f4 (commit)
       via  bb6a2c8076e5e9eabad4ee7f09f6df979616fd13 (commit)
       via  4c32d8f1a704c9d6df09f62cc5f4caa569687c5e (commit)
       via  8374d6f0dc1d6ce6c554b10b5133bd77c5ad6292 (commit)
       via  8352650fee1233e68b489efe635f3661cab2b190 (commit)
       via  17aac8cad2b3fe4b23eaebd869b1538735a1954a (commit)
       via  41760c18bdab20d526d32568531bdf7c88272879 (commit)
       via  8249383efb2037bb234dd040ebe151329cc4feb9 (commit)
       via  8be99413540f0a9f1d4a6b6630fcfd5f1e3baefc (commit)
       via  8d63387744bd01015e7d5f3fee2d9062fecb99b2 (commit)
       via  f83e754ae61046fd441cbaf09a825378c3ab2ff2 (commit)
      from  e5702da72c752e913ff869bce341ca9799d10974 (commit)

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


- Log -----------------------------------------------------------------
commit 65ad2ced6049f2901080cff61489fee7f4929c74
Merge: e5702da72c752e913ff869bce341ca9799d10974 9d50c6b60364462daa68887fd64b59dd761a5133
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 14:40:19 2009 +1000

    Merge branch 'wspp-schema'

commit 9d50c6b60364462daa68887fd64b59dd761a5133
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 14:37:52 2009 +1000

    enable testing of possibleInferiors generation

commit 87506b4a192eceeced856d33a0770deebada7ff5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 14:29:36 2009 +1000

    make the memory usage of possibleInferiors much more efficient

commit fd7c52231fc4ca6e4ad2a72955a053f321cb0fb4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 14:28:38 2009 +1000

    added _const versions of some of the str_list_*() functions
    
    These const versions don't copy the strings themselves, which
    is useful when those strings point at known constant data (into the
    schema in this case)

commit 26f5225ae2c75103147f15f953ef3dbc2b403399
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 13:46:35 2009 +1000

    we should not be supplying a generated attribute in our schema

commit 37254b7a76a458ee40fabd673e2adaf0dcd663cc
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 13:46:18 2009 +1000

    fixed the possibleInferiors calculation so it now passes the test
    
    We are probably still using more memory here than we need to. That
    needs to be looked at.

commit 481fb8aa138b753d83527efc18ced6c8c8eb84c4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 13:45:23 2009 +1000

    slightly nicer output in our possibleInferiors test code

commit 6abca12aa0a39b80feaa86d9b4425485364ae0a3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 13:45:04 2009 +1000

    hook the new possibleInferiors calculation into the schema
    
    We now generate possibleInferiors at startup, and return it when
    requested

commit 4f69d7067da6a8ee88950ab15aaf5a5849574fdd
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 9 13:44:27 2009 +1000

    added str_list_unique() and str_list_show()
    
    I also undid some of the const changes from Andrew, as
    they didn't in fact resolve the const warnings.

commit db29383797e10496dab16fc4729272dcfe090858
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Apr 8 23:18:49 2009 +1000

    Make the schema_inferiors generation code to compile
    
    Sadly it still segfaults at this stage
    
    Andrew Bartlett

commit 54f7523db1848d75f61a8f02968de30bd6c49804
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Apr 8 23:18:13 2009 +1000

    Rework util_strlist prototypes to use a bit more and less const
    
    Hopefully this produces less warnings, but it might produce more...
    
    Andrew Bartlett

commit 217628f88119d1cadfa88dbfd57d0e9e94693838
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Apr 7 16:34:36 2009 +1000

    first cut at a C version of the possible inferiors code

commit b202911123ea6c867c6f7553ce3cb0bbb28829c2
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Apr 7 16:34:18 2009 +1000

    don't load @ATTRIBUTES if we have an override handler in place

commit 9181637170a994ef93bfb8c0fa69ab7b89837f0d
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Apr 7 16:33:54 2009 +1000

    fixed internal handling of attribute deletion

commit ef6c6ab4c6cee26ea84c2e2a0041ad62f428ad01
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Apr 7 16:33:26 2009 +1000

    added a str_list_append() function

commit 6e6094d780d372d0bc6cdf3bbdab360b5cd61219
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Apr 3 10:33:12 2009 +1100

    s4:schema Don't free mem_ctx before it is initilised

commit 2f04b7d29a9e93152ff40a04afa50d3755ff0a25
Merge: 354ba5e2e35c0adb2dd04f81a6ce7d1d721f31dc 31ab1d6a6487fb442ccd5b2cd093b4a2b7b80291
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Apr 3 08:28:22 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit 354ba5e2e35c0adb2dd04f81a6ce7d1d721f31dc
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Apr 3 08:18:14 2009 +1100

    s4:schema Update Windows 2008 schema from Microsoft to latest version

commit c7ed9bc477d5090b496631dbd74c3c387cc68add
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Apr 3 08:15:25 2009 +1100

    Remove minschema generated schema - we now generate from setup/ad-schema/

commit 1a17fcdf66262d4db6cc3fbc2844560227c4a0ab
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Apr 3 08:14:42 2009 +1100

    Add parentGUID as an allowed attribute in samba4Top
    
    This is required to get provision against OpenLDAP working again

commit a6a29682e5ee3a2ed0ca37e0ca5435a2fac0eec0
Merge: 9539e2b508b3340b49575e5022c365ec382b2097 8680be7059280186e59cf4a995f249b62a5a36d4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 2 16:43:23 2009 +1100

    Merge commit 'abartlet/wspp-schema' into wspp-schema

commit 9539e2b508b3340b49575e5022c365ec382b2097
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 2 16:42:21 2009 +1100

    major upgrade to the ldb attribute handling
    
    This is all working towards supporting the full WSPP schema without a
    major performance penalty.
    
    We now use binary searches when looking up classes and attributes. We
    also avoid the loop loading the attributes into ldb, by adding a hook
    to override the ldb attribute search function in a module. The
    attributes can thus be loaded once, and then saved as part of the
    global schema.
    
    Also added support for a few more key attribute syntaxes, as needed
    for the full schema.

commit 1bc9c3923574d548810733b512716d5758814328
Merge: 2fe17ae61e4f80b7c864bd6777c71557c97c0125 36c1a52a57bc96c7586ca1bffbe8ef47c93bca1b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Apr 2 10:17:32 2009 +1100

    Merge commit 'master/master' into wspp-schema

commit 8680be7059280186e59cf4a995f249b62a5a36d4
Merge: 2fe17ae61e4f80b7c864bd6777c71557c97c0125 62f12e2322f1f14cf359fa39a822cd478256cf01
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Apr 1 10:25:03 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit 2fe17ae61e4f80b7c864bd6777c71557c97c0125
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 31 16:31:16 2009 +1100

    possibleInferiors is a generated attribute - we can't pull it over DRS
    or from ldb

commit 15e6def45d528b10f9ac2ecb917ff13ca6187711
Merge: 631e688c821b78d09d77f5940074800525c554aa 79b7ba9b106791958cc42d68b11d9dea2a77f6f3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 31 15:53:17 2009 +1100

    Merge branch 'master' into wspp-schema

commit 631e688c821b78d09d77f5940074800525c554aa
Merge: 13be4d7ff42bd2b8bf5702a499c482404e5cd164 4b8e4ea7286f045effb6feb4c7bf8c5ef4ed2f9b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 31 11:58:37 2009 +1100

    Merge branch 'master' into wspp-schema

commit 13be4d7ff42bd2b8bf5702a499c482404e5cd164
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 20 17:32:19 2009 +1100

    s4:schema Remove 'cn' from the final output of ms_schema.py
    
    This avoids one more point of difference between this an the output
    from minschema and fullschema
    
    Andrew Bartlett

commit 27c6eca04c4c1bb40ff36f3a08748e2f45770aa8
Merge: 1f25b71d199a072f5ee1bdd8786e5c1c157f5888 5fe2b28f45289dc5578cdd536600f0d30a14d820
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 20 13:22:08 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit 1f25b71d199a072f5ee1bdd8786e5c1c157f5888
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Mar 11 16:36:40 2009 +1100

    s4:schema Don't rely on objectCategory 'magic' when loading the schema
    
    The short-to-long name canonicalisation rules use the schema, so
    clearly they won't work when loading it.
    
    Andrew Bartlett

commit 5ffe7de34845839f2306484cf882a43d2ea2acf1
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Mar 11 12:16:27 2009 +1100

    s4:provision  load_schema in provision.py no longer takes a hostname
    
    This was missed in the earlier work to use this in provision-backend
    
    Andrew Bartlett

commit 3d0a727f575942b767e396b694f6529259528a17
Merge: c218d3e1173355acf025471a10b4b6425b9c086b 3d280639c4652d6cd35577e333bcd46c2517754c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Mar 11 07:58:42 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit c218d3e1173355acf025471a10b4b6425b9c086b
Merge: 6ac77d19b5a25a53459a58e4828fa9eac0bf11f4 218ce0e80532b0dbc595e72502d9596a35acdffd
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Mar 10 10:59:14 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit 6ac77d19b5a25a53459a58e4828fa9eac0bf11f4
Merge: bb6a2c8076e5e9eabad4ee7f09f6df979616fd13 46bcb10b5abb21758cf234764b64220ede1b7ab5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 8 16:16:11 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit bb6a2c8076e5e9eabad4ee7f09f6df979616fd13
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 6 12:18:21 2009 +1100

    Load the schema with a more efficient single search
    
    This search uses the index, and is not recursive, so should avoid the
    major performance problem with the current sorted schema load.
    
    The ad2oLschema code (recently moved to provision-backend) no longer
    needs the schema to be sorted.
    
    Andrew Bartlett

commit 4c32d8f1a704c9d6df09f62cc5f4caa569687c5e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 6 12:14:08 2009 +1100

    Load the schema for provision-backend in a transaction
    
    Loading data in a transaction is faster than without.
    
    Andrew Bartlett

commit 8374d6f0dc1d6ce6c554b10b5133bd77c5ad6292
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 6 12:12:24 2009 +1100

    Sort output of schema for OpenLDAP during conversion
    
    This avoids the need to assume that the schema is sorted on load,
    which happens more often and is a major performace issue in the
    Samba4's use of ldb.
    
    Andrew Bartlett

commit 8352650fee1233e68b489efe635f3661cab2b190
Author: Sreepathi Pai <sree314 at gmail.com>
Date:   Thu Mar 5 17:03:13 2009 +1100

    Allow ms_schema.py to produce output much like minschema_wspp
    
    I've patched the new ms_schema.py (which was intended to be used as a
    library) to function as minschema_wspp if invoked standalone. Although
    this is less robust than minschema_wspp on incorrect data, having two
    programs doing the same thing might not be good idea.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit 17aac8cad2b3fe4b23eaebd869b1538735a1954a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Mar 5 16:52:11 2009 +1100

    Remove ad2oLschema, insted call it directly from provision-backend
    
    This removes a level of indirection via external binaries in the
    provision-backend code, and also makes better use of our internal code
    for loading schema from an LDIF file.
    
    Remaining to do: Sort the output again, as the load from LDIF is
    unsorted (also needed because the normal LDB load from sorted input is too slow
    anyway, and is only needed here).
    
    Andrew Bartlett

commit 41760c18bdab20d526d32568531bdf7c88272879
Merge: 8249383efb2037bb234dd040ebe151329cc4feb9 c8ea9d1f13096cd7f51e5972915a61ca65b56ac3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Mar 5 12:24:35 2009 +1100

    Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema

commit 8249383efb2037bb234dd040ebe151329cc4feb9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Feb 18 15:17:02 2009 +1100

    Add the new, updated AD schema file from Microsoft
    
    Also remove the copy of the licence text from licence.txt, to ensure
    we don't get variations between the copies.
    
    Andrew Bartlett

commit 8be99413540f0a9f1d4a6b6630fcfd5f1e3baefc
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Jan 9 18:18:28 2009 +1100

    Don't parse the schema data twice

commit 8d63387744bd01015e7d5f3fee2d9062fecb99b2
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Jan 9 18:17:55 2009 +1100

    Tolerate more whitespace errors
    
    We need to trim trailing spaces in the Microsoft-supplied schema.
    
    Andrew Bartlett

commit f83e754ae61046fd441cbaf09a825378c3ab2ff2
Author: Sreepathi Pai <sree314 at gmail.com>
Date:   Mon Jan 5 08:49:53 2009 +1100

    Create schema.ldif at runtime directly from ad-schema files
    
    Here's a first attempt at moving the minschema_wspp code into a
    library as Andrew requested. Since this script no longer has to
    generate CN=aggregate, I've simplified it quite a bit to a level where
    it almost does a line-by-line translation. This is faster and simpler,
    but it may not catch as many errors in the ad-schema files as the
    previous versions did.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 lib/util/util.h                                    |   38 +-
 lib/util/util_strlist.c                            |  141 +-
 source4/dsdb/config.mk                             |    4 +-
 source4/dsdb/samdb/ldb_modules/schema_fsmo.c       |   91 +-
 .../samdb/ldb_modules/tests/possibleinferiors.py   |    4 +-
 source4/dsdb/schema/schema.h                       |   21 +
 source4/dsdb/schema/schema_convert_to_ol.c         |  350 +
 source4/dsdb/schema/schema_inferiors.c             |  190 +
 source4/dsdb/schema/schema_init.c                  |  167 +-
 source4/dsdb/schema/schema_query.c                 |  145 +-
 source4/dsdb/schema/schema_set.c                   |  227 +-
 source4/dsdb/schema/schema_syntax.c                |   13 +-
 source4/lib/ldb-samba/ldif_handlers.c              |   14 +
 source4/lib/ldb/common/attrib_handlers.c           |   53 +-
 source4/lib/ldb/common/ldb_attributes.c            |   37 +-
 source4/lib/ldb/configure.ac                       |    2 +-
 source4/lib/ldb/include/ldb.h                      |    9 +
 source4/lib/ldb/include/ldb_handlers.h             |   29 +-
 source4/lib/ldb/include/ldb_module.h               |    7 +
 source4/lib/ldb/include/ldb_private.h              |    3 +
 source4/lib/ldb/ldb_tdb/ldb_cache.c                |    7 +
 source4/libnet/libnet_vampire.c                    |    2 +-
 source4/min_versions.m4                            |    2 +-
 source4/scripting/python/pyglue.c                  |   31 +-
 source4/scripting/python/samba/ms_schema.py        |  275 +
 source4/scripting/python/samba/provision.py        |   95 +-
 source4/scripting/python/samba/samdb.py            |    5 +-
 source4/selftest/tests.sh                          |    1 +
 .../ad-schema/MS-AD_Schema_2K8_Attributes.txt      |15638 +++++++++++++++++++
 .../setup/ad-schema/MS-AD_Schema_2K8_Classes.txt   | 3473 +++++
 .../MS-AD_Schema_Attributes_v20080618.txt          |15681 --------------------
 .../ad-schema/MS-AD_Schema_Classes_v20080618.txt   | 3418 -----
 source4/setup/ad-schema/licence.txt                |   49 +-
 source4/setup/schema.ldif                          |10390 -------------
 source4/setup/schema_samba4.ldif                   |   14 +-
 source4/torture/ldap/schema.c                      |    2 +-
 source4/torture/libnet/libnet_BecomeDC.c           |    2 +-
 source4/utils/ad2oLschema.c                        |  442 -
 source4/utils/config.mk                            |   13 -
 39 files changed, 20763 insertions(+), 30322 deletions(-)
 create mode 100644 source4/dsdb/schema/schema_convert_to_ol.c
 create mode 100644 source4/dsdb/schema/schema_inferiors.c
 create mode 100644 source4/scripting/python/samba/ms_schema.py
 create mode 100644 source4/setup/ad-schema/MS-AD_Schema_2K8_Attributes.txt
 create mode 100644 source4/setup/ad-schema/MS-AD_Schema_2K8_Classes.txt
 delete mode 100644 source4/setup/ad-schema/MS-AD_Schema_Attributes_v20080618.txt
 delete mode 100644 source4/setup/ad-schema/MS-AD_Schema_Classes_v20080618.txt
 delete mode 100644 source4/setup/schema.ldif
 delete mode 100644 source4/utils/ad2oLschema.c


Changeset truncated at 500 lines:

diff --git a/lib/util/util.h b/lib/util/util.h
index defef12..81c7edf 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -422,7 +422,7 @@ _PUBLIC_ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char
 /**
   return the number of elements in a string list
 */
-_PUBLIC_ size_t str_list_length(const char * const *list);
+_PUBLIC_ size_t str_list_length(const char **list);
 
 /**
   copy a string list
@@ -437,7 +437,7 @@ _PUBLIC_ bool str_list_equal(const char **list1, const char **list2);
 /**
   add an entry to a string list
 */
-_PUBLIC_ const char **str_list_add(const char **list, const char *s);
+_PUBLIC_ char **str_list_add(char **list, const char *s);
 
 /**
   remove an entry from a string list
@@ -453,6 +453,40 @@ _PUBLIC_ bool str_list_check(const char **list, const char *s);
   return true if a string is in a list, case insensitively
 */
 _PUBLIC_ bool str_list_check_ci(const char **list, const char *s);
+/**
+  append one list to another - expanding list1
+*/
+_PUBLIC_ char **str_list_append(char **list1, const char **list2);
+
+/**
+ remove duplicate elements from a list 
+*/
+_PUBLIC_ char **str_list_unique(char **list);
+
+/*
+  very useful when debugging complex list related code
+ */
+_PUBLIC_ void str_list_show(const char **list);
+
+
+/**
+  append one list to another - expanding list1
+  this assumes the elements of list2 are const pointers, so we can re-use them
+*/
+_PUBLIC_ char **str_list_append_const(char **list1, const char **list2);
+
+/**
+  add an entry to a string list
+  this assumes s will not change
+*/
+_PUBLIC_ char **str_list_add_const(char **list, const char *s);
+
+/**
+  copy a string list
+  this assumes list will not change
+*/
+_PUBLIC_ char **str_list_copy_const(TALLOC_CTX *mem_ctx, const char **list);
+
 
 /* The following definitions come from lib/util/util_file.c  */
 
diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
index b069a11..bd7bd00 100644
--- a/lib/util/util_strlist.c
+++ b/lib/util/util_strlist.c
@@ -187,7 +187,7 @@ _PUBLIC_ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char
 /**
   return the number of elements in a string list
 */
-_PUBLIC_ size_t str_list_length(const char * const*list)
+_PUBLIC_ size_t str_list_length(const char **list)
 {
 	size_t ret;
 	for (ret=0;list && list[ret];ret++) /* noop */ ;
@@ -247,12 +247,12 @@ _PUBLIC_ bool str_list_equal(const char **list1, const char **list2)
 /**
   add an entry to a string list
 */
-_PUBLIC_ const char **str_list_add(const char **list, const char *s)
+_PUBLIC_ char **str_list_add(char **list, const char *s)
 {
 	size_t len = str_list_length(list);
-	const char **ret;
+	char **ret;
 
-	ret = talloc_realloc(NULL, list, const char *, len+2);
+	ret = talloc_realloc(NULL, list, char *, len+2);
 	if (ret == NULL) return NULL;
 
 	ret[len] = talloc_strdup(ret, s);
@@ -308,3 +308,136 @@ _PUBLIC_ bool str_list_check_ci(const char **list, const char *s)
 }
 
 
+/**
+  append one list to another - expanding list1
+*/
+_PUBLIC_ char **str_list_append(char **list1, const char **list2)
+{
+	size_t len1 = str_list_length(list1);
+	size_t len2 = str_list_length(list2);
+	char **ret;
+	int i;
+
+	ret = talloc_realloc(NULL, list1, char *, len1+len2+1);
+	if (ret == NULL) return NULL;
+
+	for (i=len1;i<len1+len2;i++) {
+		ret[i] = talloc_strdup(ret, list2[i-len1]);
+		if (ret[i] == NULL) {
+			return NULL;
+		}
+	}
+	ret[i] = NULL;
+
+	return ret;
+}
+
+static int list_cmp(const char **el1, const char **el2)
+{
+	return strcmp(*el1, *el2);
+}
+
+/*
+  return a list that only contains the unique elements of a list,
+  removing any duplicates
+ */
+_PUBLIC_ char **str_list_unique(char **list)
+{
+	size_t len = str_list_length(list);
+	char **list2;
+	int i, j;
+	if (len < 2) {
+		return list;
+	}
+	list2 = (char **)talloc_memdup(list, list, sizeof(list[0])*(len+1));
+	qsort(list2, len, sizeof(list2[0]), QSORT_CAST list_cmp);
+	list[0] = list2[0];
+	for (i=j=1;i<len;i++) {
+		if (strcmp(list2[i], list[j-1]) != 0) {
+			list[j] = list2[i];
+			j++;
+		}
+	}
+	list[j] = NULL;
+	list = talloc_realloc(NULL, list, char *, j);
+	talloc_free(list2);
+	return list;
+}
+
+/*
+  very useful when debugging complex list related code
+ */
+_PUBLIC_ void str_list_show(const char **list)
+{
+	int i;
+	DEBUG(0,("{ "));
+	for (i=0;list && list[i];i++) {
+		DEBUG(0,("\"%s\", ", list[i]));
+	}
+	DEBUG(0,("}\n"));
+}
+
+
+
+/**
+  append one list to another - expanding list1
+  this assumes the elements of list2 are const pointers, so we can re-use them
+*/
+_PUBLIC_ char **str_list_append_const(char **list1, const char **list2)
+{
+	size_t len1 = str_list_length(list1);
+	size_t len2 = str_list_length(list2);
+	char **ret;
+	int i;
+
+	ret = talloc_realloc(NULL, list1, char *, len1+len2+1);
+	if (ret == NULL) return NULL;
+
+	for (i=len1;i<len1+len2;i++) {
+		ret[i] = list2[i-len1];
+	}
+	ret[i] = NULL;
+
+	return ret;
+}
+
+/**
+  add an entry to a string list
+  this assumes s will not change
+*/
+_PUBLIC_ char **str_list_add_const(char **list, const char *s)
+{
+	size_t len = str_list_length(list);
+	char **ret;
+
+	ret = talloc_realloc(NULL, list, char *, len+2);
+	if (ret == NULL) return NULL;
+
+	ret[len] = s;
+	ret[len+1] = NULL;
+
+	return ret;
+}
+
+/**
+  copy a string list
+  this assumes list will not change
+*/
+_PUBLIC_ char **str_list_copy_const(TALLOC_CTX *mem_ctx, const char **list)
+{
+	int i;
+	char **ret;
+
+	if (list == NULL)
+		return NULL;
+	
+	ret = talloc_array(mem_ctx, char *, str_list_length(list)+1);
+	if (ret == NULL) 
+		return NULL;
+
+	for (i=0;list && list[i];i++) {
+		ret[i] = list[i];
+	}
+	ret[i] = NULL;
+	return ret;
+}
diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk
index 2ca4e4c..8d16479 100644
--- a/source4/dsdb/config.mk
+++ b/source4/dsdb/config.mk
@@ -37,7 +37,9 @@ SAMDB_SCHEMA_OBJ_FILES = $(addprefix $(dsdbsrcdir)/schema/, \
 		schema_set.o \
 		schema_query.o \
 		schema_syntax.o \
-		schema_description.o)
+		schema_description.o \
+		schema_convert_to_ol.o \
+		schema_inferiors.o)
 
 $(eval $(call proto_header_template,$(dsdbsrcdir)/schema/proto.h,$(SAMDB_SCHEMA_OBJ_FILES:.o=.c)))
 # PUBLIC_HEADERS += dsdb/schema/schema.h
diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
index edd4512..b1d8711 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
@@ -39,30 +39,43 @@ static int generate_extendedAttributeInfo(struct ldb_context *ldb, struct ldb_me
 					  const struct dsdb_schema *schema);
 static int generate_extendedClassInfo(struct ldb_context *ldb, struct ldb_message *msg,
 				      const struct dsdb_schema *schema);
+static int generate_possibleInferiors(struct ldb_context *ldb, struct ldb_message *msg,
+				      const struct dsdb_schema *schema);
 
 static const struct {
 	const char *attr;
 	int (*fn)(struct ldb_context *, struct ldb_message *, const struct dsdb_schema *);
+	bool aggregate;
 } generated_attrs[] = {
 	{
 		.attr = "objectClasses",
-		.fn = generate_objectClasses
+		.fn = generate_objectClasses,
+		.aggregate = true,
 	},
 	{
 		.attr = "attributeTypes",
-		.fn = generate_attributeTypes
+		.fn = generate_attributeTypes,
+		.aggregate = true,
 	},
 	{
 		.attr = "dITContentRules",
-		.fn = generate_dITContentRules
+		.fn = generate_dITContentRules,
+		.aggregate = true,
 	},
 	{
 		.attr = "extendedAttributeInfo",
-		.fn = generate_extendedAttributeInfo
+		.fn = generate_extendedAttributeInfo,
+		.aggregate = true,
 	},
 	{
 		.attr = "extendedClassInfo",
-		.fn = generate_extendedClassInfo
+		.fn = generate_extendedClassInfo,
+		.aggregate = true,
+	},
+	{
+		.attr = "possibleInferiors",
+		.fn = generate_possibleInferiors,
+		.aggregate = false,
 	}
 };
 
@@ -385,6 +398,46 @@ static int generate_extendedClassInfo(struct ldb_context *ldb,
 	return LDB_SUCCESS;
 }
 
+
+static int generate_possibleInferiors(struct ldb_context *ldb, struct ldb_message *msg,
+				      const struct dsdb_schema *schema) 
+{
+	struct ldb_dn *dn = msg->dn;
+	int ret, i;
+	const char *first_component_name = ldb_dn_get_component_name(dn, 0);
+	const struct ldb_val *first_component_val;
+	const char *class_name;
+	const struct dsdb_class *schema_class;
+	const char **possibleInferiors;
+
+	if (strcasecmp(first_component_name, "cn") != 0) {
+		return LDB_SUCCESS;
+	}
+
+	first_component_val = ldb_dn_get_component_val(dn, 0);
+	class_name = (const char *)first_component_val->data;
+
+	schema_class = dsdb_class_by_cn(schema, class_name);
+	if (schema_class == NULL) {
+		return LDB_SUCCESS;
+	}
+	
+	possibleInferiors = schema_class->possibleInferiors;
+	if (possibleInferiors == NULL) {
+		return LDB_SUCCESS;
+	}
+
+	for (i=0;possibleInferiors[i];i++) {
+		ret = ldb_msg_add_string(msg, "possibleInferiors", possibleInferiors[i]);
+		if (ret != LDB_SUCCESS) {
+			return ret;
+		}
+	}
+
+	return LDB_SUCCESS;
+}
+
+
 /* Add objectClasses, attributeTypes and dITContentRules from the
    schema object (they are not stored in the database)
  */
@@ -412,19 +465,29 @@ static int schema_fsmo_search_callback(struct ldb_request *req, struct ldb_reply
 	switch (ares->type) {
 	case LDB_REPLY_ENTRY:
 
-		if (ldb_dn_compare(ares->message->dn, mc->aggregate_dn) != 0) {
-			return ldb_module_send_entry(ac->req, ares->message, ares->controls);
-		}
-
-		for (i=0; i < ARRAY_SIZE(generated_attrs); i++) {
-			if (ldb_attr_in_list(ac->req->op.search.attrs, generated_attrs[i].attr)) {
-				ret = generated_attrs[i].fn(ldb, ares->message, ac->schema);
-				if (ret != LDB_SUCCESS) {
-					return ret;
+		if (ldb_dn_compare(ares->message->dn, mc->aggregate_dn) == 0) {
+			for (i=0; i < ARRAY_SIZE(generated_attrs); i++) {
+				if (generated_attrs[i].aggregate &&
+				    ldb_attr_in_list(ac->req->op.search.attrs, generated_attrs[i].attr)) {
+					ret = generated_attrs[i].fn(ldb, ares->message, ac->schema);
+					if (ret != LDB_SUCCESS) {
+						return ret;
+					}
+				}
+			}
+		} else {
+			for (i=0; i < ARRAY_SIZE(generated_attrs); i++) {
+				if (!generated_attrs[i].aggregate &&
+				    ldb_attr_in_list(ac->req->op.search.attrs, generated_attrs[i].attr)) {
+					ret = generated_attrs[i].fn(ldb, ares->message, ac->schema);
+					if (ret != LDB_SUCCESS) {
+						return ret;
+					}
 				}
 			}
 		}
 
+
 		return ldb_module_send_entry(ac->req, ares->message, ares->controls);
 
 	case LDB_REPLY_REFERRAL:
diff --git a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py
index aab93e5..67918d6 100755
--- a/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py
+++ b/source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py
@@ -222,8 +222,8 @@ def test_class(db, classinfo, oc):
     poss2 = possible_inferiors_constructed(db, classinfo, oc)
     if poss1 != poss2:
         print "Returned incorrect list for objectclass %s" % oc
-        print poss1
-        print poss2
+        print "search:      %s" % poss1
+        print "constructed: %s" % poss2
         for i in range(0,min(len(poss1),len(poss2))):
             print "%30s %30s" % (poss1[i], poss2[i])
         exit(1)
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index f7d59a7..e15f65a 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -91,6 +91,7 @@ struct dsdb_attribute {
 
 	/* internal stuff */
 	const struct dsdb_syntax *syntax;
+	const struct ldb_schema_attribute *ldb_schema_attribute;
 };
 
 struct dsdb_class {
@@ -131,6 +132,11 @@ struct dsdb_class {
 	bool defaultHidingValue;
 	bool isDefunct;
 	bool systemOnly;
+
+	char **supclasses;
+	char **subclasses;
+	char **subclasses_direct;
+	char **posssuperiors;
 };
 
 struct dsdb_schema_oid_prefix {
@@ -156,6 +162,21 @@ struct dsdb_schema {
 	struct dsdb_attribute *attributes;
 	struct dsdb_class *classes;
 
+	/* lists of classes sorted by various attributes, for faster
+	   access */
+	uint32_t num_classes;
+	struct dsdb_class **classes_by_lDAPDisplayName;
+	struct dsdb_class **classes_by_governsID_id;
+	struct dsdb_class **classes_by_governsID_oid;
+	struct dsdb_class **classes_by_cn;
+
+	/* lists of attributes sorted by various fields */
+	uint32_t num_attributes;
+	struct dsdb_attribute **attributes_by_lDAPDisplayName;
+	struct dsdb_attribute **attributes_by_attributeID_id;
+	struct dsdb_attribute **attributes_by_attributeID_oid;
+	struct dsdb_attribute **attributes_by_linkID;
+
 	struct {
 		bool we_are_master;
 		struct ldb_dn *master_dn;
diff --git a/source4/dsdb/schema/schema_convert_to_ol.c b/source4/dsdb/schema/schema_convert_to_ol.c
new file mode 100644
index 0000000..ebcb7ad
--- /dev/null
+++ b/source4/dsdb/schema/schema_convert_to_ol.c
@@ -0,0 +1,350 @@
+/* 
+   schema conversion routines
+
+   Copyright (C) Andrew Bartlett 2006-2008
+  
+   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/>.
+   
+*/
+
+#include "includes.h"
+#include "ldb.h"
+#include "dsdb/samdb/samdb.h"
+#include "system/locale.h"
+
+#define SEPERATOR "\n  "
+
+struct attr_map {
+	char *old_attr;
+	char *new_attr;
+};
+
+struct oid_map {
+	char *old_oid;
+	char *new_oid;
+};
+
+static char *print_schema_recursive(char *append_to_string, struct dsdb_schema *schema, const char *print_class,
+				    enum dsdb_schema_convert_target target, 
+				    const char **attrs_skip, const struct attr_map *attr_map, const struct oid_map *oid_map) 
+{
+	char *out = append_to_string;
+	const struct dsdb_class *objectclass;
+	objectclass = dsdb_class_by_lDAPDisplayName(schema, print_class);
+	if (!objectclass) {
+		DEBUG(0, ("Cannot find class %s in schema\n", print_class));
+		return NULL;
+	}
+
+	do {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list