s3-printing: split out printing migration code into a smaller library.
authorGünther Deschner <gd@samba.org>
Fri, 1 Jul 2011 12:57:32 +0000 (14:57 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 1 Jul 2011 14:46:26 +0000 (16:46 +0200)
Guenther

source3/Makefile.in
source3/printing/nt_printing_migrate.c
source3/printing/nt_printing_migrate.h
source3/printing/nt_printing_migrate_internal.c [new file with mode: 0644]
source3/printing/nt_printing_migrate_internal.h [new file with mode: 0644]
source3/printing/spoolssd.c
source3/rpc_server/rpc_ep_setup.c
source3/wscript_build

index e052881de604b699b7035319fad8237f6b9972a8..cde41c63bbb3cd85bf84cfa0c7a5f96c6dfbfe46 100644 (file)
@@ -963,6 +963,7 @@ PRINTBACKEND_OBJ = printing/printing.o \
                   printing/nt_printing.o \
                   printing/nt_printing_tdb.o \
                   printing/nt_printing_migrate.o \
+                  printing/nt_printing_migrate_internal.o \
                   printing/nt_printing_ads.o \
                   librpc/gen_ndr/ndr_ntprinting.o \
                    ../librpc/ndr/ndr_ntprinting.o \
index 79145852e772c4008feee9e1e323c8497fd68754..dc3f3694b709f1007c9b6eb5004c109375605320 100644 (file)
  */
 
 #include "includes.h"
-#include "system/filesys.h"
 #include "printing/nt_printing_migrate.h"
 
 #include "rpc_client/rpc_client.h"
 #include "librpc/gen_ndr/ndr_ntprinting.h"
 #include "librpc/gen_ndr/ndr_spoolss_c.h"
 #include "librpc/gen_ndr/ndr_security.h"
-#include "rpc_server/rpc_ncacn_np.h"
-#include "auth.h"
-#include "util_tdb.h"
-
-#define FORMS_PREFIX "FORMS/"
-#define DRIVERS_PREFIX "DRIVERS/"
-#define PRINTERS_PREFIX "PRINTERS/"
-#define SECDESC_PREFIX "SECDESC/"
-
-static NTSTATUS migrate_form(TALLOC_CTX *mem_ctx,
-                        struct rpc_pipe_client *pipe_hnd,
-                        const char *key_name,
-                        unsigned char *data,
-                        size_t length)
+
+NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx,
+                                  struct rpc_pipe_client *pipe_hnd,
+                                  const char *key_name,
+                                  unsigned char *data,
+                                  size_t length)
 {
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        struct spoolss_DevmodeContainer devmode_ctr;
@@ -133,11 +124,11 @@ static NTSTATUS migrate_form(TALLOC_CTX *mem_ctx,
        return status;
 }
 
-static NTSTATUS migrate_driver(TALLOC_CTX *mem_ctx,
-                              struct rpc_pipe_client *pipe_hnd,
-                              const char *key_name,
-                              unsigned char *data,
-                              size_t length)
+NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
+                                    struct rpc_pipe_client *pipe_hnd,
+                                    const char *key_name,
+                                    unsigned char *data,
+                                    size_t length)
 {
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        const char *srv_name_slash;
@@ -205,11 +196,11 @@ static NTSTATUS migrate_driver(TALLOC_CTX *mem_ctx,
        return status;
 }
 
-static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
-                               struct rpc_pipe_client *pipe_hnd,
-                               const char *key_name,
-                               unsigned char *data,
-                               size_t length)
+NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
+                                     struct rpc_pipe_client *pipe_hnd,
+                                     const char *key_name,
+                                     unsigned char *data,
+                                     size_t length)
 {
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        struct policy_handle hnd;
@@ -409,11 +400,11 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
        return status;
 }
 
-static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
-                               struct rpc_pipe_client *pipe_hnd,
-                               const char *key_name,
-                               unsigned char *data,
-                               size_t length)
+NTSTATUS printing_tdb_migrate_secdesc(TALLOC_CTX *mem_ctx,
+                                     struct rpc_pipe_client *pipe_hnd,
+                                     const char *key_name,
+                                     unsigned char *data,
+                                     size_t length)
 {
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
        struct policy_handle hnd;
@@ -494,217 +485,3 @@ static NTSTATUS migrate_secdesc(TALLOC_CTX *mem_ctx,
 
        return status;
 }
-
-static int rename_file_with_suffix(TALLOC_CTX *mem_ctx,
-                                  const char *path,
-                                  const char *suffix)
-{
-       int rc = -1;
-       char *dst_path;
-
-       dst_path = talloc_asprintf(mem_ctx, "%s%s", path, suffix);
-       if (dst_path == NULL) {
-               DEBUG(3, ("error out of memory\n"));
-               return rc;
-       }
-
-       rc = (rename(path, dst_path) != 0);
-
-       if (rc == 0) {
-               DEBUG(5, ("moved '%s' to '%s'\n", path, dst_path));
-       } else if (errno == ENOENT) {
-               DEBUG(3, ("file '%s' does not exist - so not moved\n", path));
-               rc = 0;
-       } else {
-               DEBUG(3, ("error renaming %s to %s: %s\n", path, dst_path,
-                         strerror(errno)));
-       }
-
-       TALLOC_FREE(dst_path);
-       return rc;
-}
-
-static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
-                                const char *tdb_path,
-                                struct rpc_pipe_client *pipe_hnd)
-{
-       const char *backup_suffix = ".bak";
-       TDB_DATA kbuf, dbuf;
-       TDB_CONTEXT *tdb;
-       NTSTATUS status;
-       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;
-       }
-
-       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, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) {
-                       status = migrate_form(mem_ctx,
-                                             pipe_hnd,
-                                             (const char *) kbuf.dptr + strlen(FORMS_PREFIX),
-                                             dbuf.dptr,
-                                             dbuf.dsize);
-                       SAFE_FREE(dbuf.dptr);
-                       if (!NT_STATUS_IS_OK(status)) {
-                               tdb_close(tdb);
-                               return status;
-                       }
-                       continue;
-               }
-
-               if (strncmp((const char *) kbuf.dptr, DRIVERS_PREFIX, strlen(DRIVERS_PREFIX)) == 0) {
-                       status = migrate_driver(mem_ctx,
-                                               pipe_hnd,
-                                               (const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
-                                               dbuf.dptr,
-                                               dbuf.dsize);
-                       SAFE_FREE(dbuf.dptr);
-                       if (!NT_STATUS_IS_OK(status)) {
-                               tdb_close(tdb);
-                               return status;
-                       }
-                       continue;
-               }
-
-               if (strncmp((const char *) kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
-                       const char *printer_name = (const char *)(kbuf.dptr
-                                                   + strlen(PRINTERS_PREFIX));
-                       status = migrate_printer(mem_ctx,
-                                                pipe_hnd,
-                                                printer_name,
-                                                dbuf.dptr,
-                                                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 "
-                                               "printer: %s\n", printer_name));
-                       } else if (!NT_STATUS_IS_OK(status)) {
-                               tdb_close(tdb);
-                               return status;
-                       }
-                       continue;
-               }
-
-               if (strncmp((const char *) kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
-                       const char *secdesc_name = (const char *)(kbuf.dptr
-                                                   + strlen(SECDESC_PREFIX));
-                       status = migrate_secdesc(mem_ctx,
-                                                pipe_hnd,
-                                                secdesc_name,
-                                                dbuf.dptr,
-                                                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));
-                       } else if (!NT_STATUS_IS_OK(status)) {
-                               tdb_close(tdb);
-                               return status;
-                       }
-                       continue;
-               }
-       }
-
-       tdb_close(tdb);
-
-       rc = rename_file_with_suffix(mem_ctx, tdb_path, backup_suffix);
-       if (rc != 0) {
-               DEBUG(0, ("Error moving tdb to '%s%s'\n",
-                         tdb_path, backup_suffix));
-       }
-
-       return NT_STATUS_OK;
-}
-
-bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
-{
-       const char *drivers_path = state_path("ntdrivers.tdb");
-       const char *printers_path = state_path("ntprinters.tdb");
-       const char *forms_path = state_path("ntforms.tdb");
-       bool drivers_exists = file_exist(drivers_path);
-       bool printers_exists = file_exist(printers_path);
-       bool forms_exists = file_exist(forms_path);
-       struct auth_serversupplied_info *session_info;
-       struct rpc_pipe_client *spoolss_pipe = NULL;
-       TALLOC_CTX *tmp_ctx = talloc_stackframe();
-       NTSTATUS status;
-
-       if (!drivers_exists && !printers_exists && !forms_exists) {
-               return true;
-       }
-
-       status = make_session_info_system(tmp_ctx, &session_info);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Couldn't create session_info: %s\n",
-                         nt_errstr(status)));
-               talloc_free(tmp_ctx);
-               return false;
-       }
-
-       status = rpc_pipe_open_interface(tmp_ctx,
-                                       &ndr_table_spoolss.syntax_id,
-                                       session_info,
-                                       NULL,
-                                       msg_ctx,
-                                       &spoolss_pipe);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Couldn't open internal spoolss pipe: %s\n",
-                         nt_errstr(status)));
-               talloc_free(tmp_ctx);
-               return false;
-       }
-
-       if (drivers_exists) {
-               status = migrate_internal(tmp_ctx, drivers_path, spoolss_pipe);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(0, ("Couldn't migrate drivers tdb file: %s\n",
-                         nt_errstr(status)));
-                       talloc_free(tmp_ctx);
-                       return false;
-               }
-       }
-
-       if (printers_exists) {
-               status = migrate_internal(tmp_ctx, printers_path, spoolss_pipe);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(0, ("Couldn't migrate printers tdb file: %s\n",
-                                 nt_errstr(status)));
-                       talloc_free(tmp_ctx);
-                       return false;
-               }
-       }
-
-       if (forms_exists) {
-               status = migrate_internal(tmp_ctx, forms_path, spoolss_pipe);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(0, ("Couldn't migrate forms tdb file: %s\n",
-                                 nt_errstr(status)));
-                       talloc_free(tmp_ctx);
-                       return false;
-               }
-       }
-
-       talloc_free(tmp_ctx);
-       return true;
-}
index 9ab2fa7daeb76aaa134ee0e85c69b976ef44c1b9..4991d06bd3e9588b5fc964b52f22c9bb470da45d 100644 (file)
 #ifndef _NT_PRINTING_MIGRATE_H_
 #define _NT_PRINTING_MIGRATE_H_
 
-bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx);
+NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx,
+                                  struct rpc_pipe_client *pipe_hnd,
+                                  const char *key_name,
+                                  unsigned char *data,
+                                  size_t length);
+NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
+                                    struct rpc_pipe_client *pipe_hnd,
+                                    const char *key_name,
+                                    unsigned char *data,
+                                    size_t length);
+NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
+                                     struct rpc_pipe_client *pipe_hnd,
+                                     const char *key_name,
+                                     unsigned char *data,
+                                     size_t length);
+NTSTATUS printing_tdb_migrate_secdesc(TALLOC_CTX *mem_ctx,
+                                     struct rpc_pipe_client *pipe_hnd,
+                                     const char *key_name,
+                                     unsigned char *data,
+                                     size_t length);
 
 #endif /* _NT_PRINTING_MIGRATE_H_ */
diff --git a/source3/printing/nt_printing_migrate_internal.c b/source3/printing/nt_printing_migrate_internal.c
new file mode 100644 (file)
index 0000000..59f6d33
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  RPC Pipe client / server routines
+ *
+ *  Copyright (c) Andreas Schneider            2010.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "system/filesys.h"
+#include "printing/nt_printing_migrate.h"
+#include "printing/nt_printing_migrate_internal.h"
+
+#include "rpc_client/rpc_client.h"
+#include "librpc/gen_ndr/ndr_spoolss_c.h"
+#include "rpc_server/rpc_ncacn_np.h"
+#include "auth.h"
+#include "util_tdb.h"
+
+#define FORMS_PREFIX "FORMS/"
+#define DRIVERS_PREFIX "DRIVERS/"
+#define PRINTERS_PREFIX "PRINTERS/"
+#define SECDESC_PREFIX "SECDESC/"
+
+static int rename_file_with_suffix(TALLOC_CTX *mem_ctx,
+                                  const char *path,
+                                  const char *suffix)
+{
+       int rc = -1;
+       char *dst_path;
+
+       dst_path = talloc_asprintf(mem_ctx, "%s%s", path, suffix);
+       if (dst_path == NULL) {
+               DEBUG(3, ("error out of memory\n"));
+               return rc;
+       }
+
+       rc = (rename(path, dst_path) != 0);
+
+       if (rc == 0) {
+               DEBUG(5, ("moved '%s' to '%s'\n", path, dst_path));
+       } else if (errno == ENOENT) {
+               DEBUG(3, ("file '%s' does not exist - so not moved\n", path));
+               rc = 0;
+       } else {
+               DEBUG(3, ("error renaming %s to %s: %s\n", path, dst_path,
+                         strerror(errno)));
+       }
+
+       TALLOC_FREE(dst_path);
+       return rc;
+}
+
+static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
+                                const char *tdb_path,
+                                struct rpc_pipe_client *pipe_hnd)
+{
+       const char *backup_suffix = ".bak";
+       TDB_DATA kbuf, dbuf;
+       TDB_CONTEXT *tdb;
+       NTSTATUS status;
+       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;
+       }
+
+       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, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) {
+                       status = printing_tdb_migrate_form(mem_ctx,
+                                             pipe_hnd,
+                                             (const char *) kbuf.dptr + strlen(FORMS_PREFIX),
+                                             dbuf.dptr,
+                                             dbuf.dsize);
+                       SAFE_FREE(dbuf.dptr);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               tdb_close(tdb);
+                               return status;
+                       }
+                       continue;
+               }
+
+               if (strncmp((const char *) kbuf.dptr, DRIVERS_PREFIX, strlen(DRIVERS_PREFIX)) == 0) {
+                       status = printing_tdb_migrate_driver(mem_ctx,
+                                               pipe_hnd,
+                                               (const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
+                                               dbuf.dptr,
+                                               dbuf.dsize);
+                       SAFE_FREE(dbuf.dptr);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               tdb_close(tdb);
+                               return status;
+                       }
+                       continue;
+               }
+
+               if (strncmp((const char *) kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
+                       const char *printer_name = (const char *)(kbuf.dptr
+                                                   + strlen(PRINTERS_PREFIX));
+                       status = printing_tdb_migrate_printer(mem_ctx,
+                                                pipe_hnd,
+                                                printer_name,
+                                                dbuf.dptr,
+                                                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 "
+                                               "printer: %s\n", printer_name));
+                       } else if (!NT_STATUS_IS_OK(status)) {
+                               tdb_close(tdb);
+                               return status;
+                       }
+                       continue;
+               }
+
+               if (strncmp((const char *) kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
+                       const char *secdesc_name = (const char *)(kbuf.dptr
+                                                   + strlen(SECDESC_PREFIX));
+                       status = printing_tdb_migrate_secdesc(mem_ctx,
+                                                pipe_hnd,
+                                                secdesc_name,
+                                                dbuf.dptr,
+                                                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));
+                       } else if (!NT_STATUS_IS_OK(status)) {
+                               tdb_close(tdb);
+                               return status;
+                       }
+                       continue;
+               }
+       }
+
+       tdb_close(tdb);
+
+       rc = rename_file_with_suffix(mem_ctx, tdb_path, backup_suffix);
+       if (rc != 0) {
+               DEBUG(0, ("Error moving tdb to '%s%s'\n",
+                         tdb_path, backup_suffix));
+       }
+
+       return NT_STATUS_OK;
+}
+
+bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
+{
+       const char *drivers_path = state_path("ntdrivers.tdb");
+       const char *printers_path = state_path("ntprinters.tdb");
+       const char *forms_path = state_path("ntforms.tdb");
+       bool drivers_exists = file_exist(drivers_path);
+       bool printers_exists = file_exist(printers_path);
+       bool forms_exists = file_exist(forms_path);
+       struct auth_serversupplied_info *session_info;
+       struct rpc_pipe_client *spoolss_pipe = NULL;
+       TALLOC_CTX *tmp_ctx = talloc_stackframe();
+       NTSTATUS status;
+
+       if (!drivers_exists && !printers_exists && !forms_exists) {
+               return true;
+       }
+
+       status = make_session_info_system(tmp_ctx, &session_info);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("Couldn't create session_info: %s\n",
+                         nt_errstr(status)));
+               talloc_free(tmp_ctx);
+               return false;
+       }
+
+       status = rpc_pipe_open_interface(tmp_ctx,
+                                       &ndr_table_spoolss.syntax_id,
+                                       session_info,
+                                       NULL,
+                                       msg_ctx,
+                                       &spoolss_pipe);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("Couldn't open internal spoolss pipe: %s\n",
+                         nt_errstr(status)));
+               talloc_free(tmp_ctx);
+               return false;
+       }
+
+       if (drivers_exists) {
+               status = migrate_internal(tmp_ctx, drivers_path, spoolss_pipe);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("Couldn't migrate drivers tdb file: %s\n",
+                         nt_errstr(status)));
+                       talloc_free(tmp_ctx);
+                       return false;
+               }
+       }
+
+       if (printers_exists) {
+               status = migrate_internal(tmp_ctx, printers_path, spoolss_pipe);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("Couldn't migrate printers tdb file: %s\n",
+                                 nt_errstr(status)));
+                       talloc_free(tmp_ctx);
+                       return false;
+               }
+       }
+
+       if (forms_exists) {
+               status = migrate_internal(tmp_ctx, forms_path, spoolss_pipe);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("Couldn't migrate forms tdb file: %s\n",
+                                 nt_errstr(status)));
+                       talloc_free(tmp_ctx);
+                       return false;
+               }
+       }
+
+       talloc_free(tmp_ctx);
+       return true;
+}
diff --git a/source3/printing/nt_printing_migrate_internal.h b/source3/printing/nt_printing_migrate_internal.h
new file mode 100644 (file)
index 0000000..dfcf914
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  RPC Pipe client / server routines
+ *
+ *  Copyright (c) Andreas Schneider            2010.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _NT_PRINTING_MIGRATE_INTERNAL_H_
+#define _NT_PRINTING_MIGRATE_INTERNAL_H_
+
+bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx);
+
+#endif /* _NT_PRINTING_MIGRATE_INTERNAL_H_ */
index 896aee0a5395f852c8a6372dd8935c88eed3168a..cb90a9f7c76c7847bb41b2ef44c9273d07710e19 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "messages.h"
 #include "include/printing.h"
