r20477: get rid of the spcial case for unicode strings
authorStefan Metzmacher <metze@samba.org>
Tue, 2 Jan 2007 14:53:45 +0000 (14:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:35:57 +0000 (14:35 -0500)
metze

source/dsdb/schema/schema_init.c
source/dsdb/schema/schema_syntax.c
source/librpc/idl/drsuapi.idl

index 41998a16db42c1b135182b855b1a820e6dcf16f1..6de87708c7f970d80c573468a7d88dd642e5ea57 100644 (file)
@@ -427,18 +427,34 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
                d_printf("%s: %s == NULL\n", __location__, attr); \
                return WERR_INVALID_PARAM; \
        } \
-       if (strict && _a->value_ctr.unicode_string.num_values != 1) { \
+       if (strict && _a->value_ctr.data_blob.num_values != 1) { \
                d_printf("%s: %s num_values == %u\n", __location__, attr, \
-                       _a->value_ctr.unicode_string.num_values); \
+                       _a->value_ctr.data_blob.num_values); \
                return WERR_INVALID_PARAM; \
        } \
-       if (_a && _a->value_ctr.unicode_string.num_values >= 1) { \
-               (p)->elem = talloc_steal(mem_ctx, _a->value_ctr.unicode_string.values[0].string);\
+       if (_a && _a->value_ctr.data_blob.num_values >= 1) { \
+               ssize_t _ret; \
+               _ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, \
+                                            _a->value_ctr.data_blob.values[0].data->data, \
+                                            _a->value_ctr.data_blob.values[0].data->length, \
+                                            (void **)discard_const(&(p)->elem)); \
+               if (_ret == -1) { \
+                       DEBUG(0,("%s: invalid data!\n", attr)); \
+                       dump_data(0, \
+                                    _a->value_ctr.data_blob.values[0].data->data, \
+                                    _a->value_ctr.data_blob.values[0].data->length); \
+                       return WERR_FOOBAR; \
+               } \
        } else { \
                (p)->elem = NULL; \
        } \
 } while (0)
 
+#define GET_DN_DS(s, r, attr, mem_ctx, p, elem, strict) do { \
+       /* TODO: ! */ \
+       (p)->elem = NULL; \
+} 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); \
@@ -594,8 +610,8 @@ WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema,
 
        GET_UINT32_DS(schema, r, "objectClassCategory", obj, objectClassCategory);
        GET_STRING_DS(schema, r, "rDNAttID", mem_ctx, obj, rDNAttID, False);
-       GET_STRING_DS(schema, r, "defaultObjectCategory", mem_ctx, obj, defaultObjectCategory, True);
+       GET_DN_DS(schema, r, "defaultObjectCategory", mem_ctx, obj, defaultObjectCategory, True);
+
        GET_STRING_DS(schema, r, "subClassOf", mem_ctx, obj, subClassOf, True);
 
        obj->systemAuxiliaryClass       = NULL;
index 8a2747bd9d4e70f8c3cdf9b5802fc2f18d682fe4..5a96f11d6b7bead8c8e7d91e5637a82b92adfddf 100644 (file)
@@ -747,17 +747,6 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(const struct dsdb_schema *schem
 {
        uint32_t i;
 
-switch (attr->attributeID_id) {
-case DRSUAPI_ATTRIBUTE_description:
-case DRSUAPI_ATTRIBUTE_adminDisplayName:
-case DRSUAPI_ATTRIBUTE_adminDescription:
-case DRSUAPI_ATTRIBUTE_lDAPDisplayName:
-case DRSUAPI_ATTRIBUTE_name:
-case DRSUAPI_ATTRIBUTE_sAMAccountName:
-case DRSUAPI_ATTRIBUTE_gPLink:
-       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);
index 624835121f9d49b378434da0ce92ae1907a60142..79f6e6928a52b32bbbd728a01dd4ba2e3a398fe3 100644 (file)
@@ -519,15 +519,6 @@ interface drsuapi
        } drsuapi_DsAttributeValueCtrGUID;
 
        typedef [nodiscriminant] union {
-               /* UnicodeString */
-               [case(DRSUAPI_ATTRIBUTE_description)]           drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-               [case(DRSUAPI_ATTRIBUTE_adminDisplayName)]      drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-               [case(DRSUAPI_ATTRIBUTE_adminDescription)]      drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-               [case(DRSUAPI_ATTRIBUTE_lDAPDisplayName)]       drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-               [case(DRSUAPI_ATTRIBUTE_name)]                  drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-               [case(DRSUAPI_ATTRIBUTE_sAMAccountName)]        drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-               [case(DRSUAPI_ATTRIBUTE_gPLink)]                drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
-
                /* DN String */
                [case(DRSUAPI_ATTRIBUTE_member)]                drsuapi_DsAttributeValueCtrDNString dn_string;
                [case(DRSUAPI_ATTRIBUTE_objectCategory)]        drsuapi_DsAttributeValueCtrDNString dn_string;