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

Diff for /src/usr.bin/ssh/sftp-server.c between version 1.1 and 1.2

version 1.1, 2000/08/31 21:52:23 version 1.2, 2000/09/01 22:29:32
Line 125 
Line 125 
 };  };
   
 int  int
 errno_to_portable(int errno)  errno_to_portable(int unixerrno)
 {  {
         int ret = 0;          int ret = 0;
         switch (errno) {          switch (unixerrno) {
         case 0:          case 0:
                 ret = SSH_FX_OK;                  ret = SSH_FX_OK;
                 break;                  break;
Line 198 
Line 198 
         if (a.flags & SSH_FXA_HAVE_SIZE) {          if (a.flags & SSH_FXA_HAVE_SIZE) {
                 a.size_high = get_int();                  a.size_high = get_int();
                 a.size_low = get_int();                  a.size_low = get_int();
                 a.size = a.size_high;                  a.size = (u_int64_t) a.size_high << 32 + a.size_low;
                 a.size <<= 32;  
                 a.size += a.size_low;  
         }          }
         if (a.flags & SSH_FXA_HAVE_UGID) {          if (a.flags & SSH_FXA_HAVE_UGID) {
                 a.uid = get_int();                  a.uid = get_int();
Line 245 
Line 243 
         a.flags = 0;          a.flags = 0;
         a.flags |= SSH_FXA_HAVE_SIZE;          a.flags |= SSH_FXA_HAVE_SIZE;
         a.size = st->st_size;          a.size = st->st_size;
         a.size_low = st->st_size;          a.size_low = a.size;
         a.size_high = st->st_size >> 32;          a.size_high = (u_int32_t) a.size >> 32;
         a.flags |= SSH_FXA_HAVE_UGID;          a.flags |= SSH_FXA_HAVE_UGID;
         a.uid = st->st_uid;          a.uid = st->st_uid;
         a.gid = st->st_gid;          a.gid = st->st_gid;
Line 483 
Line 481 
         int version = buffer_get_int(&iqueue);          int version = buffer_get_int(&iqueue);
   
         TRACE("client version %d", version);          TRACE("client version %d", version);
         if (version != SSH_FILEXFER_VERSION)  
                 exit(1);  
         buffer_init(&msg);          buffer_init(&msg);
         buffer_put_char(&msg, SSH_FXP_VERSION);          buffer_put_char(&msg, SSH_FXP_VERSION);
         buffer_put_int(&msg, SSH_FILEXFER_VERSION);          buffer_put_int(&msg, SSH_FILEXFER_VERSION);
Line 552 
Line 548 
         off_low = get_int();          off_low = get_int();
         len = get_int();          len = get_int();
   
         off = off_high;          off = (u_int64_t) off_high << 32 + off_low;
         off <<= 32;  
         off += off_low;  
         TRACE("read id %d handle %d off %qd len %d", id, handle, off, len);          TRACE("read id %d handle %d off %qd len %d", id, handle, off, len);
         if (len > sizeof buf) {          if (len > sizeof buf) {
                 len = sizeof buf;                  len = sizeof buf;
Line 596 
Line 590 
         off_low = get_int();          off_low = get_int();
         data = get_string(&len);          data = get_string(&len);
   
         off = off_high;          off = (u_int64_t) off_high << 32 + off_low;
         off <<= 32;  
         off += off_low;  
         TRACE("write id %d handle %d off %qd len %d", id, handle, off, len);          TRACE("write id %d handle %d off %qd len %d", id, handle, off, len);
         fd = handle_to_fd(handle);          fd = handle_to_fd(handle);
         if (fd >= 0) {          if (fd >= 0) {
Line 921 
Line 913 
 {  {
         u_int32_t id;          u_int32_t id;
         char *oldpath, *newpath;          char *oldpath, *newpath;
         int ret;          int ret, status;
         int status = SSH_FX_FAILURE;  
   
         id = get_int();          id = get_int();
         oldpath = get_string(NULL);          oldpath = get_string(NULL);
         newpath = get_string(NULL);          newpath = get_string(NULL);
         TRACE("rename id %d old %s new %s", id, oldpath, newpath);          TRACE("rename id %d old %s new %s", id, oldpath, newpath);
         ret = rename(oldpath, newpath);          ret = rename(oldpath, newpath);
         if (ret != -1)          status = (ret == -1) ? errno_to_portable(errno) : SSH_FX_OK;
                 status = SSH_FX_OK;  
         send_status(id, status);          send_status(id, status);
         xfree(oldpath);          xfree(oldpath);
         xfree(newpath);          xfree(newpath);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2