summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-03-22 02:54:23 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-03-22 02:54:23 +0000
commit6328ab39891ea64ccd5c91e9be2ec5c4f843bbd0 (patch)
tree1cbd94cc201fc901cf33ea52191421eda89e6dd0 /sftp-client.c
parent08105192fdb9441284ac37e309f6359d74aee596 (diff)
- markus@cvs.openbsd.org 2002/03/19 10:49:35
[auth-krb5.c auth-rh-rsa.c auth.c cipher.c key.c misc.h packet.c session.c sftp-client.c sftp-glob.h sftp.c ssh-add.c ssh.c sshconnect2.c sshd.c ttymodes.c] KNF whitespace
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sftp-client.c b/sftp-client.c
index fd2526710..ce82b6af5 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
28/* XXX: copy between two remote sites */ 28/* XXX: copy between two remote sites */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-client.c,v 1.27 2002/03/11 03:19:53 itojun Exp $"); 31RCSID("$OpenBSD: sftp-client.c,v 1.28 2002/03/19 10:49:35 markus Exp $");
32 32
33#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) 33#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
34#include <sys/queue.h> 34#include <sys/queue.h>
@@ -449,7 +449,7 @@ do_rm(struct sftp_conn *conn, char *path)
449 debug2("Sending SSH2_FXP_REMOVE \"%s\"", path); 449 debug2("Sending SSH2_FXP_REMOVE \"%s\"", path);
450 450
451 id = conn->msg_id++; 451 id = conn->msg_id++;
452 send_string_request(conn->fd_out, id, SSH2_FXP_REMOVE, path, 452 send_string_request(conn->fd_out, id, SSH2_FXP_REMOVE, path,
453 strlen(path)); 453 strlen(path));
454 status = get_status(conn->fd_in, id); 454 status = get_status(conn->fd_in, id);
455 if (status != SSH2_FX_OK) 455 if (status != SSH2_FX_OK)
@@ -496,8 +496,8 @@ do_stat(struct sftp_conn *conn, char *path, int quiet)
496 496
497 id = conn->msg_id++; 497 id = conn->msg_id++;
498 498
499 send_string_request(conn->fd_out, id, 499 send_string_request(conn->fd_out, id,
500 conn->version == 0 ? SSH2_FXP_STAT_VERSION_0 : SSH2_FXP_STAT, 500 conn->version == 0 ? SSH2_FXP_STAT_VERSION_0 : SSH2_FXP_STAT,
501 path, strlen(path)); 501 path, strlen(path));
502 502
503 return(get_decode_stat(conn->fd_in, id, quiet)); 503 return(get_decode_stat(conn->fd_in, id, quiet));
@@ -727,7 +727,7 @@ send_read_request(int fd_out, u_int id, u_int64_t offset, u_int len,
727 char *handle, u_int handle_len) 727 char *handle, u_int handle_len)
728{ 728{
729 Buffer msg; 729 Buffer msg;
730 730
731 buffer_init(&msg); 731 buffer_init(&msg);
732 buffer_clear(&msg); 732 buffer_clear(&msg);
733 buffer_put_char(&msg, SSH2_FXP_READ); 733 buffer_put_char(&msg, SSH2_FXP_READ);
@@ -737,7 +737,7 @@ send_read_request(int fd_out, u_int id, u_int64_t offset, u_int len,
737 buffer_put_int(&msg, len); 737 buffer_put_int(&msg, len);
738 send_msg(fd_out, &msg); 738 send_msg(fd_out, &msg);
739 buffer_free(&msg); 739 buffer_free(&msg);
740} 740}
741 741
742int 742int
743do_download(struct sftp_conn *conn, char *remote_path, char *local_path, 743do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
@@ -754,7 +754,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
754 u_int id; 754 u_int id;
755 u_int len; 755 u_int len;
756 u_int64_t offset; 756 u_int64_t offset;
757 TAILQ_ENTRY(request) tq; 757 TAILQ_ENTRY(request) tq;
758 }; 758 };
759 TAILQ_HEAD(reqhead, request) requests; 759 TAILQ_HEAD(reqhead, request) requests;
760 struct request *req; 760 struct request *req;
@@ -820,7 +820,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
820 820
821 /* Send some more requests */ 821 /* Send some more requests */
822 while (num_req < max_req) { 822 while (num_req < max_req) {
823 debug3("Request range %llu -> %llu (%d/%d)", 823 debug3("Request range %llu -> %llu (%d/%d)",
824 (unsigned long long)offset, 824 (unsigned long long)offset,
825 (unsigned long long)offset + buflen - 1, 825 (unsigned long long)offset + buflen - 1,
826 num_req, max_req); 826 num_req, max_req);
@@ -831,7 +831,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
831 offset += buflen; 831 offset += buflen;
832 num_req++; 832 num_req++;
833 TAILQ_INSERT_TAIL(&requests, req, tq); 833 TAILQ_INSERT_TAIL(&requests, req, tq);
834 send_read_request(conn->fd_out, req->id, req->offset, 834 send_read_request(conn->fd_out, req->id, req->offset,
835 req->len, handle, handle_len); 835 req->len, handle, handle_len);
836 } 836 }
837 837
@@ -862,7 +862,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
862 case SSH2_FXP_DATA: 862 case SSH2_FXP_DATA:
863 data = buffer_get_string(&msg, &len); 863 data = buffer_get_string(&msg, &len);
864 debug3("Received data %llu -> %llu", 864 debug3("Received data %llu -> %llu",
865 (unsigned long long)req->offset, 865 (unsigned long long)req->offset,
866 (unsigned long long)req->offset + len - 1); 866 (unsigned long long)req->offset + len - 1);
867 if (len > req->len) 867 if (len > req->len)
868 fatal("Received more data than asked for " 868 fatal("Received more data than asked for "
@@ -884,13 +884,13 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
884 /* Resend the request for the missing data */ 884 /* Resend the request for the missing data */
885 debug3("Short data block, re-requesting " 885 debug3("Short data block, re-requesting "
886 "%llu -> %llu (%2d)", 886 "%llu -> %llu (%2d)",
887 (unsigned long long)req->offset + len, 887 (unsigned long long)req->offset + len,
888 (unsigned long long)req->offset + 888 (unsigned long long)req->offset +
889 req->len - 1, num_req); 889 req->len - 1, num_req);
890 req->id = conn->msg_id++; 890 req->id = conn->msg_id++;
891 req->len -= len; 891 req->len -= len;
892 req->offset += len; 892 req->offset += len;
893 send_read_request(conn->fd_out, req->id, 893 send_read_request(conn->fd_out, req->id,
894 req->offset, req->len, handle, handle_len); 894 req->offset, req->len, handle, handle_len);
895 /* Reduce the request size */ 895 /* Reduce the request size */
896 if (len < buflen) 896 if (len < buflen)
@@ -921,7 +921,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
921 fatal("Transfer complete, but requests still in queue"); 921 fatal("Transfer complete, but requests still in queue");
922 922
923 if (read_error) { 923 if (read_error) {
924 error("Couldn't read from remote file \"%s\" : %s", 924 error("Couldn't read from remote file \"%s\" : %s",
925 remote_path, fx2txt(status)); 925 remote_path, fx2txt(status));
926 do_close(conn, handle, handle_len); 926 do_close(conn, handle, handle_len);
927 } else if (write_error) { 927 } else if (write_error) {
@@ -974,7 +974,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
974 u_int id; 974 u_int id;
975 u_int len; 975 u_int len;
976 u_int64_t offset; 976 u_int64_t offset;
977 TAILQ_ENTRY(outstanding_ack) tq; 977 TAILQ_ENTRY(outstanding_ack) tq;
978 }; 978 };
979 TAILQ_HEAD(ackhead, outstanding_ack) acks; 979 TAILQ_HEAD(ackhead, outstanding_ack) acks;
980 struct outstanding_ack *ack; 980 struct outstanding_ack *ack;
@@ -1063,7 +1063,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1063 if (ack == NULL) 1063 if (ack == NULL)
1064 fatal("Unexpected ACK %u", id); 1064 fatal("Unexpected ACK %u", id);
1065 1065
1066 if (id == startid || len == 0 || 1066 if (id == startid || len == 0 ||
1067 id - ackid >= conn->num_requests) { 1067 id - ackid >= conn->num_requests) {
1068 buffer_clear(&msg); 1068 buffer_clear(&msg);
1069 get_msg(conn->fd_in, &msg); 1069 get_msg(conn->fd_in, &msg);
@@ -1093,7 +1093,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1093 close(local_fd); 1093 close(local_fd);
1094 goto done; 1094 goto done;
1095 } 1095 }
1096 debug3("In write loop, ack for %u %d bytes at %llu", 1096 debug3("In write loop, ack for %u %d bytes at %llu",
1097 ack->id, ack->len, (unsigned long long)ack->offset); 1097 ack->id, ack->len, (unsigned long long)ack->offset);
1098 ++ackid; 1098 ++ackid;
1099 free(ack); 1099 free(ack);