version 1.10, 2001/01/10 22:56:22 |
version 1.11, 2001/01/15 21:45:29 |
|
|
stats[count].long_name = ls_file(dp->d_name, &st); |
stats[count].long_name = ls_file(dp->d_name, &st); |
count++; |
count++; |
/* send up to 100 entries in one message */ |
/* send up to 100 entries in one message */ |
|
/* XXX check packet size instead */ |
if (count == 100) |
if (count == 100) |
break; |
break; |
} |
} |
|
|
process_rename(void) |
process_rename(void) |
{ |
{ |
u_int32_t id; |
u_int32_t id; |
|
struct stat st; |
char *oldpath, *newpath; |
char *oldpath, *newpath; |
int ret, status; |
int ret, status = SSH2_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); |
/* fail if 'newpath' exists */ |
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
if (stat(newpath, &st) == -1) { |
|
ret = rename(oldpath, newpath); |
|
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
|
} |
send_status(id, status); |
send_status(id, status); |
xfree(oldpath); |
xfree(oldpath); |
xfree(newpath); |
xfree(newpath); |
|
|
|
|
handle_init(); |
handle_init(); |
|
|
|
#ifdef DEBUG_SFTP_SERVER |
log_init("sftp-server", SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 0); |
log_init("sftp-server", SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 0); |
|
#endif |
|
|
in = dup(STDIN_FILENO); |
in = dup(STDIN_FILENO); |
out = dup(STDOUT_FILENO); |
out = dup(STDOUT_FILENO); |