[BACK]Return to sftp-client.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/sftp-client.c between version 1.57 and 1.57.2.2

version 1.57, 2005/07/27 10:39:03 version 1.57.2.2, 2006/10/06 03:19:33
Line 1 
Line 1 
   /* $OpenBSD$ */
 /*  /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>   * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *   *
Line 19 
Line 20 
 /* XXX: remove all logging, only return status codes */  /* XXX: remove all logging, only return status codes */
 /* XXX: copy between two remote sites */  /* XXX: copy between two remote sites */
   
 #include "includes.h"  #include <sys/types.h>
 RCSID("$OpenBSD$");  
   
 #include <sys/queue.h>  #include <sys/queue.h>
   #include <sys/stat.h>
   #include <sys/time.h>
   #include <sys/param.h>
   #include <sys/uio.h>
   
 #include "buffer.h"  #include <errno.h>
 #include "bufaux.h"  #include <fcntl.h>
 #include "getput.h"  #include <signal.h>
   #include <stdio.h>
   #include <string.h>
   #include <unistd.h>
   #include <stdarg.h>
   
 #include "xmalloc.h"  #include "xmalloc.h"
   #include "buffer.h"
 #include "log.h"  #include "log.h"
 #include "atomicio.h"  #include "atomicio.h"
 #include "progressmeter.h"  #include "progressmeter.h"
   #include "misc.h"
   
 #include "sftp.h"  #include "sftp.h"
 #include "sftp-common.h"  #include "sftp-common.h"
Line 39 
Line 49 
 extern volatile sig_atomic_t interrupted;  extern volatile sig_atomic_t interrupted;
 extern int showprogress;  extern int showprogress;
   
 /* Minimum amount of data to read at at time */  /* Minimum amount of data to read at a time */
 #define MIN_READ_SIZE   512  #define MIN_READ_SIZE   512
   
 /* Maximum packet size */  
 #define MAX_MSG_LENGTH  (256 * 1024)  
   
 struct sftp_conn {  struct sftp_conn {
         int fd_in;          int fd_in;
         int fd_out;          int fd_out;
Line 58 
Line 65 
 send_msg(int fd, Buffer *m)  send_msg(int fd, Buffer *m)
 {  {
         u_char mlen[4];          u_char mlen[4];
           struct iovec iov[2];
   
         if (buffer_len(m) > MAX_MSG_LENGTH)          if (buffer_len(m) > SFTP_MAX_MSG_LENGTH)
                 fatal("Outbound message too long %u", buffer_len(m));                  fatal("Outbound message too long %u", buffer_len(m));
   
         /* Send length first */          /* Send length first */
         PUT_32BIT(mlen, buffer_len(m));          put_u32(mlen, buffer_len(m));
         if (atomicio(vwrite, fd, mlen, sizeof(mlen)) != sizeof(mlen))          iov[0].iov_base = mlen;
                 fatal("Couldn't send packet: %s", strerror(errno));          iov[0].iov_len = sizeof(mlen);
           iov[1].iov_base = buffer_ptr(m);
           iov[1].iov_len = buffer_len(m);
   
         if (atomicio(vwrite, fd, buffer_ptr(m), buffer_len(m)) != buffer_len(m))          if (atomiciov(writev, fd, iov, 2) != buffer_len(m) + sizeof(mlen))
                 fatal("Couldn't send packet: %s", strerror(errno));                  fatal("Couldn't send packet: %s", strerror(errno));
   
         buffer_clear(m);          buffer_clear(m);
Line 87 
Line 97 
         }          }
   
         msg_len = buffer_get_int(m);          msg_len = buffer_get_int(m);
         if (msg_len > MAX_MSG_LENGTH)          if (msg_len > SFTP_MAX_MSG_LENGTH)
                 fatal("Received message too long %u", msg_len);                  fatal("Received message too long %u", msg_len);
   
         buffer_append_space(m, msg_len);          buffer_append_space(m, msg_len);
Line 391 
Line 401 
                                 printf("%s\n", longname);                                  printf("%s\n", longname);
   
                         if (dir) {                          if (dir) {
                                 *dir = xrealloc(*dir, sizeof(**dir) *                                  *dir = xrealloc(*dir, ents + 2, sizeof(**dir));
                                     (ents + 2));  
                                 (*dir)[ents] = xmalloc(sizeof(***dir));                                  (*dir)[ents] = xmalloc(sizeof(***dir));
                                 (*dir)[ents]->filename = xstrdup(filename);                                  (*dir)[ents]->filename = xstrdup(filename);
                                 (*dir)[ents]->longname = xstrdup(longname);                                  (*dir)[ents]->longname = xstrdup(longname);

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.57.2.2