Registry server LDB backend REG_BINARY type: Save it directly in LDB
[kai/samba.git] / source4 / lib / registry / ldb.c
index 53ec076db3f8eb69133f6f26dd63041f65a5fac7..6c7c448b3d4213a6538a7081419ef7af74855299 100644 (file)
@@ -72,7 +72,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
 
        case REG_BINARY:
                if (val != NULL)
-                       *data = strhex_to_data_blob((char *)val->data);
+                       *data = data_blob_talloc(mem_ctx, val->data, val->length);
                else {
                        data->data = NULL;
                        data->length = 0;
@@ -117,8 +117,10 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
                break;
 
        case REG_BINARY:
-               ldb_msg_add_string(msg, "data",
-                                  data_blob_hex_string(mem_ctx, &data));
+               if (data.length > 0)
+                       ldb_msg_add_value(msg, "data", &data, NULL);
+               else
+                       ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
                break;
 
        case REG_DWORD: