2 * Unix SMB/CIFS implementation.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "source3/include/includes.h"
20 #include "source3/torture/proto.h"
21 #include "source3/lib/tdb_validate.h"
23 static int validate_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA value,
26 struct tdb_validation_status *state = private_data;
27 state->success = false;
28 printf("validate_fn called\n");
32 bool run_tdb_validate(int dummy)
34 const char tdb_name[] = "tdb_validate.tdb";
36 struct tdb_context *tdb = NULL;
38 TDB_DATA data = { .dptr = (uint8_t *)buf, .dsize = sizeof(buf), };
43 tdb = tdb_open(tdb_name, 0, 0, O_CREAT|O_EXCL|O_RDWR, 0600);
45 perror("Could not open tdb");
49 ret = tdb_store(tdb, data, data, 0);
51 perror("tdb_store failed");
55 ret = tdb_validate(tdb, validate_fn);
58 "tdb_validate succeeded where it should have "