diff options
author | Günther Deschner <gd@samba.org> | 2011-07-05 14:01:40 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-07-07 18:06:02 +0200 |
commit | cfc3b6e5f79f253e83dfbd13d47b671deb5801b3 (patch) | |
tree | 472e8a614fd1f234bb1e4b546a64b020b83df98e /source3/printing | |
parent | 5dd8185d852afc3843253c9471326677f8816a77 (diff) | |
download | samba-cfc3b6e5f79f253e83dfbd13d47b671deb5801b3.tar.gz samba-cfc3b6e5f79f253e83dfbd13d47b671deb5801b3.tar.bz2 samba-cfc3b6e5f79f253e83dfbd13d47b671deb5801b3.zip |
s3-printing: make sure to first migrate the printers then the security descriptor.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss@suse.de>
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing_migrate_internal.c | 20 |
1 files changed, 16 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); |