s3-libsmb: rename cli_query_secdesc() to cli_query_secdesc_old()
[kai/samba.git] / source3 / utils / net_rpc_printer.c
index 272e0c9dfa1f5008051317f1dd60bf53718b421c..f5019af346039c735a58865ad5e28c0a33e0ef49 100644 (file)
@@ -185,7 +185,7 @@ NTSTATUS net_copy_fileattr(struct net_context *c,
 
        if (copy_acls) {
                /* get the security descriptor */
-               sd = cli_query_secdesc(cli_share_src, fnum_src, mem_ctx);
+               sd = cli_query_secdesc_old(cli_share_src, fnum_src, mem_ctx);
                if (!sd) {
                        DEBUG(0,("failed to get security descriptor: %s\n",
                                cli_errstr(cli_share_src)));
@@ -368,8 +368,10 @@ NTSTATUS net_copy_file(struct net_context *c,
 
                d_printf(_("copying [\\\\%s\\%s%s] => [\\\\%s\\%s%s] "
                           "%s ACLs and %s DOS Attributes %s\n"),
-                       cli_share_src->desthost, cli_share_src->share, src_name,
-                       cli_share_dst->desthost, cli_share_dst->share, dst_name,
+                       cli_state_remote_name(cli_share_src),
+                       cli_share_src->share, src_name,
+                       cli_state_remote_name(cli_share_dst),
+                       cli_share_dst->share, dst_name,
                        copy_acls ?  _("with") : _("without"),
                        copy_attrs ? _("with") : _("without"),
                        copy_timestamps ? _("(preserving timestamps)") : "" );
@@ -379,19 +381,31 @@ NTSTATUS net_copy_file(struct net_context *c,
        while (is_file) {
 
                /* copying file */
-               int n;
-               n = cli_read(cli_share_src, fnum_src, data, nread,
-                               read_size);
+               size_t n;
 
-               if (n <= 0)
+               nt_status = cli_read(cli_share_src, fnum_src, data, nread,
+                                    read_size, &n);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       d_fprintf(stderr,
+                                 _("Error reading file [\\\\%s\%s%s]: %s\n"),
+                                 cli_state_remote_name(cli_share_src),
+                                 cli_share_src->share,
+                                 src_name, nt_errstr(nt_status));
+                       goto out;
+               }
+
+               if (n == 0)
                        break;
 
                nt_status = cli_writeall(cli_share_dst, fnum_dst, 0,
                                         (uint8_t *)data, nread, n, NULL);
 
                if (!NT_STATUS_IS_OK(nt_status)) {
-                       d_fprintf(stderr, _("Error writing file: %s\n"),
-                                 nt_errstr(nt_status));
+                       d_fprintf(stderr,
+                                 _("Error writing file: [\\\\%s\%s%s]: %s\n"),
+                                 cli_state_remote_name(cli_share_dst),
+                                 cli_share_dst->share,
+                                 dst_name, nt_errstr(nt_status));
                        goto out;
                }
 
@@ -1895,8 +1909,10 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
        b_dst = pipe_hnd_dst->binding_handle;
 
        /* open print$-share on the src server */
-       nt_status = connect_to_service(c, &cli_share_src, &cli->dest_ss,
-                       cli->desthost, "print$", "A:");
+       nt_status = connect_to_service(c, &cli_share_src,
+                                      cli_state_remote_sockaddr(cli),
+                                      cli_state_remote_name(cli),
+                                      "print$", "A:");
        if (!NT_STATUS_IS_OK(nt_status))
                goto done;
 
@@ -1904,8 +1920,10 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
 
 
        /* open print$-share on the dst server */
-       nt_status = connect_to_service(c, &cli_share_dst, &cli_dst->dest_ss,
-                       cli_dst->desthost, "print$", "A:");
+       nt_status = connect_to_service(c, &cli_share_dst,
+                                      cli_state_remote_sockaddr(cli_dst),
+                                      cli_state_remote_name(cli_dst),
+                                      "print$", "A:");
        if (!NT_STATUS_IS_OK(nt_status))
                return nt_status;