mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +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:
parent
2c71e8596b
commit
3a8faefd66
@ -532,7 +532,7 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
|
|||||||
struct rpc_pipe_client *pipe_hnd)
|
struct rpc_pipe_client *pipe_hnd)
|
||||||
{
|
{
|
||||||
const char *backup_suffix = ".bak";
|
const char *backup_suffix = ".bak";
|
||||||
TDB_DATA kbuf, newkey, dbuf;
|
TDB_DATA kbuf, dbuf;
|
||||||
TDB_CONTEXT *tdb;
|
TDB_CONTEXT *tdb;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
int rc;
|
int rc;
|
||||||
@ -549,9 +549,9 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
|
|||||||
return NT_STATUS_NO_SUCH_FILE;
|
return NT_STATUS_NO_SUCH_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb);
|
for (kbuf = tdb_firstkey_compat(tdb);
|
||||||
kbuf.dptr;
|
kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey)
|
kbuf = tdb_nextkey_compat(tdb, kbuf))
|
||||||
{
|
{
|
||||||
dbuf = tdb_fetch_compat(tdb, kbuf);
|
dbuf = tdb_fetch_compat(tdb, kbuf);
|
||||||
if (!dbuf.dptr) {
|
if (!dbuf.dptr) {
|
||||||
|
@ -88,12 +88,12 @@ static TDB_DATA make_printers_secdesc_tdbkey(TALLOC_CTX *ctx,
|
|||||||
|
|
||||||
static bool upgrade_to_version_3(void)
|
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"));
|
DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n"));
|
||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr;
|
for (kbuf = tdb_firstkey_compat(tdb_drivers); kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
|
kbuf = tdb_nextkey_compat(tdb_drivers, kbuf)) {
|
||||||
|
|
||||||
dbuf = tdb_fetch_compat(tdb_drivers, kbuf);
|
dbuf = tdb_fetch_compat(tdb_drivers, kbuf);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ static int net_printing_dump(struct net_context *c, int argc,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
TALLOC_CTX *ctx = talloc_stackframe();
|
TALLOC_CTX *ctx = talloc_stackframe();
|
||||||
TDB_CONTEXT *tdb;
|
TDB_CONTEXT *tdb;
|
||||||
TDB_DATA kbuf, newkey, dbuf;
|
TDB_DATA kbuf, dbuf;
|
||||||
|
|
||||||
if (argc < 1 || c->display_usage) {
|
if (argc < 1 || c->display_usage) {
|
||||||
d_fprintf(stderr, "%s\nnet printing dump <file.tdb>\n",
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb);
|
for (kbuf = tdb_firstkey_compat(tdb);
|
||||||
kbuf.dptr;
|
kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf=newkey)
|
kbuf = tdb_nextkey_compat(tdb, kbuf))
|
||||||
{
|
{
|
||||||
dbuf = tdb_fetch_compat(tdb, kbuf);
|
dbuf = tdb_fetch_compat(tdb, kbuf);
|
||||||
if (!dbuf.dptr) {
|
if (!dbuf.dptr) {
|
||||||
@ -637,7 +637,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
|
|||||||
{
|
{
|
||||||
TALLOC_CTX *tmp_ctx;
|
TALLOC_CTX *tmp_ctx;
|
||||||
TDB_CONTEXT *tdb;
|
TDB_CONTEXT *tdb;
|
||||||
TDB_DATA kbuf, newkey, dbuf;
|
TDB_DATA kbuf, dbuf;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
tmp_ctx = talloc_new(mem_ctx);
|
tmp_ctx = talloc_new(mem_ctx);
|
||||||
@ -652,9 +652,9 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb);
|
for (kbuf = tdb_firstkey_compat(tdb);
|
||||||
kbuf.dptr;
|
kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey)
|
kbuf = tdb_nextkey_compat(tdb, kbuf))
|
||||||
{
|
{
|
||||||
dbuf = tdb_fetch_compat(tdb, kbuf);
|
dbuf = tdb_fetch_compat(tdb, kbuf);
|
||||||
if (!dbuf.dptr) {
|
if (!dbuf.dptr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user