sftp-client.c (113908) | sftp-client.c (124208) |
---|---|
1/* 2 * Copyright (c) 2001-2003 Damien Miller. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 14 unchanged lines hidden (view full) --- 23 */ 24 25/* XXX: memleaks */ 26/* XXX: signed vs unsigned */ 27/* XXX: remove all logging, only return status codes */ 28/* XXX: copy between two remote sites */ 29 30#include "includes.h" | 1/* 2 * Copyright (c) 2001-2003 Damien Miller. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 14 unchanged lines hidden (view full) --- 23 */ 24 25/* XXX: memleaks */ 26/* XXX: signed vs unsigned */ 27/* XXX: remove all logging, only return status codes */ 28/* XXX: copy between two remote sites */ 29 30#include "includes.h" |
31RCSID("$OpenBSD: sftp-client.c,v 1.42 2003/03/05 22:33:43 markus Exp $"); | 31RCSID("$OpenBSD: sftp-client.c,v 1.44 2003/06/28 16:23:06 deraadt Exp $"); |
32 33#include "openbsd-compat/sys-queue.h" 34 35#include "buffer.h" 36#include "bufaux.h" 37#include "getput.h" 38#include "xmalloc.h" 39#include "log.h" --- 26 unchanged lines hidden (view full) --- 66{ 67 u_char mlen[4]; 68 69 if (buffer_len(m) > MAX_MSG_LENGTH) 70 fatal("Outbound message too long %u", buffer_len(m)); 71 72 /* Send length first */ 73 PUT_32BIT(mlen, buffer_len(m)); | 32 33#include "openbsd-compat/sys-queue.h" 34 35#include "buffer.h" 36#include "bufaux.h" 37#include "getput.h" 38#include "xmalloc.h" 39#include "log.h" --- 26 unchanged lines hidden (view full) --- 66{ 67 u_char mlen[4]; 68 69 if (buffer_len(m) > MAX_MSG_LENGTH) 70 fatal("Outbound message too long %u", buffer_len(m)); 71 72 /* Send length first */ 73 PUT_32BIT(mlen, buffer_len(m)); |
74 if (atomicio(write, fd, mlen, sizeof(mlen)) <= 0) | 74 if (atomicio(vwrite, fd, mlen, sizeof(mlen)) <= 0) |
75 fatal("Couldn't send packet: %s", strerror(errno)); 76 | 75 fatal("Couldn't send packet: %s", strerror(errno)); 76 |
77 if (atomicio(write, fd, buffer_ptr(m), buffer_len(m)) <= 0) | 77 if (atomicio(vwrite, fd, buffer_ptr(m), buffer_len(m)) <= 0) |
78 fatal("Couldn't send packet: %s", strerror(errno)); 79 80 buffer_clear(m); 81} 82 83static void 84get_msg(int fd, Buffer *m) 85{ --- 416 unchanged lines hidden (view full) --- 502do_lstat(struct sftp_conn *conn, char *path, int quiet) 503{ 504 u_int id; 505 506 if (conn->version == 0) { 507 if (quiet) 508 debug("Server version does not support lstat operation"); 509 else | 78 fatal("Couldn't send packet: %s", strerror(errno)); 79 80 buffer_clear(m); 81} 82 83static void 84get_msg(int fd, Buffer *m) 85{ --- 416 unchanged lines hidden (view full) --- 502do_lstat(struct sftp_conn *conn, char *path, int quiet) 503{ 504 u_int id; 505 506 if (conn->version == 0) { 507 if (quiet) 508 debug("Server version does not support lstat operation"); 509 else |
510 log("Server version does not support lstat operation"); | 510 logit("Server version does not support lstat operation"); |
511 return(do_stat(conn, path, quiet)); 512 } 513 514 id = conn->msg_id++; 515 send_string_request(conn->fd_out, id, SSH2_FXP_LSTAT, path, 516 strlen(path)); 517 518 return(get_decode_stat(conn->fd_in, id, quiet)); --- 351 unchanged lines hidden (view full) --- 870 data = buffer_get_string(&msg, &len); 871 debug3("Received data %llu -> %llu", 872 (unsigned long long)req->offset, 873 (unsigned long long)req->offset + len - 1); 874 if (len > req->len) 875 fatal("Received more data than asked for " 876 "%u > %u", len, req->len); 877 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || | 511 return(do_stat(conn, path, quiet)); 512 } 513 514 id = conn->msg_id++; 515 send_string_request(conn->fd_out, id, SSH2_FXP_LSTAT, path, 516 strlen(path)); 517 518 return(get_decode_stat(conn->fd_in, id, quiet)); --- 351 unchanged lines hidden (view full) --- 870 data = buffer_get_string(&msg, &len); 871 debug3("Received data %llu -> %llu", 872 (unsigned long long)req->offset, 873 (unsigned long long)req->offset + len - 1); 874 if (len > req->len) 875 fatal("Received more data than asked for " 876 "%u > %u", len, req->len); 877 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || |
878 atomicio(write, local_fd, data, len) != len) && | 878 atomicio(vwrite, local_fd, data, len) != len) && |
879 !write_error) { 880 write_errno = errno; 881 write_error = 1; 882 max_req = 0; 883 } 884 progress_counter += len; 885 xfree(data); 886 --- 264 unchanged lines hidden --- | 879 !write_error) { 880 write_errno = errno; 881 write_error = 1; 882 max_req = 0; 883 } 884 progress_counter += len; 885 xfree(data); 886 --- 264 unchanged lines hidden --- |