[SCM] Samba Shared Repository - branch master updated

Kamen Mazdrashki kamenim at samba.org
Fri Apr 9 03:29:35 MDT 2010


The branch, master has been updated
       via  8149094... s4/dsdb: Set schemaInfo attribute value during provisioning
       via  4ba2ac0... s4/dsdb: split writing of schemaInfo blob in two parts
       via  fbef33f... s4/dsdb: Let caller to control if valid invocationId is critical or zero-guid is acceptable
       via  2763a4a... s4/test: Add DRS-UNIT test suite to 'quicktests' list
       via  5363b6e... s4/dsdb: Use dsdb_schema_info object to create default schemaInfo values
       via  c3d7798... s4/dsdb: Use dsdb_schema_info object to verify schema_info blobs
       via  e5ef11f... s4/test: Use drsut_schemainfo_new() instead of SCHEMA_INFO_DEFAULT local define
       via  15921b6... s4/waf: add new files to WAF build
       via  6d439af... s4/samldb: schemaInfo attribute must be updated when adding new Schema object
       via  7f0da64... s4/test: add shemaInfo torture test to automated test suite
       via  08dd0d0... s4/schema: Torture test for schemaInfo implementation
       via  80d8f37... s4/was: Add 'drsblobs' Python module
       via  3629fb9... s4: Add 'drsblobs' Python module
       via  8dd5705... librpc/idl: Use [nopython] attr for types used in decode_PrimaryKerberos method
       via  2ea99c2... librpc/idl Use [nopython] on some drsblobs.idl 'functions' as an example
       via  738ac53... pidl:python Allow 'nopython' to work
       via  526e62c... s4/tort: Unit test for schemaInfo implementation
       via  ae30cb9... torture: add torture_assert_goto() convenience macro
       via  9d1f8bc... s4/dsdb: dsdb_schema_info object implementation
       via  37a6b66... s4/dsdb: Define dsdb representation for schemaInfo attribute
       via  6e7be5f... s4/ldif: Handle Schema:schemaInfo blobs
       via  ffd1d7e... s4/idl: drsblobs IDL regeneration
       via  63e1aae... s4/idl: Schema:schemaInfo attribute description
      from  deccb6c... s4-krb5: Fix typos in comment.

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


- Log -----------------------------------------------------------------
commit 8149094eddebd9a0e8b7c123c2ed54d00164bb26
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Fri Apr 9 10:48:20 2010 +0300

    s4/dsdb: Set schemaInfo attribute value during provisioning
    
    After provisioning new Forest, schemaInfo should be set
    to a value with revision=1 and current invocation_id

commit 4ba2ac073d7a7859ab73f8b7f40d630ddbff8687
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 10:23:13 2010 +0300

    s4/dsdb: split writing of schemaInfo blob in two parts
    
    ldb_msg preparation is moved into separate function
    so that it can be used for implementing schemaInfo
    updates both on module stack (dsdb_module_... functions)
    and directly on ldb_context

commit fbef33fb7369f57e6851d3766f87c953ca2d26bd
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 08:27:07 2010 +0300

    s4/dsdb: Let caller to control if valid invocationId is critical or zero-guid is acceptable

commit 2763a4ac4e8c93701e00a3baa9fb2dfa24b776f4
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 05:32:59 2010 +0300

    s4/test: Add DRS-UNIT test suite to 'quicktests' list

commit 5363b6e68b2eb432142b4c0d4972ea4def17c1be
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 05:31:35 2010 +0300

    s4/dsdb: Use dsdb_schema_info object to create default schemaInfo values

commit c3d77989913a1ec270a50847922f6c1ffd7cbad0
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 05:30:16 2010 +0300

    s4/dsdb: Use dsdb_schema_info object to verify schema_info blobs

commit e5ef11f4e29af77147dc21e6e8986ed091818566
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 05:27:59 2010 +0300

    s4/test: Use drsut_schemainfo_new() instead of SCHEMA_INFO_DEFAULT local define

commit 15921b669e6c8ef7b6d90708edde7c6eb4009d36
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Wed Apr 7 14:22:49 2010 +0300

    s4/waf: add new files to WAF build

