summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/printing/nt_printing_migrate_internal.c20
-rw-r--r--source3/utils/net_printing.c12
2 files changed, 28 insertions, 4 deletions
diff --git a/source3/printing/nt_printing_migrate_internal.c b/source3/printing/nt_printing_migrate_internal.c
index 706249cff7..1bd61588fc 100644
--- a/source3/printing/nt_printing_migrate_internal.c
+++ b/source3/printing/nt_printing_migrate_internal.c
@@ -143,6 +143,17 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
}
continue;
}
+ SAFE_FREE(dbuf.dptr);
+ }
+
+ for (kbuf = tdb_firstkey_compat(tdb);
+ kbuf.dptr;
+ kbuf = tdb_nextkey_compat(tdb, kbuf))
+ {
+ dbuf = tdb_fetch_compat(tdb, kbuf);
+ if (!dbuf.dptr) {
+ continue;
+ }
if (strncmp((const char *) kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
const char *secdesc_name = (const char *)(kbuf.dptr
@@ -154,16 +165,17 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
dbuf.dsize);
SAFE_FREE(dbuf.dptr);
/* currently no WERR_INVALID_PRINTER_NAME equivalent */
- if (NT_STATUS_EQUAL(status,
- werror_to_ntstatus(WERR_INVALID_PRINTER_NAME))) {
- DEBUG(2, ("Skipping migration for non-existent "
- "secdesc: %s\n", secdesc_name));
+ if (NT_STATUS_EQUAL(status, werror_to_ntstatus(WERR_INVALID_PRINTER_NAME)) ||
+ NT_STATUS_EQUAL(status, werror_to_ntstatus(WERR_BADFILE))) {
+ DEBUG(2, ("Skipping secdesc migration for non-existent "
+ "printer: %s\n", secdesc_name));
} else if (!NT_STATUS_IS_OK(status)) {
tdb_close(tdb);
return status;
}
continue;
}
+ SAFE_FREE(dbuf.dptr);
}
tdb_close(tdb);
diff --git a/source3/utils/net_printing.c b/source3/utils/net_printing.c
index cefbd6eec6..fd33ede152 100644
--- a/source3/utils/net_printing.c
+++ b/source3/utils/net_printing.c
@@ -284,6 +284,17 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
SAFE_FREE(dbuf.dptr);
continue;
}
+ SAFE_FREE(dbuf.dptr);
+ }
+
+ for (kbuf = tdb_firstkey_compat(tdb);
+ kbuf.dptr;
+ kbuf = tdb_nextkey_compat(tdb, kbuf))
+ {
+ dbuf = tdb_fetch_compat(tdb, kbuf);
+ if (!dbuf.dptr) {
+ continue;
+ }
if (strncmp((const char *) kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
printing_tdb_migrate_secdesc(tmp_ctx,
@@ -294,6 +305,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
SAFE_FREE(dbuf.dptr);
continue;
}
+ SAFE_FREE(dbuf.dptr);
}