s3-printing: remove spoolss pipe from migration library, only using winreg finally.
authorGünther Deschner <gd@samba.org>
Tue, 5 Jul 2011 00:33:23 +0000 (02:33 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 7 Jul 2011 16:06:02 +0000 (18:06 +0200)
Guenther

Pair-Programmed-With: David Disseldorp <ddiss@suse.de>

source3/printing/nt_printing_migrate.c
source3/printing/nt_printing_migrate.h
source3/printing/nt_printing_migrate_internal.c
source3/utils/net_printing.c

index 5fd639e1b6b621bd38448c9359d186e3764d0a77..f3cc6cbe55cd32c54d7027cc81715ce8565d7b77 100644 (file)
@@ -28,7 +28,6 @@
 #include "rpc_client/cli_winreg_spoolss.h"
 
 NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx,
-                                  struct rpc_pipe_client *pipe_hnd,
                                   struct rpc_pipe_client *winreg_pipe,
                                   const char *key_name,
                                   unsigned char *data,
@@ -82,7 +81,6 @@ NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
-                                    struct rpc_pipe_client *pipe_hnd,
                                     struct rpc_pipe_client *winreg_pipe,
                                     const char *key_name,
                                     unsigned char *data,
@@ -145,7 +143,6 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
-                                     struct rpc_pipe_client *pipe_hnd,
                                      struct rpc_pipe_client *winreg_pipe,
                                      const char *key_name,
                                      unsigned char *data,
@@ -307,7 +304,6 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS printing_tdb_migrate_secdesc(TALLOC_CTX *mem_ctx,
-                                     struct rpc_pipe_client *pipe_hnd,
                                      struct rpc_pipe_client *winreg_pipe,
                                      const char *key_name,
                                      unsigned char *data,
index 707ddc9714f71c9d42014583356348f708148afd..3da8db462683a016db54f92b36e74bcd8fbc5486 100644 (file)
 #define _NT_PRINTING_MIGRATE_H_
 
 NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx,
-                                  struct rpc_pipe_client *pipe_hnd,
                                   struct rpc_pipe_client *winreg_pipe,
                                   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,
                                     struct rpc_pipe_client *winreg_pipe,
                                     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,
                                      struct rpc_pipe_client *winreg_pipe,
                                      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,
                                      struct rpc_pipe_client *winreg_pipe,
                                      const char *key_name,
                                      unsigned char *data,
index 214ea8977d09046497ebff8e2a0335d7f56e983c..706249cff717c171668d550dcad8ca56d0a146b0 100644 (file)
@@ -66,7 +66,6 @@ static int rename_file_with_suffix(TALLOC_CTX *mem_ctx,
 
 static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
                                 const char *tdb_path,
-                                struct rpc_pipe_client *pipe_hnd,
                                 struct rpc_pipe_client *winreg_pipe)
 {
        const char *backup_suffix = ".bak";
@@ -98,7 +97,6 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
 
                if (strncmp((const char *) kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) {
                        status = printing_tdb_migrate_form(mem_ctx,
-                                             pipe_hnd,
                                              winreg_pipe,
                                              (const char *) kbuf.dptr + strlen(FORMS_PREFIX),
                                              dbuf.dptr,
@@ -113,7 +111,6 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
 
                if (strncmp((const char *) kbuf.dptr, DRIVERS_PREFIX, strlen(DRIVERS_PREFIX)) == 0) {
                        status = printing_tdb_migrate_driver(mem_ctx,
-                                               pipe_hnd,
                                                winreg_pipe,
                                                (const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
                                                dbuf.dptr,
@@ -130,7 +127,6 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
                        const char *printer_name = (const char *)(kbuf.dptr
                                                    + strlen(PRINTERS_PREFIX));
                        status = printing_tdb_migrate_printer(mem_ctx,
-                                                pipe_hnd,
                                                 winreg_pipe,
                                                 printer_name,
                                                 dbuf.dptr,
@@ -152,7 +148,6 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
                        const char *secdesc_name = (const char *)(kbuf.dptr
                                                    + strlen(SECDESC_PREFIX));
                        status = printing_tdb_migrate_secdesc(mem_ctx,
-                                                pipe_hnd,
                                                 winreg_pipe,
                                                 secdesc_name,
                                                 dbuf.dptr,
@@ -191,7 +186,6 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
        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;
        struct rpc_pipe_client *winreg_pipe = NULL;
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
        NTSTATUS status;
@@ -208,19 +202,6 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_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;
-       }
-
        status = rpc_pipe_open_interface(tmp_ctx,
                                        &ndr_table_winreg.syntax_id,
                                        session_info,
@@ -235,7 +216,7 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
        }
 
        if (drivers_exists) {
-               status = migrate_internal(tmp_ctx, drivers_path, spoolss_pipe, winreg_pipe);
+               status = migrate_internal(tmp_ctx, drivers_path, winreg_pipe);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("Couldn't migrate drivers tdb file: %s\n",
                          nt_errstr(status)));
@@ -245,7 +226,7 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
        }
 
        if (printers_exists) {
-               status = migrate_internal(tmp_ctx, printers_path, spoolss_pipe, winreg_pipe);
+               status = migrate_internal(tmp_ctx, printers_path, winreg_pipe);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("Couldn't migrate printers tdb file: %s\n",
                                  nt_errstr(status)));
@@ -255,7 +236,7 @@ bool nt_printing_tdb_migrate(struct messaging_context *msg_ctx)
        }
 
        if (forms_exists) {
-               status = migrate_internal(tmp_ctx, forms_path, spoolss_pipe, winreg_pipe);
+               status = migrate_internal(tmp_ctx, forms_path, winreg_pipe);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("Couldn't migrate forms tdb file: %s\n",
                                  nt_errstr(status)));
index 9c2f70082d7da81f3d3628afb72bf0b7ed585cc1..cefbd6eec6292b04f55868c70bbceaf7cc57c48f 100644 (file)
@@ -224,7 +224,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
                                          const struct dom_sid *domain_sid,
                                          const char *domain_name,
                                          struct cli_state *cli,
-                                         struct rpc_pipe_client *pipe_hnd,
+                                         struct rpc_pipe_client *winreg_pipe,
                                          TALLOC_CTX *mem_ctx,
                                          int argc,
                                          const char **argv)
@@ -233,22 +233,12 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
        TDB_CONTEXT *tdb;
        TDB_DATA kbuf, dbuf;
        NTSTATUS status;
-       struct rpc_pipe_client *winreg_pipe = NULL;
 
        tmp_ctx = talloc_new(mem_ctx);
        if (tmp_ctx == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(pipe_hnd),
-                                         &ndr_table_winreg.syntax_id,
-                                         &winreg_pipe);
-       if (!NT_STATUS_IS_OK(status)) {
-               d_fprintf(stderr, _("failed to open winreg pipe: %s\n"),
-                       nt_errstr(status));
-               goto done;
-       }
-
        tdb = tdb_open_log(argv[0], 0, TDB_DEFAULT, O_RDONLY, 0600);
        if (tdb == NULL) {
                d_fprintf(stderr, _("failed to open tdb file: %s\n"), argv[0]);
@@ -267,7 +257,6 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
 
                if (strncmp((const char *) kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) {
                        printing_tdb_migrate_form(tmp_ctx,
-                                    pipe_hnd,
                                     winreg_pipe,
                                     (const char *) kbuf.dptr + strlen(FORMS_PREFIX),
                                     dbuf.dptr,
@@ -278,7 +267,6 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
 
                if (strncmp((const char *) kbuf.dptr, DRIVERS_PREFIX, strlen(DRIVERS_PREFIX)) == 0) {
                        printing_tdb_migrate_driver(tmp_ctx,
-                                      pipe_hnd,
                                       winreg_pipe,
                                       (const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
                                       dbuf.dptr,
@@ -289,7 +277,6 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
 
                if (strncmp((const char *) kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
                        printing_tdb_migrate_printer(tmp_ctx,
-                                       pipe_hnd,
                                        winreg_pipe,
                                        (const char *) kbuf.dptr + strlen(PRINTERS_PREFIX),
                                        dbuf.dptr,
@@ -300,7 +287,6 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
 
                if (strncmp((const char *) kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
                        printing_tdb_migrate_secdesc(tmp_ctx,
-                                       pipe_hnd,
                                        winreg_pipe,
                                        (const char *) kbuf.dptr + strlen(SECDESC_PREFIX),
                                        dbuf.dptr,
@@ -333,7 +319,7 @@ static int net_printing_migrate(struct net_context *c,
 
        return run_rpc_command(c,
                               NULL,
-                              &ndr_table_spoolss.syntax_id,
+                              &ndr_table_winreg.syntax_id,
                               0,
                               printing_migrate_internal,
                               argc,