Print unconvertable ldb element values as base64.
[kai/samba.git] / source4 / lib / ldb / common / ldb_ldif.c
index 538ff8feaabb2ecffd46a7579dd85585905788d3..69490e670bf98be466d2061f098e08534c3a6b92 100644 (file)
@@ -328,8 +328,10 @@ int ldb_ldif_write(struct ldb_context *ldb,
                for (j=0;j<msg->elements[i].num_values;j++) {
                        struct ldb_val v;
                        ret = a->syntax->ldif_write_fn(ldb, mem_ctx, &msg->elements[i].values[j], &v);
-                       CHECK_RET;
-                       if (ldb_should_b64_encode(&v)) {
+                       if (ret != LDB_SUCCESS) {
+                               v = msg->elements[i].values[j];
+                       }
+                       if (ret != LDB_SUCCESS || ldb_should_b64_encode(&v)) {
                                ret = fprintf_fn(private_data, "%s:: ", 
                                                 msg->elements[i].name);
                                CHECK_RET;