version 1.96, 2013/01/04 19:26:38 |
version 1.97, 2013/05/17 00:13:14 |
|
|
|
|
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; |
|
|
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; |
} |
} |
|
|
|
|
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 |
|
|
} |
} |
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 |
|
|
} |
} |
} |
} |
send_status(id, status); |
send_status(id, status); |
xfree(data); |
free(data); |
} |
} |
|
|
static void |
static void |
|
|
} |
} |
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 |
|
|
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 |
|
|
} |
} |
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 |
|
|
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); |
} |
} |
} |
} |
|
|
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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); |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 */ |