-#include "printing/nt_printing_migrate.h"
+#include "printing/nt_printing_migrate_internal.h"
 #include "ntdomain.h"
 #include "librpc/gen_ndr/srv_winreg.h"
 #include "librpc/gen_ndr/srv_spoolss.h"
index e5059dae8072671faf8922c7fe9d755319ec0aaa..7dc23aae89d085e50dd86d73c2607565dff7f135 100644 (file)
@@ -39,7 +39,7 @@
 #include "../librpc/gen_ndr/srv_svcctl.h"
 #include "../librpc/gen_ndr/srv_wkssvc.h"
 
-#include "printing/nt_printing_migrate.h"
+#include "printing/nt_printing_migrate_internal.h"
 #include "rpc_server/eventlog/srv_eventlog_reg.h"
 #include "rpc_server/svcctl/srv_svcctl_reg.h"
 #include "rpc_server/spoolss/srv_spoolss_nt.h"
index e27f178b42fe459f0b429ae96316913792cba134..2a19261ea482f94b099341db40bc9780b6370189 100755 (executable)
@@ -399,7 +399,7 @@ PRINTBASE_SRC = '''printing/notify.c printing/printing_db.c'''
 PRINTBACKEND_SRC = '''printing/printing.c
                       printing/nt_printing.c
                       printing/nt_printing_tdb.c
-                      printing/nt_printing_migrate.c
+                      printing/nt_printing_migrate_internal.c
                       printing/nt_printing_ads.c'''
 
 SMBD_SRC = '''${SMBD_SRC_BASE} ${SMBD_SRC_MAIN}'''
@@ -906,9 +906,15 @@ bld.SAMBA3_SUBSYSTEM('PRINTBASE',
 
 bld.SAMBA3_SUBSYSTEM('PRINTBACKEND',
                     source=PRINTBACKEND_SRC,
-                    deps='PRINTBASE NDR_NTPRINTING LIBADS_PRINTER tdb',
+                    deps='PRINTBASE LIBADS_PRINTER tdb printing_migrate',
                     vars=locals())
 
+bld.SAMBA3_LIBRARY('printing_migrate',
+                    source='printing/nt_printing_migrate.c',
+                    deps='NDR_NTPRINTING RPC_NDR_SPOOLSS param',
+                    vars=locals(),
+                    private_library=True)
+
 bld.SAMBA3_SUBSYSTEM('PRINTING',
                     source=PRINTING_SRC,
                     deps='NDR_PRINTCAP tdb',