r17707: Match the output (aside from dividers) the output of
authorAndrew Bartlett <abartlet@samba.org>
Tue, 22 Aug 2006 10:49:54 +0000 (10:49 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:16:28 +0000 (14:16 -0500)
ol-schema-migrate.pl in the schema output.

Andrew Bartlett
(This used to be commit 8f624fd17503e85afe74a3e1915e30f28d19853b)

source4/lib/ldb/tools/ad2oLschema.c

index ceff7aef6facb567f36f8807ccc29d473edf1ade..9ea63b06f86fe89e0e0b53fa46071a348c449cba 100644 (file)
@@ -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;