summaryrefslogtreecommitdiff
path: root/source3/printing/nt_printing_migrate.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-06 13:06:42 +1000
committerGünther Deschner <gd@samba.org>2010-08-06 12:14:59 +0200
commitfe5f4d91ce5067c4222648967719f67f6e670642 (patch)
tree4296c880ea8cd7b6c468bb285fdb828a7b448c5e /source3/printing/nt_printing_migrate.c
parenta2607a62f3ff359715e49fed93ec23f744e861b5 (diff)
downloadsamba-fe5f4d91ce5067c4222648967719f67f6e670642.tar.gz
samba-fe5f4d91ce5067c4222648967719f67f6e670642.tar.bz2
samba-fe5f4d91ce5067c4222648967719f67f6e670642.zip
s3-printing: cope with missing printers in print migration
The printers database may be completely missing in a new install, and we may have SECDESC entries for printers that have been removed. Don't consider these fatal errors in the migration. Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/printing/nt_printing_migrate.c')
-rw-r--r--source3/printing/nt_printing_migrate.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c
index 1ee5578818..7e7db562ec 100644
--- a/source3/printing/nt_printing_migrate.c
+++ b/source3/printing/nt_printing_migrate.c
@@ -420,6 +420,10 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
&hnd,
&result);
if (!NT_STATUS_IS_OK(status)) {
+ if (W_ERROR_EQUAL(WERR_INVALID_PRINTER_NAME, result)) {
+ DEBUG(3, ("Ignoring missing printer %s\n", key_name));
+ return NT_STATUS_OK;
+ }
if (!W_ERROR_IS_OK(result)) {
status = werror_to_ntstatus(result);
}
@@ -493,6 +497,12 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
int rc;
tdb = tdb_open_log(tdb_path, 0, TDB_DEFAULT, O_RDONLY, 0600);
+ if (tdb == NULL && errno == ENOENT) {
+ /* if we have no printers database then migration is
+ considered successful */
+ DEBUG(4, ("No printers database to migrate in %s\n", tdb_path));
+ return NT_STATUS_OK;
+ }
if (tdb == NULL) {
DEBUG(2, ("Failed to open tdb file: %s\n", tdb_path));
return NT_STATUS_NO_SUCH_FILE;