1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

tdb_compat: use tdb_firstkey_compat/tdb_nextkey_compat everywhere.

Note that tdb_nextkey_compat frees the old key for us.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2011-06-20 18:40:32 +09:30
parent 2c71e8596b
commit 3a8faefd66
3 changed files with 12 additions and 12 deletions

View File

@ -532,7 +532,7 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *pipe_hnd)
{
const char *backup_suffix = ".bak";
TDB_DATA kbuf, newkey, dbuf;
TDB_DATA kbuf, dbuf;
TDB_CONTEXT *tdb;
NTSTATUS status;
int rc;
@ -549,9 +549,9 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_SUCH_FILE;
}
for (kbuf = tdb_firstkey(tdb);
for (kbuf = tdb_firstkey_compat(tdb);
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey)
kbuf = tdb_nextkey_compat(tdb, kbuf))
{
dbuf = tdb_fetch_compat(tdb, kbuf);
if (!dbuf.dptr) {

View File

@ -88,12 +88,12 @@ static TDB_DATA make_printers_secdesc_tdbkey(TALLOC_CTX *ctx,
static bool upgrade_to_version_3(void)
{
TDB_DATA kbuf, newkey, dbuf;
TDB_DATA kbuf, dbuf;
DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n"));
for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr;
newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
for (kbuf = tdb_firstkey_compat(tdb_drivers); kbuf.dptr;
kbuf = tdb_nextkey_compat(tdb_drivers, kbuf)) {
dbuf = tdb_fetch_compat(tdb_drivers, kbuf);

View File

@ -162,7 +162,7 @@ static int net_printing_dump(struct net_context *c, int argc,
int ret = -1;
TALLOC_CTX *ctx = talloc_stackframe();
TDB_CONTEXT *tdb;
TDB_DATA kbuf, newkey, dbuf;
TDB_DATA kbuf, dbuf;
if (argc < 1 || c->display_usage) {
d_fprintf(stderr, "%s\nnet printing dump <file.tdb>\n",
@ -176,9 +176,9 @@ static int net_printing_dump(struct net_context *c, int argc,
goto done;
}
for (kbuf = tdb_firstkey(tdb);
for (kbuf = tdb_firstkey_compat(tdb);
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf=newkey)
kbuf = tdb_nextkey_compat(tdb, kbuf))
{
dbuf = tdb_fetch_compat(tdb, kbuf);
if (!dbuf.dptr) {
@ -637,7 +637,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
{
TALLOC_CTX *tmp_ctx;
TDB_CONTEXT *tdb;
TDB_DATA kbuf, newkey, dbuf;
TDB_DATA kbuf, dbuf;
NTSTATUS status;
tmp_ctx = talloc_new(mem_ctx);
@ -652,9 +652,9 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
goto done;
}
for (kbuf = tdb_firstkey(tdb);
for (kbuf = tdb_firstkey_compat(tdb);
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey)
kbuf = tdb_nextkey_compat(tdb, kbuf))
{
dbuf = tdb_fetch_compat(tdb, kbuf);
if (!dbuf.dptr) {