[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Jun 15 00:57:33 MDT 2010


The branch, master has been updated
       via  b16e602... s4:dsdb Move linked attribute restrictions to objectclass_attrs
       via  8ea4118... s4:dsdb Add const to dsdb_dn functions that operate on an ldb_val.
       via  0800c9e... s4:selftest Remove unused basedn specification in selftest env setup
       via  982f688... s4:selftest Remove becomedc tests from knownfail, these should now pass
       via  b5d80a2... s4:dsdb Rework the vampire schema handling to convert 3 times.
       via  7c60ac9... s4:provision Allow a specific prefix map to be loaded into a new schema provision
       via  9e28ced... s4:dsdb Keep the DRS-based prefix map for use in provision-based schema
       via  5323485... s4:dsdb Allow the setting an override on the schema
       via  6a2f7fe... s4:dsdb Use the schema from our local provision to decode the schema
       via  ecf782d... s4:torture Rework NET-API-BECOMEDC test to use libnet_vampire callbacks.
       via  c313590... s4:libnet Steal ldb and lp_ctx from python result into correct structures.
       via  1104b41... s4:libnet Make the libnet_vampire default callbacks non-static
      from  2977c65... s4 torture: RAW-WRITE should check lockread_supported

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


- Log -----------------------------------------------------------------
commit b16e602660e9fcfe7a0e46633e81c898b2053238
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 14 13:19:43 2010 +1000

    s4:dsdb Move linked attribute restrictions to objectclass_attrs
    
    This puts more of the schema restrictions in one place.
    
    Andrew Bartlett

commit 8ea411847262fec592b48d1a5a3bf4809653a420
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 14 13:27:59 2010 +1000

    s4:dsdb Add const to dsdb_dn functions that operate on an ldb_val.
    
    Andrew Bartlett

commit 0800c9e6f19f7905159ac3ab457ce8cd1899c995
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 15 10:20:37 2010 +1000

    s4:selftest Remove unused basedn specification in selftest env setup

commit 982f688c02aae76e362d9c310284f1c830565759
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 12 13:24:57 2010 +1000

    s4:selftest Remove becomedc tests from knownfail, these should now pass
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit b5d80a225e06a65c6681eef6d065980d94329f58
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 12 11:05:47 2010 +1000

    s4:dsdb Rework the vampire schema handling to convert 3 times.
    
    This seems like a lot of duplicate work, but by the end we should
    have, in normal LDB format, the remote DRS schema, having bootstrapped
    it with the locally loaded schema.
    
    The multiple steps are to resolve the problems with references to
    schema items that we don't 'yet' know about.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit 7c60ac97bf72aa08df39aa9695607270e39931c5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Jun 10 21:33:45 2010 +1000

    s4:provision Allow a specific prefix map to be loaded into a new schema provision
    
    This allows the prefixMap from a DRS server to be used when loading
    the schema from the local files.  This helps us then import other
    schema with this map in place.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit 9e28ceda96a0c76752af851db4ccba86c010ed67
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jun 9 21:53:01 2010 +1000

    s4:dsdb Keep the DRS-based prefix map for use in provision-based schema
    
    We need to use the remote prefix map for the provision schema, or else
    we can't decode new, non-standard attributes into OIDs.  Then once we
    decode that schema, we can try again and get them properly translated.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit 5323485eb3d5aeb844535c5b08fbdd3e7f8c9429
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jun 9 20:52:02 2010 +1000

    s4:dsdb Allow the setting an override on the schema
    
    The change here is to try and convert a per the previous rules, but if
    we don't know a particular OID as a attributeID, then store it as an
    OID (for example).  This allows known values to be converted as
    before, but still copes with unknown values.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit 6a2f7fe04c2c658e59fba01f7346303676b121b3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jun 9 18:57:52 2010 +1000

    s4:dsdb Use the schema from our local provision to decode the schema
    
    This works on the assumption that the schema partition can only
    contain schema objects.
    
    We may need to pass down some kind of 'relax' to the DRS -> LDB
    conversion code, so that it allows incomplete conversions, so that we
    don't fail if a new attribute is present, and we can't decode it.
    This would then be resolved the second time we do the conversion.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit ecf782da87b67b8d977aa1bbfce21f1b6ed8288a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 12 17:24:26 2010 +1000

    s4:torture Rework NET-API-BECOMEDC test to use libnet_vampire callbacks.
    
    The libnet_vampire code was derived from this code in the first place,
    but has continued to evolve, while this code has often bitrotted.
    This avoids the needless duplication of the callbacks, while keeping
    the toture wrapper.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit c3135905473e9a03c891f43a12557cfddb63382b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 12 17:23:32 2010 +1000

    s4:libnet Steal ldb and lp_ctx from python result into correct structures.
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

commit 1104b41f1e7d794f0bb52b9f8c96d7fe43ca0edc
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jun 12 17:22:20 2010 +1000

    s4:libnet Make the libnet_vampire default callbacks non-static
    
    These are intended to be called from the NET-API-BECOMEDC torture test
    to avoid duplication of code.
    
    Andrew Bartlett
    
    Signed-off-by: Kamen Mazdrashki <kamenim at samba.org>

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

Summary of changes:
 selftest/target/Samba4.pm                          |    6 +-
 source4/dsdb/common/util.c                         |    4 +-
 source4/dsdb/samdb/ldb_modules/objectclass_attrs.c |    9 +
 source4/dsdb/schema/schema.h                       |    3 +
 source4/dsdb/schema/schema_init.c                  |  367 -----------
 source4/dsdb/schema/schema_syntax.c                |   26 +-
 source4/dsdb/schema/tests/schema_syntax.c          |    2 +-
 source4/libnet/libnet_vampire.c                    |  355 +++++++----
 source4/libnet/libnet_vampire.h                    |    2 +
 source4/param/provision.c                          |    8 +-
 source4/param/provision.h                          |    3 +-
 source4/scripting/python/samba/schema.py           |    5 +-
 source4/selftest/knownfail                         |    1 -
 source4/torture/libnet/libnet_BecomeDC.c           |  641 ++------------------
 14 files changed, 331 insertions(+), 1101 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index e82ccfd..343834c 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -472,8 +472,7 @@ sub provision_raw_prepare($$$$$$$)
 	$ctx->{username} = "Administrator";
 	$ctx->{domain} = "SAMBADOMAIN";
 	$ctx->{realm} = "SAMBA.EXAMPLE.COM";
-	$ctx->{dnsname} = "samba.example.com";
-	$ctx->{basedn} = "dc=samba,dc=example,dc=com";
+	$ctx->{dnsname} = lc($ctx->{realm});
 	$ctx->{sid_generator} = "internal";
 
 	my $unix_name = ($ENV{USER} or $ENV{LOGNAME} or `whoami`);
@@ -501,9 +500,6 @@ sub provision_raw_prepare($$$$$$$)
 	$ctx->{ipv4} = "127.0.0.$swiface";
 	$ctx->{interfaces} = "$ctx->{ipv4}/8";
 
-	$ctx->{localbasedn} = $ctx->{basedn};
-	$ctx->{localbasedn} = "CN=$netbiosname" if $server_role eq "member server";
-
 	push(@{$ctx->{directories}}, $ctx->{privatedir});
 	push(@{$ctx->{directories}}, $ctx->{etcdir});
 	push(@{$ctx->{directories}}, $ctx->{piddir});
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 811d474..d644d2d 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3074,7 +3074,7 @@ uint32_t dsdb_dn_rmd_flags(struct ldb_dn *dn)
   return RMD_FLAGS directly from a ldb_val for a DN
   returns 0 if RMD_FLAGS is not found
  */
-uint32_t dsdb_dn_val_rmd_flags(struct ldb_val *val)
+uint32_t dsdb_dn_val_rmd_flags(const struct ldb_val *val)
 {
 	const char *p;
 	uint32_t flags;
@@ -3098,7 +3098,7 @@ uint32_t dsdb_dn_val_rmd_flags(struct ldb_val *val)
 /*
   return true if a ldb_val containing a DN in storage form is deleted
  */
-bool dsdb_dn_is_deleted_val(struct ldb_val *val)
+bool dsdb_dn_is_deleted_val(const struct ldb_val *val)
 {
 	return (dsdb_dn_val_rmd_flags(val) & DSDB_RMD_FLAG_DELETED) != 0;
 }
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
index 5b76a0b..36bd860 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
@@ -105,6 +105,15 @@ static int attr_handler(struct oc_context *ac)
 			return LDB_ERR_NO_SUCH_ATTRIBUTE;
 		}
 
+		if ((attr->linkID & 1) == 1) {
+			/* Odd is for the target.  Illegal to modify */
+			ldb_asprintf_errstring(ldb, 
+					       "objectclass_attrs: attribute '%s' on entry '%s' must not be modified directly, it is a linked attribute", 
+					       msg->elements[i].name,
+					       ldb_dn_get_linearized(msg->dn));
+			return LDB_ERR_UNWILLING_TO_PERFORM;
+		}
+		
 		werr = attr->syntax->validate_ldb(ldb, ac->schema, attr,
 						  &msg->elements[i]);
 		if (!W_ERROR_IS_OK(werr)) {
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index 9762a2b..0cbc218 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -221,6 +221,9 @@ struct dsdb_schema {
 	bool refresh_in_progress;
 	/* an 'opaque' sequence number that the reload function may also wish to use */
 	uint64_t reload_seq_number;
+
+	/* Should the syntax handlers in this case handle all incoming OIDs automatically, assigning them as an OID if no text name is known? */
+	bool relax_OID_conversions;
 };
 
 enum dsdb_attr_list_query {
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 8e47f12..2cf5af6 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -806,370 +806,3 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
 	*schema_out = schema;
 	return LDB_SUCCESS;
 }
-
-
-static const struct {
-	const char *name;
-	const char *oid;
-} name_mappings[] = {
-	{ "cn",					"2.5.4.3" },
-	{ "name",				"1.2.840.113556.1.4.1" },
-	{ "lDAPDisplayName",			"1.2.840.113556.1.2.460" },
-	{ "attributeID", 			"1.2.840.113556.1.2.30" },
-	{ "schemaIDGUID", 			"1.2.840.113556.1.4.148" },
-	{ "mAPIID", 				"1.2.840.113556.1.2.49" },
-	{ "attributeSecurityGUID", 		"1.2.840.113556.1.4.149" },
-	{ "searchFlags", 			"1.2.840.113556.1.2.334" },
-	{ "systemFlags", 			"1.2.840.113556.1.4.375" },
-	{ "isMemberOfPartialAttributeSet", 	"1.2.840.113556.1.4.639" },
-	{ "linkID", 				"1.2.840.113556.1.2.50" },
-	{ "attributeSyntax", 			"1.2.840.113556.1.2.32" },
-	{ "oMSyntax", 				"1.2.840.113556.1.2.231" },
-	{ "oMObjectClass", 			"1.2.840.113556.1.2.218" },
-	{ "isSingleValued",			"1.2.840.113556.1.2.33" },
-	{ "rangeLower", 			"1.2.840.113556.1.2.34" },
-	{ "rangeUpper", 			"1.2.840.113556.1.2.35" },
-	{ "extendedCharsAllowed", 		"1.2.840.113556.1.2.380" },
-	{ "schemaFlagsEx", 			"1.2.840.113556.1.4.120" },
-	{ "msDs-Schema-Extensions", 		"1.2.840.113556.1.4.1440" },
-	{ "showInAdvancedViewOnly", 		"1.2.840.113556.1.2.169" },
-	{ "adminDisplayName", 			"1.2.840.113556.1.2.194" },
-	{ "adminDescription", 			"1.2.840.113556.1.2.226" },
-	{ "classDisplayName", 			"1.2.840.113556.1.4.610" },
-	{ "isEphemeral", 			"1.2.840.113556.1.4.1212" },
-	{ "isDefunct", 				"1.2.840.113556.1.4.661" },
-	{ "systemOnly", 			"1.2.840.113556.1.4.170" },
-	{ "governsID",				"1.2.840.113556.1.2.22" },
-	{ "objectClassCategory",		"1.2.840.113556.1.2.370" },
-	{ "rDNAttID",				"1.2.840.113556.1.2.26" },
-	{ "defaultObjectCategory",		"1.2.840.113556.1.4.783" },
-	{ "subClassOf",				"1.2.840.113556.1.2.21" },
-	{ "systemAuxiliaryClass",		"1.2.840.113556.1.4.198" },
-	{ "systemPossSuperiors",		"1.2.840.113556.1.4.195" },
-	{ "systemMustContain",			"1.2.840.113556.1.4.197" },
-	{ "systemMayContain",			"1.2.840.113556.1.4.196" },
-	{ "auxiliaryClass",			"1.2.840.113556.1.2.351" },
-	{ "possSuperiors",			"1.2.840.113556.1.2.8" },
-	{ "mustContain",			"1.2.840.113556.1.2.24" },
-	{ "mayContain",				"1.2.840.113556.1.2.25" },
-	{ "defaultSecurityDescriptor",		"1.2.840.113556.1.4.224" },
-	{ "defaultHidingValue",			"1.2.840.113556.1.4.518" },
-	{ "msDS-IntId",				"1.2.840.113556.1.4.1716" },
-};
-
-static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb_schema *schema,
-								     struct drsuapi_DsReplicaObject *obj,
-								     const char *name,
-								     uint32_t *idx)
-{
-	WERROR status;
-	unsigned int i;
-	uint32_t attid;
-	const char *oid = NULL;
-
-	for(i=0; i < ARRAY_SIZE(name_mappings); i++) {
-		if (strcmp(name_mappings[i].name, name) != 0) continue;
-
-		oid = name_mappings[i].oid;
-		break;
-	}
-
-	if (!oid) {
-		return NULL;
-	}
-
-	status = dsdb_schema_pfm_make_attid(schema->prefixmap, oid, &attid);
-	if (!W_ERROR_IS_OK(status)) {
-		return NULL;
-	}
-
-	for (i=0; i < obj->attribute_ctr.num_attributes; i++) {
-		if (obj->attribute_ctr.attributes[i].attid != attid) continue;
-
-		if (idx) *idx = i;
-		return &obj->attribute_ctr.attributes[i];
-	}
-
-	return NULL;
-}
-
-#define GET_STRING_DS(s, r, attr, mem_ctx, p, elem, strict) do { \
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	if (strict && !_a) { \
-		d_printf("%s: %s == NULL\n", __location__, attr); \
-		return WERR_INVALID_PARAM; \
-	} \
-	if (strict && _a->value_ctr.num_values != 1) { \
-		d_printf("%s: %s num_values == %u\n", __location__, attr, \
-			_a->value_ctr.num_values); \
-		return WERR_INVALID_PARAM; \
-	} \
-	if (_a && _a->value_ctr.num_values >= 1) { \
-		size_t _ret; \
-		if (!convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, \
-					     _a->value_ctr.values[0].blob->data, \
-					     _a->value_ctr.values[0].blob->length, \
-					     (void **)discard_const(&(p)->elem), &_ret, false)) { \
-			DEBUG(0,("%s: invalid data!\n", attr)); \
-			dump_data(0, \
-				     _a->value_ctr.values[0].blob->data, \
-				     _a->value_ctr.values[0].blob->length); \
-			return WERR_FOOBAR; \
-		} \
-	} else { \
-		(p)->elem = NULL; \
-	} \
-} while (0)
-
-#define GET_UINT32_LIST_DS(s, r, attr, mem_ctx, p, elem) do { \
-	unsigned int list_counter;				\
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	(p)->elem = _a ? talloc_array(mem_ctx, uint32_t, _a->value_ctr.num_values + 1) : NULL; \
-        for (list_counter=0;					\
-	     _a && list_counter < _a->value_ctr.num_values;	\
-	     list_counter++) {				\
-		if (_a->value_ctr.values[list_counter].blob->length != 4) { \
-			return WERR_INVALID_PARAM;			\
-		}							\
-		(p)->elem[list_counter] = IVAL(_a->value_ctr.values[list_counter].blob->data, 0); \
-	}								\
-	if (_a) (p)->elem[list_counter] = 0;				\
-} while (0)
-
-#define GET_BOOL_DS(s, r, attr, p, elem, strict) do { \
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	if (strict && !_a) { \
-		d_printf("%s: %s == NULL\n", __location__, attr); \
-		return WERR_INVALID_PARAM; \
-	} \
-	if (strict && _a->value_ctr.num_values != 1) { \
-		d_printf("%s: %s num_values == %u\n", __location__, attr, \
-			 (unsigned int)_a->value_ctr.num_values);	\
-		return WERR_INVALID_PARAM; \
-	} \
-	if (strict && !_a->value_ctr.values[0].blob) { \
-		d_printf("%s: %s data == NULL\n", __location__, attr); \
-		return WERR_INVALID_PARAM; \
-	} \
-	if (strict && _a->value_ctr.values[0].blob->length != 4) { \
-		d_printf("%s: %s length == %u\n", __location__, attr, \
-			 (unsigned int)_a->value_ctr.values[0].blob->length); \
-		return WERR_INVALID_PARAM; \
-	} \
-	if (_a && _a->value_ctr.num_values >= 1 \
-	    && _a->value_ctr.values[0].blob \
-	    && _a->value_ctr.values[0].blob->length == 4) { \
-		(p)->elem = (IVAL(_a->value_ctr.values[0].blob->data,0)?true:false);\
-	} else { \
-		(p)->elem = false; \
-	} \
-} while (0)
-
-#define GET_UINT32_DS(s, r, attr, p, elem, def_val) do { \
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	if (_a && _a->value_ctr.num_values >= 1 \
-	    && _a->value_ctr.values[0].blob \
-	    && _a->value_ctr.values[0].blob->length == 4) { \
-		(p)->elem = IVAL(_a->value_ctr.values[0].blob->data,0);\
-	} else { \
-		(p)->elem = def_val; \
-	} \
-} while (0)
-
-#define GET_UINT32_PTR_DS(s, r, attr, p, elem) do { \
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	if (_a && _a->value_ctr.num_values >= 1 \
-	    && _a->value_ctr.values[0].blob \
-	    && _a->value_ctr.values[0].blob->length == 4) { \
-		(p)->elem = talloc(mem_ctx, uint32_t); \
-		if (!(p)->elem) { \
-			d_printf("%s: talloc failed for %s\n", __location__, attr); \
-			return WERR_NOMEM; \
-		} \
-		*(p)->elem = IVAL(_a->value_ctr.values[0].blob->data,0);\
-	} else { \
-		(p)->elem = NULL; \
-	} \
-} while (0)
-
-#define GET_GUID_DS(s, r, attr, mem_ctx, p, elem) do { \
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	if (_a && _a->value_ctr.num_values >= 1 \
-	    && _a->value_ctr.values[0].blob \
-	    && _a->value_ctr.values[0].blob->length == 16) { \
-		NTSTATUS _nt_status = GUID_from_ndr_blob(_a->value_ctr.values[0].blob, &(p)->elem); \
-		if (!NT_STATUS_IS_OK(_nt_status)) { \
-			return ntstatus_to_werror(_nt_status); \
-		} \
-	} else { \
-		ZERO_STRUCT((p)->elem);\
-	} \
-} while (0)
-
-#define GET_BLOB_DS(s, r, attr, mem_ctx, p, elem) do { \
-	struct drsuapi_DsReplicaAttribute *_a; \
-	_a = dsdb_find_object_attr_name(s, r, attr, NULL); \
-	if (_a && _a->value_ctr.num_values >= 1 \
-	    && _a->value_ctr.values[0].blob) { \
-		(p)->elem = *_a->value_ctr.values[0].blob;\
-		talloc_steal(mem_ctx, (p)->elem.data); \
-	} else { \
-		ZERO_STRUCT((p)->elem);\
-	}\
-} while (0)
-
-WERROR dsdb_attribute_from_drsuapi(struct ldb_context *ldb,
-				   struct dsdb_schema *schema,
-				   struct drsuapi_DsReplicaObject *r,
-				   TALLOC_CTX *mem_ctx,
-				   struct dsdb_attribute *attr)
-{
-	WERROR status;
-
-	GET_STRING_DS(schema, r, "name", mem_ctx, attr, cn, true);
-	GET_STRING_DS(schema, r, "lDAPDisplayName", mem_ctx, attr, lDAPDisplayName, true);
-	GET_UINT32_DS(schema, r, "attributeID", attr, attributeID_id, 0xFFFFFFFF);
-	status = dsdb_schema_pfm_oid_from_attid(schema->prefixmap, attr->attributeID_id,
-						mem_ctx, &attr->attributeID_oid);
-	if (!W_ERROR_IS_OK(status)) {
-		DEBUG(0,("%s: '%s': unable to map attributeID 0x%08X: %s\n",
-			__location__, attr->lDAPDisplayName, attr->attributeID_id,
-			win_errstr(status)));
-		return status;
-	}
-	/* fetch msDS-IntId to be used in resolving ATTRTYP values */
-	GET_UINT32_DS(schema, r, "msDS-IntId", attr, msDS_IntId, 0);
-
-	GET_GUID_DS(schema, r, "schemaIDGUID", mem_ctx, attr, schemaIDGUID);
-	GET_UINT32_DS(schema, r, "mAPIID", attr, mAPIID, 0);
-
-	GET_GUID_DS(schema, r, "attributeSecurityGUID", mem_ctx, attr, attributeSecurityGUID);
-
-	attr->objectGUID = r->identifier->guid;
-
-	GET_UINT32_DS(schema, r, "searchFlags", attr, searchFlags, 0);
-	GET_UINT32_DS(schema, r, "systemFlags", attr, systemFlags, 0);
-	GET_BOOL_DS(schema, r, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false);
-	GET_UINT32_DS(schema, r, "linkID", attr, linkID, 0);
-
-	GET_UINT32_DS(schema, r, "attributeSyntax", attr, attributeSyntax_id, 0xFFFFFFFF);
-	status = dsdb_schema_pfm_oid_from_attid(schema->prefixmap, attr->attributeSyntax_id,
-						mem_ctx, &attr->attributeSyntax_oid);
-	if (!W_ERROR_IS_OK(status)) {
-		DEBUG(0,("%s: '%s': unable to map attributeSyntax 0x%08X: %s\n",
-			__location__, attr->lDAPDisplayName, attr->attributeSyntax_id,
-			win_errstr(status)));
-		return status;
-	}
-	GET_UINT32_DS(schema, r, "oMSyntax", attr, oMSyntax, 0);
-	GET_BLOB_DS(schema, r, "oMObjectClass", mem_ctx, attr, oMObjectClass);
-
-	GET_BOOL_DS(schema, r, "isSingleValued", attr, isSingleValued, true);
-	GET_UINT32_PTR_DS(schema, r, "rangeLower", attr, rangeLower);
-	GET_UINT32_PTR_DS(schema, r, "rangeUpper", attr, rangeUpper);
-	GET_BOOL_DS(schema, r, "extendedCharsAllowed", attr, extendedCharsAllowed, false);
-
-	GET_UINT32_DS(schema, r, "schemaFlagsEx", attr, schemaFlagsEx, 0);
-	GET_BLOB_DS(schema, r, "msDs-Schema-Extensions", mem_ctx, attr, msDs_Schema_Extensions);
-
-	GET_BOOL_DS(schema, r, "showInAdvancedViewOnly", attr, showInAdvancedViewOnly, false);
-	GET_STRING_DS(schema, r, "adminDisplayName", mem_ctx, attr, adminDisplayName, false);
-	GET_STRING_DS(schema, r, "adminDescription", mem_ctx, attr, adminDescription, false);
-	GET_STRING_DS(schema, r, "classDisplayName", mem_ctx, attr, classDisplayName, false);
-	GET_BOOL_DS(schema, r, "isEphemeral", attr, isEphemeral, false);
-	GET_BOOL_DS(schema, r, "isDefunct", attr, isDefunct, false);
-	GET_BOOL_DS(schema, r, "systemOnly", attr, systemOnly, false);
-
-	attr->syntax = dsdb_syntax_for_attribute(attr);
-	if (!attr->syntax) {
-		DEBUG(0,(__location__ ": Unknown schema syntax for %s\n",
-			 attr->lDAPDisplayName));
-		return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
-	}
-
-	if (dsdb_schema_setup_ldb_schema_attribute(ldb, attr) != LDB_SUCCESS) {
-		DEBUG(0,(__location__ ": Unknown schema syntax for %s\n",
-			 attr->lDAPDisplayName));
-		return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
-	}
-
-	return WERR_OK;
-}
-
-WERROR dsdb_class_from_drsuapi(struct ldb_context *ldb, 
-			       struct dsdb_schema *schema,
-			       struct drsuapi_DsReplicaObject *r,
-			       TALLOC_CTX *mem_ctx,
-			       struct dsdb_class *obj)
-{
-	WERROR status;
-	struct drsuapi_DsReplicaAttribute *attr;
-	DATA_BLOB blob;
-
-	GET_STRING_DS(schema, r, "name", mem_ctx, obj, cn, true);
-	GET_STRING_DS(schema, r, "lDAPDisplayName", mem_ctx, obj, lDAPDisplayName, true);
-	GET_UINT32_DS(schema, r, "governsID", obj, governsID_id, 0xFFFFFFFF);
-	status = dsdb_schema_pfm_oid_from_attid(schema->prefixmap, obj->governsID_id,
-						mem_ctx, &obj->governsID_oid);
-	if (!W_ERROR_IS_OK(status)) {
-		DEBUG(0,("%s: '%s': unable to map governsID 0x%08X: %s\n",
-			__location__, obj->lDAPDisplayName, obj->governsID_id,
-			win_errstr(status)));
-		return status;
-	}
-	GET_GUID_DS(schema, r, "schemaIDGUID", mem_ctx, obj, schemaIDGUID);
-
-	obj->objectGUID = r->identifier->guid;
-
-	GET_UINT32_DS(schema, r, "objectClassCategory", obj, objectClassCategory, 0);
-	GET_STRING_DS(schema, r, "rDNAttID", mem_ctx, obj, rDNAttID, false);
-
-	attr = dsdb_find_object_attr_name(schema, r, "defaultObjectCategory", NULL); 
-
-	if (!attr || attr->value_ctr.num_values != 1 || !attr->value_ctr.values[0].blob) { 
-		d_printf("%s: no defaultObjectCategory supplied\n", __location__); 
-		return WERR_INVALID_PARAM; 
-	}
-
-	status = dsdb_syntax_one_DN_drsuapi_to_ldb(mem_ctx, ldb, find_syntax_map_by_standard_oid(LDB_SYNTAX_DN), 
-						   attr->value_ctr.values[0].blob, &blob);
-	if (!W_ERROR_IS_OK(status)) {
-		return status;
-	}
-	obj->defaultObjectCategory = (char *)blob.data;
-
-	GET_UINT32_DS(schema, r, "subClassOf", obj, subClassOf_id, 0);
-
-	GET_UINT32_LIST_DS(schema, r, "systemAuxiliaryClass", mem_ctx, obj, systemAuxiliaryClass_ids);
-	GET_UINT32_LIST_DS(schema, r, "auxiliaryClass", mem_ctx, obj, auxiliaryClass_ids);
-
-	GET_UINT32_LIST_DS(schema, r, "systemMustContain", mem_ctx, obj, systemMustContain_ids);
-	GET_UINT32_LIST_DS(schema, r, "systemMayContain", mem_ctx, obj, systemMayContain_ids);
-	GET_UINT32_LIST_DS(schema, r, "mustContain", mem_ctx, obj, mustContain_ids);
-	GET_UINT32_LIST_DS(schema, r, "mayContain", mem_ctx, obj, mayContain_ids);
-
-	GET_UINT32_LIST_DS(schema, r, "systemPossSuperiors", mem_ctx, obj, systemPossSuperiors_ids);
-	GET_UINT32_LIST_DS(schema, r, "possSuperiors", mem_ctx, obj, possSuperiors_ids);
-
-	GET_STRING_DS(schema, r, "defaultSecurityDescriptor", mem_ctx, obj, defaultSecurityDescriptor, false);
-
-	GET_UINT32_DS(schema, r, "schemaFlagsEx", obj, schemaFlagsEx, 0);
-	GET_BLOB_DS(schema, r, "msDs-Schema-Extensions", mem_ctx, obj, msDs_Schema_Extensions);
-
-	GET_BOOL_DS(schema, r, "showInAdvancedViewOnly", obj, showInAdvancedViewOnly, false);
-	GET_STRING_DS(schema, r, "adminDisplayName", mem_ctx, obj, adminDisplayName, false);
-	GET_STRING_DS(schema, r, "adminDescription", mem_ctx, obj, adminDescription, false);
-	GET_STRING_DS(schema, r, "classDisplayName", mem_ctx, obj, classDisplayName, false);
-	GET_BOOL_DS(schema, r, "defaultHidingValue", obj, defaultHidingValue, false);
-	GET_BOOL_DS(schema, r, "isDefunct", obj, isDefunct, false);
-	GET_BOOL_DS(schema, r, "systemOnly", obj, systemOnly, false);
-
-	return WERR_OK;
-}
-
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 51c1b29..193d62d 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -1211,6 +1211,8 @@ static WERROR dsdb_syntax_OID_drsuapi_to_ldb(struct ldb_context *ldb,
 					     TALLOC_CTX *mem_ctx,
 					     struct ldb_message_element *out)
 {
+	WERROR werr;
+
 	switch (attr->attributeID_id) {
 	case DRSUAPI_ATTRIBUTE_objectClass:
 	case DRSUAPI_ATTRIBUTE_subClassOf:
@@ -1218,23 +1220,35 @@ static WERROR dsdb_syntax_OID_drsuapi_to_ldb(struct ldb_context *ldb,
 	case DRSUAPI_ATTRIBUTE_systemAuxiliaryClass:
 	case DRSUAPI_ATTRIBUTE_systemPossSuperiors:
 	case DRSUAPI_ATTRIBUTE_possSuperiors:
-		return _dsdb_syntax_OID_obj_drsuapi_to_ldb(ldb, schema, attr, in, mem_ctx, out);
+		werr = _dsdb_syntax_OID_obj_drsuapi_to_ldb(ldb, schema, attr, in, mem_ctx, out);
+		break;
 	case DRSUAPI_ATTRIBUTE_systemMustContain:
 	case DRSUAPI_ATTRIBUTE_systemMayContain:	
 	case DRSUAPI_ATTRIBUTE_mustContain:
 	case DRSUAPI_ATTRIBUTE_rDNAttId:
 	case DRSUAPI_ATTRIBUTE_transportAddressAttribute:
 	case DRSUAPI_ATTRIBUTE_mayContain:
-		return _dsdb_syntax_OID_attr_drsuapi_to_ldb(ldb, schema, attr, in, mem_ctx, out);
+		werr = _dsdb_syntax_OID_attr_drsuapi_to_ldb(ldb, schema, attr, in, mem_ctx, out);
+		break;
 	case DRSUAPI_ATTRIBUTE_governsID:
 	case DRSUAPI_ATTRIBUTE_attributeID:
 	case DRSUAPI_ATTRIBUTE_attributeSyntax:
+		werr = _dsdb_syntax_OID_oid_drsuapi_to_ldb(ldb, schema, attr, in, mem_ctx, out);
+		break;
+	default:
+		DEBUG(0,(__location__ ": Unknown handling for attributeID_id for %s\n",
+			 attr->lDAPDisplayName));
+		return _dsdb_syntax_auto_OID_drsuapi_to_ldb(ldb, schema, attr, in, mem_ctx, out);
+	}
+
+	/* When we are doing the vampire of a schema, we don't want
+	 * the inablity to reference an OID to get in the way.
+	 * Otherwise, we won't get the new schema with which to
+	 * understand this */
+	if (!W_ERROR_IS_OK(werr) && schema->relax_OID_conversions) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list