Changeset 740 for vendor/current/source3/client/smbspool.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/client/smbspool.c
r414 r740 24 24 25 25 #include "includes.h" 26 #include "system/filesys.h" 27 #include "system/passwd.h" 28 #include "libsmb/libsmb.h" 26 29 27 30 /* … … 241 244 */ 242 245 243 setup_logging("smbspool", True);246 setup_logging("smbspool", DEBUG_STDOUT); 244 247 245 248 lp_set_in_client(True); /* Make sure that we tell lp_load we are */ … … 402 405 *need_auth = false; 403 406 nt_status = cli_start_connection(&cli, myname, server, NULL, port, 404 Undefined, flags , NULL);407 Undefined, flags); 405 408 if (!NT_STATUS_IS_OK(nt_status)) { 406 409 fprintf(stderr, "ERROR: Connection failed: %s\n", nt_errstr(nt_status)); … … 559 562 char buffer[8192], /* Buffer for copy */ 560 563 *ptr; /* Pointer into title */ 564 NTSTATUS nt_status; 561 565 562 566 … … 575 579 */ 576 580 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)) { 578 584 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); 581 587 } 582 588 … … 591 597 592 598 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); 598 609 cli_close(cli, fnum); 599 610 600 return ( status);611 return (ret); 601 612 } 602 613 tbytes += nbytes; 603 614 } 604 615 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)) { 606 618 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); 609 621 } else { 610 622 return (0);
Note:
See TracChangeset
for help on using the changeset viewer.