commit 6d439afbf77b15d34310144c473f6600148f7d84
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Apr 6 15:17:05 2010 +0300

    s4/samldb: schemaInfo attribute must be updated when adding new Schema object

commit 7f0da64a4990f21f67afde192322a53bcb4438ce
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Wed Apr 7 13:00:53 2010 +0300

    s4/test: add shemaInfo torture test to automated test suite

commit 08dd0d0b54062c34643cf3b0fbaeabfc3d471782
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Wed Mar 31 04:18:06 2010 +0300

    s4/schema: Torture test for schemaInfo implementation
    
    This test checks if schemaInfo revision changes when an object
    is added or modified in Schema.
    
    Ref. [MS-ADTS], 3.1.1.2.1

commit 80d8f37b26c2919899ec3de9ec5b2c1079436c6e
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Thu Apr 8 10:51:36 2010 +0300

    s4/was: Add 'drsblobs' Python module

commit 3629fb9927074154c15ac0d16cce187bc6b9e665
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Wed Mar 31 04:13:18 2010 +0300

    s4: Add 'drsblobs' Python module
    
    This module is be very useful when it comes to making
    torture tests.

commit 8dd5705a591ee617478663180316dd0f768049b9
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Apr 6 15:10:47 2010 +0300

    librpc/idl: Use [nopython] attr for types used in decode_PrimaryKerberos method
    
    C code generation for python module generates invalid code
    (i.e. can not be compiled).
    Another reason to 'hide' those types from Python is
    that those types are not used at the moment
    (and most probably won't be used in the future)

commit 2ea99c22c3e89780062959dd9da71f5b5da7831e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 6 11:32:57 2010 +1000

    librpc/idl Use [nopython] on some drsblobs.idl 'functions' as an example
    
    It makes little sense to expose these 'functions' to anything other
    than ndrdump.
    
    Andrew Bartlett

commit 738ac5303711567e43b60810ae8d6910d071709a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Apr 6 11:32:14 2010 +1000

    pidl:python Allow 'nopython' to work
    
    The 'nopython' flag wasn't available for use, as it failed to get past
    the syntax checker.
    
    Andrew Bartlett

commit 526e62c46f432950645dc7019969eb694d7b0c6b
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Mon Mar 29 12:31:38 2010 +0300

    s4/tort: Unit test for schemaInfo implementation

commit ae30cb958e86364b653c3e46cdc889e0324660a2
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Sat Mar 27 03:04:09 2010 +0200

    torture: add torture_assert_goto() convenience macro

commit 9d1f8bcca9e39d1e0caa9377f30c290b0738f080
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Mar 23 16:44:02 2010 +0200

    s4/dsdb: dsdb_schema_info object implementation

commit 37a6b66344ae5832bd3db71983bf75c1309e5b9d
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Mar 23 02:32:14 2010 +0200

    s4/dsdb: Define dsdb representation for schemaInfo attribute

commit 6e7be5f4d1eccccb93f8e3ed2751e8851f94517f
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date:   Thu Mar 18 17:04:34 2010 +0200

    s4/ldif: Handle Schema:schemaInfo blobs

commit ffd1d7ee7e19db6b97177f8b2ae0871954cc6a20
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date:   Thu Mar 18 02:33:04 2010 +0200

    s4/idl: drsblobs IDL regeneration

commit 63e1aae69c7a6af9a09cf7b4baa173c42cd569cc
Author: Kamen Mazdrashki <kamen.mazdrashki at postpath.com>
Date:   Thu Mar 18 02:30:51 2010 +0200

    s4/idl: Schema:schemaInfo attribute description

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

Summary of changes:
 lib/torture/torture.h                            |    7 +
 librpc/gen_ndr/drsblobs.h                        |   20 +-
 librpc/gen_ndr/ndr_drsblobs.c                    |   63 +++
 librpc/gen_ndr/ndr_drsblobs.h                    |    3 +
 librpc/idl/drsblobs.idl                          |   40 +-
 pidl/lib/Parse/Pidl/Compat.pm                    |    1 +
 pidl/lib/Parse/Pidl/NDR.pm                       |    1 +
 source4/dsdb/config.mk                           |    3 +-
 source4/dsdb/samdb/ldb_modules/samldb.c          |   50 ++
 source4/dsdb/schema/schema.h                     |    8 +
 source4/dsdb/schema/schema_info_attr.c           |  462 +++++++++++++++++
 source4/dsdb/schema/schema_init.c                |   45 +-
 source4/dsdb/schema/schema_prefixmap.c           |   15 +-
 source4/dsdb/schema/schema_set.c                 |   10 +-
 source4/dsdb/wscript_build                       |    2 +-
 source4/lib/ldb-samba/ldif_handlers.c            |   20 +
 source4/lib/ldb-samba/ldif_handlers.h            |    1 +
 source4/lib/ldb/tests/python/dsdb_schema_info.py |  209 ++++++++
 source4/librpc/config.mk                         |   11 +
 source4/librpc/wscript_build                     |   13 +
 source4/scripting/python/pyglue.c                |   26 +
 source4/scripting/python/samba/__init__.py       |    3 +
 source4/scripting/python/samba/provision.py      |    2 +
 source4/selftest/quick                           |    1 +
 source4/selftest/tests.sh                        |    1 +
 source4/torture/drs/config.mk                    |    1 +
 source4/torture/drs/drs_init.c                   |    2 +
 source4/torture/drs/unit/prefixmap_tests.c       |   48 ++-
 source4/torture/drs/unit/schemainfo_tests.c      |  579 ++++++++++++++++++++++
 source4/torture/drs/wscript_build                |    2 +-
 30 files changed, 1581 insertions(+), 68 deletions(-)
 create mode 100644 source4/dsdb/schema/schema_info_attr.c
 create mode 100755 source4/lib/ldb/tests/python/dsdb_schema_info.py
 create mode 100644 source4/torture/drs/unit/schemainfo_tests.c


Changeset truncated at 500 lines:

diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index cb2c02b..af61ac1 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -238,6 +238,13 @@ void torture_result(struct torture_context *test,
 		return false; \
 	}
 
+#define torture_assert_goto(torture_ctx,expr,ret,label,cmt) \
+	if (!(expr)) { \
+		torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \
+		ret = false; \
+		goto label; \
+	}
+
 #define torture_assert_werr_equal(torture_ctx, got, expected, cmt) \
 	do { WERROR __got = got, __expected = expected; \
 	if (!W_ERROR_EQUAL(__got, __expected)) { \
diff --git a/librpc/gen_ndr/drsblobs.h b/librpc/gen_ndr/drsblobs.h
index b7f9dac..3d5d0f2 100644
--- a/librpc/gen_ndr/drsblobs.h
+++ b/librpc/gen_ndr/drsblobs.h
@@ -135,6 +135,12 @@ struct partialAttributeSetBlob {
 	union partialAttributeSetCtr ctr;/* [switch_is(version)] */
 }/* [public] */;
 
+struct schemaInfoBlob {
+	uint8_t marker;/* [value(0xFF)] */
+	uint32_t revision;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */
+	struct GUID invocation_id;
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
+
 struct drsuapi_MSPrefixMap_Entry {
 	uint16_t entryID;
 	uint16_t length;
@@ -230,7 +236,7 @@ struct package_PrimaryKerberosString {
 	uint16_t length;/* [value(2*strlen_m(string))] */
 	uint16_t size;/* [value(2*strlen_m(string))] */
 	const char * string;/* [relative,subcontext_size(size),subcontext(0),flag(LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING)] */
-};
+}/* [nopython] */;
 
 struct package_PrimaryKerberosKey3 {
 	uint16_t reserved1;/* [value(0)] */
@@ -239,7 +245,7 @@ struct package_PrimaryKerberosKey3 {
 	uint32_t keytype;
 	uint32_t value_len;/* [value((value?value->length:0))] */
 	DATA_BLOB *value;/* [relative,subcontext_size(value_len),subcontext(0),flag(LIBNDR_FLAG_REMAINING)] */
-};
+}/* [nopython] */;
 
 struct package_PrimaryKerberosCtr3 {
 	uint16_t num_keys;
@@ -252,7 +258,7 @@ struct package_PrimaryKerberosCtr3 {
 	uint32_t padding3;/* [value(0)] */
 	uint32_t padding4;/* [value(0)] */
 	uint32_t padding5;/* [value(0)] */
-};
+}/* [nopython] */;
 
 struct package_PrimaryKerberosKey4 {
 	uint16_t reserved1;/* [value(0)] */
@@ -262,7 +268,7 @@ struct package_PrimaryKerberosKey4 {
 	uint32_t keytype;
 	uint32_t value_len;/* [value((value?value->length:0))] */
 	DATA_BLOB *value;/* [relative,subcontext_size(value_len),subcontext(0),flag(LIBNDR_FLAG_REMAINING)] */
-};
+}/* [nopython] */;
 
 struct package_PrimaryKerberosCtr4 {
 	uint16_t num_keys;
@@ -275,18 +281,18 @@ struct package_PrimaryKerberosCtr4 {
 	struct package_PrimaryKerberosKey4 *service_keys;
 	struct package_PrimaryKerberosKey4 *old_keys;
 	struct package_PrimaryKerberosKey4 *older_keys;
-};
+}/* [nopython] */;
 
 union package_PrimaryKerberosCtr {
 	struct package_PrimaryKerberosCtr3 ctr3;/* [case(3)] */
 	struct package_PrimaryKerberosCtr4 ctr4;/* [case(4)] */
-}/* [nodiscriminant] */;
+}/* [nopython,nodiscriminant] */;
 
 struct package_PrimaryKerberosBlob {
 	uint16_t version;
 	uint16_t flags;/* [value(0)] */
 	union package_PrimaryKerberosCtr ctr;/* [switch_is(version)] */
-}/* [public] */;
+}/* [nopython,public] */;
 
 struct package_PrimaryCLEARTEXTBlob {
 	DATA_BLOB cleartext;/* [flag(LIBNDR_FLAG_REMAINING)] */
diff --git a/librpc/gen_ndr/ndr_drsblobs.c b/librpc/gen_ndr/ndr_drsblobs.c
index 7de1de7..fa8ef89 100644
--- a/librpc/gen_ndr/ndr_drsblobs.c
+++ b/librpc/gen_ndr/ndr_drsblobs.c
@@ -1218,6 +1218,69 @@ _PUBLIC_ void ndr_print_partialAttributeSetBlob(struct ndr_print *ndr, const cha
 	ndr->depth--;
 }
 
+_PUBLIC_ enum ndr_err_code ndr_push_schemaInfoBlob(struct ndr_push *ndr, int ndr_flags, const struct schemaInfoBlob *r)
+{
+	{
+		uint32_t _flags_save_STRUCT = ndr->flags;
+		ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+		if (ndr_flags & NDR_SCALARS) {
+			NDR_CHECK(ndr_push_align(ndr, 4));
+			NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0xFF));
+			{
+				uint32_t _flags_save_uint32 = ndr->flags;
+				ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+				NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->revision));
+				ndr->flags = _flags_save_uint32;
+			}
+			NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->invocation_id));
+			NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+		}
+		if (ndr_flags & NDR_BUFFERS) {
+		}
+		ndr->flags = _flags_save_STRUCT;
+	}
+	return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_schemaInfoBlob(struct ndr_pull *ndr, int ndr_flags, struct schemaInfoBlob *r)
+{
+	{
+		uint32_t _flags_save_STRUCT = ndr->flags;
+		ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+		if (ndr_flags & NDR_SCALARS) {
+			NDR_CHECK(ndr_pull_align(ndr, 4));
+			NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->marker));
+			{
+				uint32_t _flags_save_uint32 = ndr->flags;
+				ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+				NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->revision));
+				ndr->flags = _flags_save_uint32;
+			}
+			NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->invocation_id));
+			NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+		}
+		if (ndr_flags & NDR_BUFFERS) {
+		}
+		ndr->flags = _flags_save_STRUCT;
+	}
+	return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_schemaInfoBlob(struct ndr_print *ndr, const char *name, const struct schemaInfoBlob *r)
+{
+	ndr_print_struct(ndr, name, "schemaInfoBlob");
+	{
+		uint32_t _flags_save_STRUCT = ndr->flags;
+		ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+		ndr->depth++;
+		ndr_print_uint8(ndr, "marker", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0xFF:r->marker);
+		ndr_print_uint32(ndr, "revision", r->revision);
+		ndr_print_GUID(ndr, "invocation_id", &r->invocation_id);
+		ndr->depth--;
+		ndr->flags = _flags_save_STRUCT;
+	}
+}
+
 static enum ndr_err_code ndr_push_drsuapi_MSPrefixMap_Entry(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_MSPrefixMap_Entry *r)
 {
 	{
diff --git a/librpc/gen_ndr/ndr_drsblobs.h b/librpc/gen_ndr/ndr_drsblobs.h
index 40fac7c..30e915d 100644
--- a/librpc/gen_ndr/ndr_drsblobs.h
+++ b/librpc/gen_ndr/ndr_drsblobs.h
@@ -80,6 +80,9 @@ void ndr_print_partialAttributeSetCtr(struct ndr_print *ndr, const char *name, c
 enum ndr_err_code ndr_push_partialAttributeSetBlob(struct ndr_push *ndr, int ndr_flags, const struct partialAttributeSetBlob *r);
 enum ndr_err_code ndr_pull_partialAttributeSetBlob(struct ndr_pull *ndr, int ndr_flags, struct partialAttributeSetBlob *r);
 void ndr_print_partialAttributeSetBlob(struct ndr_print *ndr, const char *name, const struct partialAttributeSetBlob *r);
+enum ndr_err_code ndr_push_schemaInfoBlob(struct ndr_push *ndr, int ndr_flags, const struct schemaInfoBlob *r);
+enum ndr_err_code ndr_pull_schemaInfoBlob(struct ndr_pull *ndr, int ndr_flags, struct schemaInfoBlob *r);
+void ndr_print_schemaInfoBlob(struct ndr_print *ndr, const char *name, const struct schemaInfoBlob *r);
 void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const char *name, const struct drsuapi_MSPrefixMap_Entry *r);
 enum ndr_err_code ndr_push_drsuapi_MSPrefixMap_Ctr(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_MSPrefixMap_Ctr *r);
 enum ndr_err_code ndr_pull_drsuapi_MSPrefixMap_Ctr(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_MSPrefixMap_Ctr *r);
diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl
index 5b10326..89b5760 100644
--- a/librpc/idl/drsblobs.idl
+++ b/librpc/idl/drsblobs.idl
@@ -175,6 +175,22 @@ interface drsblobs {
 		[in] partialAttributeSetBlob blob
 		);
 
+
+	/*
+	 * schemaInfo attribute
+	 *
+	 * Used as an attribute on Schema.
+	 * Also during replication as part of
+	 * prefixMap to identify what revision
+	 * of Schema source DC has
+	 */
+	typedef [public,flag(NDR_NOALIGN)] struct {
+		[value(0xFF)] uint8 marker;
+		[flag(NDR_BIG_ENDIAN)] uint32 revision;
+		GUID   invocation_id;
+	} schemaInfoBlob;
+
+
 	/*
 	 * MS w2k3 and w2k8 prefixMap format
 	 * There is no version number. Format is:
@@ -318,13 +334,13 @@ interface drsblobs {
 		[in] package_PackagesBlob blob
 		);
 
-	typedef struct {
+	typedef [nopython] struct {
 		[value(2*strlen_m(string))] uint16 length;
 		[value(2*strlen_m(string))] uint16 size;
 		[relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string;
 	} package_PrimaryKerberosString;
 
-	typedef struct {
+	typedef [nopython] struct {
 		[value(0)] uint16 reserved1;
 		[value(0)] uint16 reserved2;
 		[value(0)] uint32 reserved3;
@@ -333,7 +349,7 @@ interface drsblobs {
 		[relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
 	} package_PrimaryKerberosKey3;
 
-	typedef struct {
+	typedef [nopython] struct {
 		uint16 num_keys;
 		uint16 num_old_keys;
 		package_PrimaryKerberosString salt;
@@ -346,7 +362,7 @@ interface drsblobs {
 		[value(0)] uint32 padding5;
 	} package_PrimaryKerberosCtr3;
 
-	typedef struct {
+	typedef [nopython] struct {
 		[value(0)] uint16 reserved1;
 		[value(0)] uint16 reserved2;
 		[value(0)] uint32 reserved3;
@@ -356,7 +372,7 @@ interface drsblobs {
 		[relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
 	} package_PrimaryKerberosKey4;
 
-	typedef struct {
+	typedef [nopython] struct {
 		uint16 num_keys;
 		[value(0)] uint16 num_service_keys;
 		uint16 num_old_keys;
@@ -369,18 +385,18 @@ interface drsblobs {
 		package_PrimaryKerberosKey4 older_keys[num_older_keys];
 	} package_PrimaryKerberosCtr4;
 
-	typedef [nodiscriminant] union {
+	typedef [nodiscriminant,nopython] union {
 		[case(3)] package_PrimaryKerberosCtr3 ctr3;
 		[case(4)] package_PrimaryKerberosCtr4 ctr4;
 	} package_PrimaryKerberosCtr;
 
-	typedef [public] struct {
+	typedef [public,nopython] struct {
 		uint16 version;
 		[value(0)] uint16 flags;
 		[switch_is(version)] package_PrimaryKerberosCtr ctr;
 	} package_PrimaryKerberosBlob;
 
-	void decode_PrimaryKerberos(
+	[nopython] void decode_PrimaryKerberos(
 		[in] package_PrimaryKerberosBlob blob
 		);
 
@@ -470,7 +486,7 @@ interface drsblobs {
 		[relative] AuthenticationInformationArray *previous;
 	} trustAuthInOutBlob;
 
-	void decode_trustAuthInOut(
+	[nopython] void decode_trustAuthInOut(
 		[in] trustAuthInOutBlob blob
 		);
 
@@ -487,7 +503,7 @@ interface drsblobs {
 		[value(ndr_size_trustCurrentPasswords(&incoming, ndr->iconv_convenience, ndr->flags))] uint32 incoming_size;
 	} trustDomainPasswords;
 
-	void decode_trustDomainPasswords(
+	[nopython] void decode_trustDomainPasswords(
 		[in] trustDomainPasswords blob
 		);
 
@@ -568,7 +584,7 @@ interface drsblobs {
 		[unique] ExtendedErrorInfo *info;
 	} ExtendedErrorInfoPtr;
 
-	void decode_ExtendedErrorInfo (
+	[nopython] void decode_ExtendedErrorInfo (
 		[in,subcontext(0xFFFFFC01)] ExtendedErrorInfoPtr ptr
 		);
 
@@ -625,7 +641,7 @@ interface drsblobs {
 		ForestTrustInfoRecordArmor records[count];
 	} ForestTrustInfo;
 
-	void decode_ForestTrustInfo(
+	[nopython] void decode_ForestTrustInfo(
 		[in] ForestTrustInfo blob
 		);
 }
diff --git a/pidl/lib/Parse/Pidl/Compat.pm b/pidl/lib/Parse/Pidl/Compat.pm
index c248677..66f3c5f 100644
--- a/pidl/lib/Parse/Pidl/Compat.pm
+++ b/pidl/lib/Parse/Pidl/Compat.pm
@@ -44,6 +44,7 @@ my %supported_properties = (
 	"nopush"		=> ["FUNCTION", "TYPEDEF"],
 	"nopull"		=> ["FUNCTION", "TYPEDEF"],
 	"noprint"		=> ["FUNCTION", "TYPEDEF"],
+        "nopython"              => ["FUNCTION", "TYPEDEF"],
 
 	# union
 	"switch_is"		=> ["ELEMENT"],
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index d326f67..3d91f3a 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -917,6 +917,7 @@ my %property_list = (
 	"nopull"		=> ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
 	"nosize"		=> ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
 	"noprint"		=> ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "ELEMENT"],
+	"nopython"		=> ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
 	"todo"			=> ["FUNCTION"],
 
 	# union
diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk
index 2bd19e9..4363399 100644
--- a/source4/dsdb/config.mk
+++ b/source4/dsdb/config.mk
@@ -42,7 +42,8 @@ SAMDB_SCHEMA_OBJ_FILES = $(addprefix $(dsdbsrcdir)/schema/, \
 		schema_description.o \
 		schema_convert_to_ol.o \
 		schema_inferiors.o \
-		schema_prefixmap.o)
+		schema_prefixmap.o \
+		schema_info_attr.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/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 24d1450..3b2d283 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1054,6 +1054,44 @@ static int samldb_check_rdn(struct ldb_module *module, struct ldb_dn *dn)
 	return LDB_SUCCESS;
 }
 
+static int samldb_schema_info_update(struct samldb_ctx *ac)
+{
+	WERROR werr;
+	struct ldb_context *ldb;
+	struct dsdb_schema *schema;
+
+	/* replicated update should always go through */
+	if (ldb_request_get_control(ac->req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
+		return LDB_SUCCESS;
+	}
+
+	/* do not update schemaInfo during provisioning */
+	if (ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID)) {
+		return LDB_SUCCESS;
+	}
+
+	ldb = ldb_module_get_ctx(ac->module);
+	schema = dsdb_get_schema(ldb, NULL);
+	if (!schema) {
+		ldb_debug_set(ldb, LDB_DEBUG_FATAL,
+			      "samldb_schema_info_update: no dsdb_schema loaded");
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+
+	werr = dsdb_module_schema_info_update(ac->module, schema, 0);
+	if (!W_ERROR_IS_OK(werr)) {
+		ldb_debug_set(ldb, LDB_DEBUG_FATAL,
+			      "samldb_schema_info_update: "
+		              "dsdb_module_schema_info_update failed with %s",
+		              win_errstr(werr));
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+
+	return LDB_SUCCESS;
+}
+
 /*
  * samldb_sid_from_dn (async)
  */
@@ -1800,6 +1838,12 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req)
 			return ret;
 		}
 
+		ret = samldb_schema_info_update(ac);
+		if (ret != LDB_SUCCESS) {
+			talloc_free(ac);
+			return ret;
+		}
+
 		return samldb_fill_object(ac, "classSchema");
 	}
 
