if (state.scanned) {
result = state.found;
} else {
+ res = db->transaction_start(db);
+ if (res != 0) {
+ DEBUG(0, ("error starting transacion\n"));
+ goto fail;
+ }
+
if (!create_sorted_subkeys(path, key)) {
+ res = db->transaction_cancel(db);
+ if (res != 0) {
+ smb_panic("Failed to cancel transaction.");
+ }
goto fail;
}
+
res = db->parse_record(db, string_term_tdb_data(key),
parent_subkey_scanner, &state);
if ((res == 0) && (state.scanned)) {
result = state.found;
}
+
+ res = db->transaction_commit(db);
+ if (res != 0) {
+ DEBUG(0, ("error committing transaction\n"));
+ result = false;
+ }
}
fail:
value = regdb_fetch_key_internal(db, frame, key);
- if (value.dptr == NULL) {
+ if (value.dsize == 0 || value.dptr == NULL) {
DEBUG(10, ("regdb_fetch_keys: no subkeys found for key [%s]\n",
key));
goto done;
buf = value.dptr;
buflen = value.dsize;
len = tdb_unpack( buf, buflen, "d", &num_items);
+ if (len == (uint32_t)-1) {
+ werr = WERR_NOT_FOUND;
+ goto done;
+ }
werr = regsubkey_ctr_reinit(ctr);
W_ERROR_NOT_OK_GOTO_DONE(werr);