Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/client/smbspool.c

    r414 r740  
    2424
    2525#include "includes.h"
     26#include "system/filesys.h"
     27#include "system/passwd.h"
     28#include "libsmb/libsmb.h"
    2629
    2730/*
     
    241244         */
    242245
    243         setup_logging("smbspool", True);
     246        setup_logging("smbspool", DEBUG_STDOUT);
    244247
    245248        lp_set_in_client(True); /* Make sure that we tell lp_load we are */
     
    402405        *need_auth = false;
    403406        nt_status = cli_start_connection(&cli, myname, server, NULL, port,
    404                                          Undefined, flags, NULL);
     407                                         Undefined, flags);
    405408        if (!NT_STATUS_IS_OK(nt_status)) {
    406409                fprintf(stderr, "ERROR: Connection failed: %s\n", nt_errstr(nt_status));
     
    559562        char            buffer[8192],   /* Buffer for copy */
    560563                       *ptr;    /* Pointer into title */
     564        NTSTATUS nt_status;
    561565
    562566
     
    575579         */
    576580
    577         if (!NT_STATUS_IS_OK(cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum))) {
     581        nt_status = cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
     582                          &fnum);
     583        if (!NT_STATUS_IS_OK(nt_status)) {
    578584                fprintf(stderr, "ERROR: %s opening remote spool %s\n",
    579                         cli_errstr(cli), title);
    580                 return (get_exit_code(cli, cli_nt_error(cli)));
     585                        nt_errstr(nt_status), title);
     586                return get_exit_code(cli, nt_status);
    581587        }
    582588
     
    591597
    592598        while ((nbytes = fread(buffer, 1, sizeof(buffer), fp)) > 0) {
    593                 if (cli_write(cli, fnum, 0, buffer, tbytes, nbytes) != nbytes) {
    594                         int status = get_exit_code(cli, cli_nt_error(cli));
    595 
    596                         fprintf(stderr, "ERROR: Error writing spool: %s\n", cli_errstr(cli));
    597                         fprintf(stderr, "DEBUG: Returning status %d...\n", status);
     599                NTSTATUS status;
     600
     601                status = cli_writeall(cli, fnum, 0, (uint8_t *)buffer,
     602                                      tbytes, nbytes, NULL);
     603                if (!NT_STATUS_IS_OK(status)) {
     604                        int ret = get_exit_code(cli, status);
     605                        fprintf(stderr, "ERROR: Error writing spool: %s\n",
     606                                nt_errstr(status));
     607                        fprintf(stderr, "DEBUG: Returning status %d...\n",
     608                                ret);
    598609                        cli_close(cli, fnum);
    599610
    600                         return (status);
     611                        return (ret);
    601612                }
    602613                tbytes += nbytes;
    603614        }
    604615
    605         if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
     616        nt_status = cli_close(cli, fnum);
     617        if (!NT_STATUS_IS_OK(nt_status)) {
    606618                fprintf(stderr, "ERROR: %s closing remote spool %s\n",
    607                         cli_errstr(cli), title);
    608                 return (get_exit_code(cli, cli_nt_error(cli)));
     619                        nt_errstr(nt_status), title);
     620                return get_exit_code(cli, nt_status);
    609621        } else {
    610622                return (0);
Note: See TracChangeset for help on using the changeset viewer.