From b2658f0dd6975758d7a3496e661c2e04f19bf36f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 22 Aug 2006 10:49:54 +0000 Subject: r17707: Match the output (aside from dividers) the output of ol-schema-migrate.pl in the schema output. Andrew Bartlett (This used to be commit 8f624fd17503e85afe74a3e1915e30f28d19853b) --- source4/lib/ldb/tools/ad2oLschema.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'source4') diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c index ceff7aef6f..9ea63b06f8 100644 --- a/source4/lib/ldb/tools/ad2oLschema.c +++ b/source4/lib/ldb/tools/ad2oLschema.c @@ -312,6 +312,14 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ return ret; } + switch (target) { + case TARGET_OPENLDAP: + break; + case TARGET_FEDORA_DS: + fprintf(out, "dn: cn=schema\n"); + break; + } + for (i=0; i < attrs_res->count; i++) { struct ldb_message *msg = attrs_res->msgs[i]; @@ -396,9 +404,16 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ } schema_entry = talloc_asprintf_append(schema_entry, - " )\n\n"); + " )"); - fprintf(out, "%s", schema_entry); + switch (target) { + case TARGET_OPENLDAP: + fprintf(out, "%s\n\n", schema_entry); + break; + case TARGET_FEDORA_DS: + fprintf(out, "%s\n", schema_entry); + break; + } } ldb_ret = fetch_objectclass_schema(ldb, schemadn, mem_ctx, &objectclasses_res); @@ -502,7 +517,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ schema_entry = talloc_asprintf_append(schema_entry, \ " $"); \ IF_NULL_FAIL_RET(schema_entry); \ - if ((k+1)%5 == 0) { \ + if (target == TARGET_OPENLDAP && ((k+1)%5 == 0)) { \ schema_entry = talloc_asprintf_append(schema_entry, \ "\n "); \ IF_NULL_FAIL_RET(schema_entry); \ @@ -524,7 +539,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ APPEND_ATTRS(sys_must); schema_entry = talloc_asprintf_append(schema_entry, - ")\n"); + " )\n"); IF_NULL_FAIL_RET(schema_entry); } @@ -546,9 +561,16 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ } schema_entry = talloc_asprintf_append(schema_entry, - " )\n\n"); + " )"); - fprintf(out, "%s", schema_entry); + switch (target) { + case TARGET_OPENLDAP: + fprintf(out, "%s\n\n", schema_entry); + break; + case TARGET_FEDORA_DS: + fprintf(out, "%s\n", schema_entry); + break; + } } return ret; -- cgit