/** * Add an element to the schema (attribute or class) from an LDB message */ WERROR dsdb_schema_set_el_from_ldb_msg(struct ldb_context *ldb, struct dsdb_schema *schema, struct ldb_message *msg) { if (samdb_find_attribute(ldb, msg, "objectclass", "attributeSchema") != NULL) { return dsdb_set_attribute_from_ldb(ldb, schema, msg); } else if (samdb_find_attribute(ldb, msg, "objectclass", "classSchema") != NULL) { return dsdb_set_class_from_ldb(schema, msg); } /* Don't fail on things not classes or attributes */ return WERR_OK; }
static bool torture_syntax_add_OR_Name(struct torture_context *tctx, struct ldb_context *ldb, struct dsdb_schema *schema) { WERROR werr; int ldb_res; struct ldb_ldif *ldif; const char *ldif_str = "dn: CN=ms-Exch-Auth-Orig,CN=Schema,CN=Configuration,DC=kma-exch,DC=devel\n" "changetype: add\n" "cn: ms-Exch-Auth-Orig\n" "attributeID: 1.2.840.113556.1.2.129\n" "attributeSyntax: 2.5.5.7\n" "isSingleValued: FALSE\n" "linkID: 110\n" "showInAdvancedViewOnly: TRUE\n" "adminDisplayName: ms-Exch-Auth-Orig\n" "oMObjectClass:: VgYBAgULHQ==\n" "adminDescription: ms-Exch-Auth-Orig\n" "oMSyntax: 127\n" "searchFlags: 16\n" "lDAPDisplayName: authOrig\n" "name: ms-Exch-Auth-Orig\n" "objectGUID:: 7tqEWktjAUqsZXqsFPQpRg==\n" "schemaIDGUID:: l3PfqOrF0RG7ywCAx2ZwwA==\n" "attributeSecurityGUID:: VAGN5Pi80RGHAgDAT7lgUA==\n" "isMemberOfPartialAttributeSet: TRUE\n"; ldif = ldb_ldif_read_string(ldb, &ldif_str); torture_assert(tctx, ldif, "Failed to parse LDIF for authOrig"); werr = dsdb_set_attribute_from_ldb(ldb, schema, ldif->msg); ldb_ldif_read_free(ldb, ldif); torture_assert_werr_ok(tctx, werr, "dsdb_set_attribute_from_ldb() failed!"); ldb_res = dsdb_set_schema(ldb, schema); torture_assert_int_equal(tctx, ldb_res, LDB_SUCCESS, "dsdb_set_schema() failed"); return true; };