This follows the same pattern as the tstore command, and it allows
specifying key strings with a trailing \0 character.
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jul 6 23:23:22 CEST 2015 on sn-devel-104
(Imported from commit
cdbc6d92c6bf0645c5a23955e8ec5e253212e86d)
return -1;
}
- key.dptr = discard_const(argv[1]);
- key.dsize = strlen(argv[1]);
+ if (!strncmp(argv[1], "0x", 2)) {
+ key = hextodata(tmp_ctx, argv[1] + 2);
+ if (key.dsize == 0) {
+ printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
+ return -1;
+ }
+ } else {
+ key.dptr = discard_const(argv[1]);
+ key.dsize = strlen(argv[1]);
+ }
+
ret = ctdb_transaction_store(h, key, data);
if (ret != 0) {
DEBUG(DEBUG_ERR,("Failed to store record\n"));