@@ -1812,6 +1856,12 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req)
 			return ret;
 		}
 
+		ret = samldb_schema_info_update(ac);
+		if (ret != LDB_SUCCESS) {
+			talloc_free(ac);
+			return ret;
+		}
+
 		return samldb_fill_object(ac, "attributeSchema");
 	}
 
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index 7283744..d0ed62e 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -165,6 +165,14 @@ struct dsdb_class {
 	uint32_t subClass_order;
 };
 
+/**
+ * data stored in schemaInfo attribute
+ */
+struct dsdb_schema_info {
+	uint32_t 	revision;
+	struct GUID	invocation_id;
+};
+
 
 struct dsdb_schema {
 	struct ldb_dn *base_dn;
diff --git a/source4/dsdb/schema/schema_info_attr.c b/source4/dsdb/schema/schema_info_attr.c
new file mode 100644
index 0000000..bb89be1
--- /dev/null
+++ b/source4/dsdb/schema/schema_info_attr.c
@@ -0,0 +1,462 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   SCHEMA::schemaInfo implementation
+
+   Copyright (C) Kamen Mazdrashki <kamenim at samba.org> 2010
+
+   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 "dsdb/common/util.h"
+#include "dsdb/samdb/samdb.h"
+#include "dsdb/samdb/ldb_modules/util.h"
+#include "lib/ldb/include/ldb_module.h"
+#include "librpc/gen_ndr/ndr_drsuapi.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "param/param.h"
+
+
+/**
+ * Parse schemaInfo structure from a data_blob
+ * (DATA_BLOB or ldb_val).
+ * Suitable for parsing blobs that comes from
+ * DRS interface of from LDB database
+ */
+WERROR dsdb_schema_info_from_blob(const DATA_BLOB *blob,
+				  TALLOC_CTX *mem_ctx, struct dsdb_schema_info **_schema_info)
+{
+	TALLOC_CTX *temp_ctx;
+	enum ndr_err_code ndr_err;
+	struct dsdb_schema_info *schema_info;
+	struct schemaInfoBlob schema_info_blob;
+
+	if (!blob || !blob->data) {
+		return WERR_INVALID_PARAMETER;
+	}
+
+	if (blob->length != 21) {
+		return WERR_INVALID_PARAMETER;
+	}
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list