[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.96 and 1.97

version 1.96, 2013/01/04 19:26:38 version 1.97, 2013/05/17 00:13:14
Line 310 
Line 310 
   
         if (handle_is_ok(handle, HANDLE_FILE)) {          if (handle_is_ok(handle, HANDLE_FILE)) {
                 ret = close(handles[handle].fd);                  ret = close(handles[handle].fd);
                 xfree(handles[handle].name);                  free(handles[handle].name);
                 handle_unused(handle);                  handle_unused(handle);
         } else if (handle_is_ok(handle, HANDLE_DIR)) {          } else if (handle_is_ok(handle, HANDLE_DIR)) {
                 ret = closedir(handles[handle].dirp);                  ret = closedir(handles[handle].dirp);
                 xfree(handles[handle].name);                  free(handles[handle].name);
                 handle_unused(handle);                  handle_unused(handle);
         } else {          } else {
                 errno = ENOENT;                  errno = ENOENT;
Line 358 
Line 358 
         handle = get_string(&hlen);          handle = get_string(&hlen);
         if (hlen < 256)          if (hlen < 256)
                 val = handle_from_string(handle, hlen);                  val = handle_from_string(handle, hlen);
         xfree(handle);          free(handle);
         return val;          return val;
 }  }
   
Line 441 
Line 441 
         handle_to_string(handle, &string, &hlen);          handle_to_string(handle, &string, &hlen);
         debug("request %u: sent handle handle %d", id, handle);          debug("request %u: sent handle handle %d", id, handle);
         send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen);          send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen);
         xfree(string);          free(string);
 }  }
   
 static void  static void
Line 569 
Line 569 
         }          }
         if (status != SSH2_FX_OK)          if (status != SSH2_FX_OK)
                 send_status(id, status);                  send_status(id, status);
         xfree(name);          free(name);
 }  }
   
 static void  static void
Line 670 
Line 670 
                 }                  }
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(data);          free(data);
 }  }
   
 static void  static void
Line 696 
Line 696 
         }          }
         if (status != SSH2_FX_OK)          if (status != SSH2_FX_OK)
                 send_status(id, status);                  send_status(id, status);
         xfree(name);          free(name);
 }  }
   
 static void  static void
Line 798 
Line 798 
                         status = errno_to_portable(errno);                          status = errno_to_portable(errno);
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(name);          free(name);
 }  }
   
 static void  static void
Line 883 
Line 883 
         }          }
         if (status != SSH2_FX_OK)          if (status != SSH2_FX_OK)
                 send_status(id, status);                  send_status(id, status);
         xfree(path);          free(path);
 }  }
   
 static void  static void
Line 932 
Line 932 
                 if (count > 0) {                  if (count > 0) {
                         send_names(id, count, stats);                          send_names(id, count, stats);
                         for (i = 0; i < count; i++) {                          for (i = 0; i < count; i++) {
                                 xfree(stats[i].name);                                  free(stats[i].name);
                                 xfree(stats[i].long_name);                                  free(stats[i].long_name);
                         }                          }
                 } else {                  } else {
                         send_status(id, SSH2_FX_EOF);                          send_status(id, SSH2_FX_EOF);
                 }                  }
                 xfree(stats);                  free(stats);
         }          }
 }  }
   
Line 961 
Line 961 
                 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;                  status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(name);          free(name);
 }  }
   
 static void  static void
Line 986 
Line 986 
                 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;                  status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(name);          free(name);
 }  }
   
 static void  static void
Line 1007 
Line 1007 
                 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;                  status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(name);          free(name);
 }  }
   
 static void  static void
Line 1020 
Line 1020 
         id = get_int();          id = get_int();
         path = get_string(NULL);          path = get_string(NULL);
         if (path[0] == '\0') {          if (path[0] == '\0') {
                 xfree(path);                  free(path);
                 path = xstrdup(".");                  path = xstrdup(".");
         }          }
         debug3("request %u: realpath", id);          debug3("request %u: realpath", id);
Line 1033 
Line 1033 
                 s.name = s.long_name = resolvedname;                  s.name = s.long_name = resolvedname;
                 send_names(id, 1, &s);                  send_names(id, 1, &s);
         }          }
         xfree(path);          free(path);
 }  }
   
 static void  static void
Line 1087 
Line 1087 
                         status = SSH2_FX_OK;                          status = SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(oldpath);          free(oldpath);
         xfree(newpath);          free(newpath);
 }  }
   
 static void  static void
Line 1113 
Line 1113 
                 s.name = s.long_name = buf;                  s.name = s.long_name = buf;
                 send_names(id, 1, &s);                  send_names(id, 1, &s);
         }          }
         xfree(path);          free(path);
 }  }
   
 static void  static void
Line 1136 
Line 1136 
                 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;                  status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(oldpath);          free(oldpath);
         xfree(newpath);          free(newpath);
 }  }
   
 static void  static void
Line 1157 
Line 1157 
                 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;                  status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(oldpath);          free(oldpath);
         xfree(newpath);          free(newpath);
 }  }
   
 static void  static void
Line 1175 
Line 1175 
                 send_status(id, errno_to_portable(errno));                  send_status(id, errno_to_portable(errno));
         else          else
                 send_statvfs(id, &st);                  send_statvfs(id, &st);
         xfree(path);          free(path);
 }  }
   
 static void  static void
Line 1214 
Line 1214 
                 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;                  status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
         }          }
         send_status(id, status);          send_status(id, status);
         xfree(oldpath);          free(oldpath);
         xfree(newpath);          free(newpath);
 }  }
   
 static void  static void
Line 1236 
Line 1236 
                 process_extended_hardlink(id);                  process_extended_hardlink(id);
         else          else
                 send_status(id, SSH2_FX_OP_UNSUPPORTED);        /* MUST */                  send_status(id, SSH2_FX_OP_UNSUPPORTED);        /* MUST */
         xfree(request);          free(request);
 }  }
   
 /* stolen from ssh-agent */  /* stolen from ssh-agent */

Legend:
Removed from v.1.96  
changed lines
  Added in v.1.97