diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-01-02 14:14:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:35:57 -0500 |
commit | d70852659b4dbef9979be81f5d42e5587fc94c75 (patch) | |
tree | a82fe150a154c5aa09ade33a9ba2e0a02954dfaf | |
parent | 2754a73d221d13095a4228fede25ffc64134beb5 (diff) | |
download | samba-d70852659b4dbef9979be81f5d42e5587fc94c75.tar.gz samba-d70852659b4dbef9979be81f5d42e5587fc94c75.tar.xz samba-d70852659b4dbef9979be81f5d42e5587fc94c75.zip |
r20476: get rid of extra case for uint32 values
metze
(This used to be commit 13ccd405b5dbb595e5ab67879260462e5a767a8b)
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 7 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 28 | ||||
-rw-r--r-- | source4/libnet/libnet_become_dc.c | 63 | ||||
-rw-r--r-- | source4/librpc/idl/drsuapi.idl | 15 |
4 files changed, 52 insertions, 61 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 23b5fd9dcc..41998a16db 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -472,9 +472,10 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb #define GET_UINT32_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.uint32.num_values >= 1 \ - && _a->value_ctr.uint32.values[0].value) { \ - (p)->elem = *_a->value_ctr.uint32.values[0].value;\ + if (_a && _a->value_ctr.data_blob.num_values >= 1 \ + && _a->value_ctr.data_blob.values[0].data \ + && _a->value_ctr.data_blob.values[0].data->length == 4) { \ + (p)->elem = IVAL(_a->value_ctr.data_blob.values[0].data->data,0);\ } else { \ (p)->elem = 0; \ } \ diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index f31dfbda2b..8a2747bd9d 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -162,18 +162,6 @@ static WERROR dsdb_syntax_INT32_drsuapi_to_ldb(const struct dsdb_schema *schema, { uint32_t i; -switch (attr->attributeID_id) { -case DRSUAPI_ATTRIBUTE_instanceType: -case DRSUAPI_ATTRIBUTE_rangeLower: -case DRSUAPI_ATTRIBUTE_rangeUpper: -case DRSUAPI_ATTRIBUTE_objectVersion: -case DRSUAPI_ATTRIBUTE_oMSyntax: -case DRSUAPI_ATTRIBUTE_searchFlags: -case DRSUAPI_ATTRIBUTE_systemFlags: -case DRSUAPI_ATTRIBUTE_msDS_Behavior_Version: - return dsdb_syntax_FOOBAR_drsuapi_to_ldb(schema,attr, in, mem_ctx, out); -} - out->flags = 0; out->name = talloc_strdup(mem_ctx, attr->lDAPDisplayName); W_ERROR_HAVE_NO_MEMORY(out->name); @@ -585,11 +573,15 @@ static WERROR _dsdb_syntax_OID_obj_drsuapi_to_ldb(const struct dsdb_schema *sche const struct dsdb_class *c; const char *str; - if (in->value_ctr.object_class_id.values[i].objectClassId == NULL) { + if (in->value_ctr.data_blob.values[i].data == NULL) { + return WERR_FOOBAR; + } + + if (in->value_ctr.data_blob.values[i].data->length != 4) { return WERR_FOOBAR; } - v = *in->value_ctr.object_class_id.values[i].objectClassId; + v = IVAL(in->value_ctr.data_blob.values[i].data->data, 0); c = dsdb_class_by_governsID_id(schema, v); if (!c) { @@ -627,11 +619,15 @@ static WERROR _dsdb_syntax_OID_oid_drsuapi_to_ldb(const struct dsdb_schema *sche WERROR status; const char *str; - if (in->value_ctr.oid.values[i].value == NULL) { + if (in->value_ctr.data_blob.values[i].data == NULL) { + return WERR_FOOBAR; + } + + if (in->value_ctr.data_blob.values[i].data->length != 4) { return WERR_FOOBAR; } - v = *in->value_ctr.oid.values[i].value; + v = IVAL(in->value_ctr.data_blob.values[i].data->data, 0); status = dsdb_map_int2oid(schema, v, out->values, &str); W_ERROR_NOT_OK_RETURN(status); diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index 30fc1774d5..954b886b12 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -1128,23 +1128,26 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) /* objectClass: nTDSDSA */ { - struct drsuapi_DsAttributeValueObjectClassId *vs; - enum drsuapi_DsObjectClassId *v; + struct drsuapi_DsAttributeValueDataBlob *vs; + DATA_BLOB *vd; - vs = talloc_array(attrs, struct drsuapi_DsAttributeValueObjectClassId, 1); + vs = talloc_array(attrs, struct drsuapi_DsAttributeValueDataBlob, 1); if (composite_nomem(vs, c)) return; - v = talloc_array(vs, enum drsuapi_DsObjectClassId, 1); - if (composite_nomem(v, c)) return; + vd = talloc_array(vs, DATA_BLOB, 1); + if (composite_nomem(vd, c)) return; + + vd[0] = data_blob_talloc(vd, NULL, 4); + if (composite_nomem(vd[0].data, c)) return; /* value for nTDSDSA */ - v[0] = 0x0017002F; + SIVAL(vd[0].data, 0, 0x0017002F); - vs[0].objectClassId = &v[0]; + vs[0].data = &vd[0]; attrs[i].attid = DRSUAPI_ATTRIBUTE_objectClass; - attrs[i].value_ctr.object_class_id.num_values = 1; - attrs[i].value_ctr.object_class_id.values = vs; + attrs[i].value_ctr.data_blob.num_values = 1; + attrs[i].value_ctr.data_blob.values = vs; i++; } @@ -1319,44 +1322,50 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) /* msDS-Behavior-Version */ if (w2k3) { - struct drsuapi_DsAttributeValueUINT32 *vs; - uint32_t *v; + struct drsuapi_DsAttributeValueDataBlob *vs; + DATA_BLOB *vd; - vs = talloc_array(attrs, struct drsuapi_DsAttributeValueUINT32, 1); + vs = talloc_array(attrs, struct drsuapi_DsAttributeValueDataBlob, 1); if (composite_nomem(vs, c)) return; - v = talloc_array(vs, uint32_t, 1); - if (composite_nomem(v, c)) return; + vd = talloc_array(vs, DATA_BLOB, 1); + if (composite_nomem(vd, c)) return; + + vd[0] = data_blob_talloc(vd, NULL, 4); + if (composite_nomem(vd[0].data, c)) return; - v[0] = DS_BEHAVIOR_WIN2003; + SIVAL(vd[0].data, 0, DS_BEHAVIOR_WIN2003); - vs[0].value = &v[0]; + vs[0].data = &vd[0]; attrs[i].attid = DRSUAPI_ATTRIBUTE_msDS_Behavior_Version; - attrs[i].value_ctr.uint32.num_values = 1; - attrs[i].value_ctr.uint32.values = vs; + attrs[i].value_ctr.data_blob.num_values = 1; + attrs[i].value_ctr.data_blob.values = vs; i++; } /* systemFlags */ { - struct drsuapi_DsAttributeValueUINT32 *vs; - uint32_t *v; + struct drsuapi_DsAttributeValueDataBlob *vs; + DATA_BLOB *vd; - vs = talloc_array(attrs, struct drsuapi_DsAttributeValueUINT32, 1); + vs = talloc_array(attrs, struct drsuapi_DsAttributeValueDataBlob, 1); if (composite_nomem(vs, c)) return; - v = talloc_array(vs, uint32_t, 1); - if (composite_nomem(v, c)) return; + vd = talloc_array(vs, DATA_BLOB, 1); + if (composite_nomem(vd, c)) return; - v[0] = SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE; + vd[0] = data_blob_talloc(vd, NULL, 4); + if (composite_nomem(vd[0].data, c)) return; - vs[0].value = &v[0]; + SIVAL(vd[0].data, 0, SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE); + + vs[0].data = &vd[0]; attrs[i].attid = DRSUAPI_ATTRIBUTE_systemFlags; - attrs[i].value_ctr.uint32.num_values = 1; - attrs[i].value_ctr.uint32.values = vs; + attrs[i].value_ctr.data_blob.num_values = 1; + attrs[i].value_ctr.data_blob.values = vs; i++; } diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl index dbe0e92be0..624835121f 100644 --- a/source4/librpc/idl/drsuapi.idl +++ b/source4/librpc/idl/drsuapi.idl @@ -519,21 +519,6 @@ interface drsuapi } drsuapi_DsAttributeValueCtrGUID; typedef [nodiscriminant] union { - [case(DRSUAPI_ATTRIBUTE_objectClass)] drsuapi_DsAttributeValueCtrObjectClassId object_class_id; - [case(DRSUAPI_ATTRIBUTE_governsID)] drsuapi_DsAttributeValueCtrUINT32 oid; - [case(DRSUAPI_ATTRIBUTE_attributeID)] drsuapi_DsAttributeValueCtrUINT32 oid; - [case(DRSUAPI_ATTRIBUTE_attributeSyntax)] drsuapi_DsAttributeValueCtrUINT32 oid; - - /* UINT32 */ - [case(DRSUAPI_ATTRIBUTE_instanceType)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_rangeLower)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_rangeUpper)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_objectVersion)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_oMSyntax)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_searchFlags)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_systemFlags)] drsuapi_DsAttributeValueCtrUINT32 uint32; - [case(DRSUAPI_ATTRIBUTE_msDS_Behavior_Version)] drsuapi_DsAttributeValueCtrUINT32 uint32; - /* UnicodeString */ [case(DRSUAPI_ATTRIBUTE_description)] drsuapi_DsAttributeValueCtrUnicodeString unicode_string; [case(DRSUAPI_ATTRIBUTE_adminDisplayName)] drsuapi_DsAttributeValueCtrUnicodeString unicode_string; |