mirror of
http://galexander.org/git/simplesshd.git
synced 2025-02-28 23:12:07 +00:00
the patches necessary to make sftp-server build... mostly removing
etc.
This commit is contained in:
parent
53abe6d4e4
commit
baaf67f2be
@ -22,7 +22,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "log.h"
|
|
||||||
#include "ssherr.h"
|
#include "ssherr.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "log.h"
|
|
||||||
#include "ssherr.h"
|
#include "ssherr.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
27
openssh/config.h
Normal file
27
openssh/config.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define HAVE_U_INT 1
|
||||||
|
#define HAVE_INTXX_T 1
|
||||||
|
#define HAVE_U_INTXX_T 1
|
||||||
|
#define HAVE_UINTXX_T 1
|
||||||
|
#define HAVE_INTMAX_T 1
|
||||||
|
#define HAVE_UINTMAX_T 1
|
||||||
|
#define HAVE_U_CHAR 1
|
||||||
|
#define HAVE_SIZE_T 1
|
||||||
|
#define HAVE_SSIZE_T 1
|
||||||
|
#define HAVE_CLOCK_T 1
|
||||||
|
#define HAVE_SA_FAMILY_T 1
|
||||||
|
#define HAVE_PID_T 1
|
||||||
|
#define HAVE_MODE_T 1
|
||||||
|
#define GETPGRP_VOID 1
|
||||||
|
#define HAVE___func__ 1
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
#define HAVE_UTIMES 1
|
||||||
|
#define HAVE_STRUCT_TIMEVAL 1
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
#define HAVE_SNPRINTF 1
|
||||||
|
#define HAVE_SIG_ATOMIC_T 1
|
||||||
|
#define HAVE_MBLEN 1
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
#define error(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
|
||||||
|
#define fatal(fmt, ...) { fprintf(stderr, fmt, ##__VA_ARGS__); cleanup_exit(255); }
|
@ -22,6 +22,8 @@
|
|||||||
#define _GNU_SOURCE /* activate extra prototypes for glibc */
|
#define _GNU_SOURCE /* activate extra prototypes for glibc */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h> /* For CMSG_* */
|
#include <sys/socket.h> /* For CMSG_* */
|
||||||
|
|
||||||
@ -168,10 +170,6 @@
|
|||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
#include "platform.h"
|
|
||||||
#include "openbsd-compat/openbsd-compat.h"
|
#include "openbsd-compat/openbsd-compat.h"
|
||||||
#include "openbsd-compat/bsd-nextstep.h"
|
|
||||||
|
|
||||||
#include "entropy.h"
|
|
||||||
|
|
||||||
#endif /* INCLUDES_H */
|
#endif /* INCLUDES_H */
|
||||||
|
@ -58,8 +58,6 @@
|
|||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "log.h"
|
|
||||||
#include "ssh.h"
|
|
||||||
|
|
||||||
/* remove newline at end of string */
|
/* remove newline at end of string */
|
||||||
char *
|
char *
|
||||||
@ -358,23 +356,6 @@ convtime(const char *s)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns a standardized host+port identifier string.
|
|
||||||
* Caller must free returned string.
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
put_host_port(const char *host, u_short port)
|
|
||||||
{
|
|
||||||
char *hoststr;
|
|
||||||
|
|
||||||
if (port == 0 || port == SSH_DEFAULT_PORT)
|
|
||||||
return(xstrdup(host));
|
|
||||||
if (asprintf(&hoststr, "[%s]:%d", host, (int)port) < 0)
|
|
||||||
fatal("put_host_port: asprintf: %s", strerror(errno));
|
|
||||||
debug3("put_host_port: %s", hoststr);
|
|
||||||
return hoststr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search for next delimiter between hostnames/addresses and ports.
|
* Search for next delimiter between hostnames/addresses and ports.
|
||||||
* Argument may be modified (for termination).
|
* Argument may be modified (for termination).
|
||||||
|
@ -59,7 +59,8 @@
|
|||||||
* getopt opterr optind optopt optreset optarg are all in defines.h which is
|
* getopt opterr optind optopt optreset optarg are all in defines.h which is
|
||||||
* pulled in by includes.h.
|
* pulled in by includes.h.
|
||||||
*/
|
*/
|
||||||
#define warnx logit
|
|
||||||
|
#define warnx(fmt,...) fprintf(stderr, fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
@ -70,8 +71,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
int opterr = 1; /* if error message should be printed */
|
int opterr = 1; /* if error message should be printed */
|
||||||
int optind = 1; /* index into parent argv vector */
|
int optind = 1; /* index into parent argv vector */
|
||||||
int optopt = '?'; /* character checked for validity */
|
int optopt = '?'; /* character checked for validity */
|
||||||
|
@ -35,16 +35,7 @@
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <stdio.h>
|
||||||
/* OpenBSD function replacements */
|
|
||||||
#include "base64.h"
|
|
||||||
#include "sigact.h"
|
|
||||||
#include "glob.h"
|
|
||||||
#include "readpassphrase.h"
|
|
||||||
#include "vis.h"
|
|
||||||
#include "getrrsetbyname.h"
|
|
||||||
#include "sha2.h"
|
|
||||||
#include "blf.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_BASENAME
|
#ifndef HAVE_BASENAME
|
||||||
char *basename(const char *path);
|
char *basename(const char *path);
|
||||||
@ -153,13 +144,6 @@ int BSDgetopt(int argc, char * const *argv, const char *opts);
|
|||||||
int writev(int, struct iovec *, int);
|
int writev(int, struct iovec *, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Home grown routines */
|
|
||||||
#include "bsd-misc.h"
|
|
||||||
#include "bsd-setres_id.h"
|
|
||||||
#include "bsd-statvfs.h"
|
|
||||||
#include "bsd-waitpid.h"
|
|
||||||
#include "bsd-poll.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_GETPEEREID
|
#ifndef HAVE_GETPEEREID
|
||||||
int getpeereid(int , uid_t *, gid_t *);
|
int getpeereid(int , uid_t *, gid_t *);
|
||||||
#endif
|
#endif
|
||||||
@ -254,20 +238,6 @@ void *xmmap(size_t size);
|
|||||||
char *xcrypt(const char *password, const char *salt);
|
char *xcrypt(const char *password, const char *salt);
|
||||||
char *shadow_pw(struct passwd *pw);
|
char *shadow_pw(struct passwd *pw);
|
||||||
|
|
||||||
/* rfc2553 socket API replacements */
|
|
||||||
#include "fake-rfc2553.h"
|
|
||||||
|
|
||||||
/* Routines for a single OS platform */
|
|
||||||
#include "bsd-cray.h"
|
|
||||||
#include "bsd-cygwin_util.h"
|
|
||||||
|
|
||||||
#include "port-aix.h"
|
|
||||||
#include "port-irix.h"
|
|
||||||
#include "port-linux.h"
|
|
||||||
#include "port-solaris.h"
|
|
||||||
#include "port-tun.h"
|
|
||||||
#include "port-uw.h"
|
|
||||||
|
|
||||||
/* _FORTIFY_SOURCE breaks FD_ISSET(n)/FD_SET(n) for n > FD_SETSIZE. Avoid. */
|
/* _FORTIFY_SOURCE breaks FD_ISSET(n)/FD_SET(n) for n > FD_SETSIZE. Avoid. */
|
||||||
#if defined(HAVE_FEATURES_H) && defined(_FORTIFY_SOURCE)
|
#if defined(HAVE_FEATURES_H) && defined(_FORTIFY_SOURCE)
|
||||||
# include <features.h>
|
# include <features.h>
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
#include "sftp.h"
|
#include "sftp.h"
|
||||||
#include "sftp-common.h"
|
#include "sftp-common.h"
|
||||||
@ -128,7 +127,6 @@ decode_attrib(Buffer *b)
|
|||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
type = buffer_get_string(b, NULL);
|
type = buffer_get_string(b, NULL);
|
||||||
data = buffer_get_string(b, NULL);
|
data = buffer_get_string(b, NULL);
|
||||||
debug3("Got file attribute \"%s\"", type);
|
|
||||||
free(type);
|
free(type);
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
#include "sftp.h"
|
#include "sftp.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -44,7 +46,6 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "uidswap.h"
|
|
||||||
|
|
||||||
#include "sftp.h"
|
#include "sftp.h"
|
||||||
#include "sftp-common.h"
|
#include "sftp-common.h"
|
||||||
@ -153,23 +154,19 @@ request_permitted(struct sftp_handler *h)
|
|||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
if (readonly && h->does_write) {
|
if (readonly && h->does_write) {
|
||||||
verbose("Refusing %s request in read-only mode", h->name);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (request_blacklist != NULL &&
|
if (request_blacklist != NULL &&
|
||||||
((result = match_list(h->name, request_blacklist, NULL))) != NULL) {
|
((result = match_list(h->name, request_blacklist, NULL))) != NULL) {
|
||||||
free(result);
|
free(result);
|
||||||
verbose("Refusing blacklisted %s request", h->name);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (request_whitelist != NULL &&
|
if (request_whitelist != NULL &&
|
||||||
((result = match_list(h->name, request_whitelist, NULL))) != NULL) {
|
((result = match_list(h->name, request_whitelist, NULL))) != NULL) {
|
||||||
free(result);
|
free(result);
|
||||||
debug2("Permitting whitelisted %s request", h->name);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (request_whitelist != NULL) {
|
if (request_whitelist != NULL) {
|
||||||
verbose("Refusing non-whitelisted %s request", h->name);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -486,7 +483,6 @@ send_status(u_int32_t id, u_int32_t status)
|
|||||||
{
|
{
|
||||||
Buffer msg;
|
Buffer msg;
|
||||||
|
|
||||||
debug3("request %u: sent status %u", id, status);
|
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, SSH2_FXP_STATUS);
|
buffer_put_char(&msg, SSH2_FXP_STATUS);
|
||||||
buffer_put_int(&msg, id);
|
buffer_put_int(&msg, id);
|
||||||
@ -514,7 +510,6 @@ send_data_or_handle(char type, u_int32_t id, const char *data, int dlen)
|
|||||||
static void
|
static void
|
||||||
send_data(u_int32_t id, const char *data, int dlen)
|
send_data(u_int32_t id, const char *data, int dlen)
|
||||||
{
|
{
|
||||||
debug("request %u: sent data len %d", id, dlen);
|
|
||||||
send_data_or_handle(SSH2_FXP_DATA, id, data, dlen);
|
send_data_or_handle(SSH2_FXP_DATA, id, data, dlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,7 +520,6 @@ send_handle(u_int32_t id, int handle)
|
|||||||
int hlen;
|
int hlen;
|
||||||
|
|
||||||
handle_to_string(handle, &string, &hlen);
|
handle_to_string(handle, &string, &hlen);
|
||||||
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);
|
||||||
free(string);
|
free(string);
|
||||||
}
|
}
|
||||||
@ -540,7 +534,6 @@ send_names(u_int32_t id, int count, const Stat *stats)
|
|||||||
buffer_put_char(&msg, SSH2_FXP_NAME);
|
buffer_put_char(&msg, SSH2_FXP_NAME);
|
||||||
buffer_put_int(&msg, id);
|
buffer_put_int(&msg, id);
|
||||||
buffer_put_int(&msg, count);
|
buffer_put_int(&msg, count);
|
||||||
debug("request %u: sent names count %d", id, count);
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
buffer_put_cstring(&msg, stats[i].name);
|
buffer_put_cstring(&msg, stats[i].name);
|
||||||
buffer_put_cstring(&msg, stats[i].long_name);
|
buffer_put_cstring(&msg, stats[i].long_name);
|
||||||
@ -555,7 +548,6 @@ send_attrib(u_int32_t id, const Attrib *a)
|
|||||||
{
|
{
|
||||||
Buffer msg;
|
Buffer msg;
|
||||||
|
|
||||||
debug("request %u: sent attrib have 0x%x", id, a->flags);
|
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, SSH2_FXP_ATTRS);
|
buffer_put_char(&msg, SSH2_FXP_ATTRS);
|
||||||
buffer_put_int(&msg, id);
|
buffer_put_int(&msg, id);
|
||||||
@ -573,7 +565,6 @@ process_init(void)
|
|||||||
Buffer msg;
|
Buffer msg;
|
||||||
|
|
||||||
version = get_int();
|
version = get_int();
|
||||||
verbose("received client version %u", version);
|
|
||||||
buffer_init(&msg);
|
buffer_init(&msg);
|
||||||
buffer_put_char(&msg, SSH2_FXP_VERSION);
|
buffer_put_char(&msg, SSH2_FXP_VERSION);
|
||||||
buffer_put_int(&msg, SSH2_FILEXFER_VERSION);
|
buffer_put_int(&msg, SSH2_FILEXFER_VERSION);
|
||||||
@ -600,14 +591,12 @@ process_open(u_int32_t id)
|
|||||||
|
|
||||||
name = get_string(NULL);
|
name = get_string(NULL);
|
||||||
pflags = get_int(); /* portable flags */
|
pflags = get_int(); /* portable flags */
|
||||||
debug3("request %u: open flags %d", id, pflags);
|
|
||||||
a = get_attrib();
|
a = get_attrib();
|
||||||
flags = flags_from_portable(pflags);
|
flags = flags_from_portable(pflags);
|
||||||
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666;
|
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666;
|
||||||
if (readonly &&
|
if (readonly &&
|
||||||
((flags & O_ACCMODE) == O_WRONLY ||
|
((flags & O_ACCMODE) == O_WRONLY ||
|
||||||
(flags & O_ACCMODE) == O_RDWR)) {
|
(flags & O_ACCMODE) == O_RDWR)) {
|
||||||
verbose("Refusing open request in read-only mode");
|
|
||||||
status = SSH2_FX_PERMISSION_DENIED;
|
status = SSH2_FX_PERMISSION_DENIED;
|
||||||
} else {
|
} else {
|
||||||
fd = open(name, flags, mode);
|
fd = open(name, flags, mode);
|
||||||
@ -634,7 +623,6 @@ process_close(u_int32_t id)
|
|||||||
int handle, ret, status = SSH2_FX_FAILURE;
|
int handle, ret, status = SSH2_FX_FAILURE;
|
||||||
|
|
||||||
handle = get_handle();
|
handle = get_handle();
|
||||||
debug3("request %u: close handle %u", id, handle);
|
|
||||||
ret = handle_close(handle);
|
ret = handle_close(handle);
|
||||||
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);
|
||||||
@ -652,11 +640,8 @@ process_read(u_int32_t id)
|
|||||||
off = get_int64();
|
off = get_int64();
|
||||||
len = get_int();
|
len = get_int();
|
||||||
|
|
||||||
debug("request %u: read \"%s\" (handle %d) off %llu len %d",
|
|
||||||
id, handle_to_name(handle), handle, (unsigned long long)off, len);
|
|
||||||
if (len > sizeof buf) {
|
if (len > sizeof buf) {
|
||||||
len = sizeof buf;
|
len = sizeof buf;
|
||||||
debug2("read change len %d", len);
|
|
||||||
}
|
}
|
||||||
fd = handle_to_fd(handle);
|
fd = handle_to_fd(handle);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
@ -692,8 +677,6 @@ process_write(u_int32_t id)
|
|||||||
off = get_int64();
|
off = get_int64();
|
||||||
data = get_string(&len);
|
data = get_string(&len);
|
||||||
|
|
||||||
debug("request %u: write \"%s\" (handle %d) off %llu len %d",
|
|
||||||
id, handle_to_name(handle), handle, (unsigned long long)off, len);
|
|
||||||
fd = handle_to_fd(handle);
|
fd = handle_to_fd(handle);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -713,7 +696,6 @@ process_write(u_int32_t id)
|
|||||||
status = SSH2_FX_OK;
|
status = SSH2_FX_OK;
|
||||||
handle_update_write(handle, ret);
|
handle_update_write(handle, ret);
|
||||||
} else {
|
} else {
|
||||||
debug2("nothing at all written");
|
|
||||||
status = SSH2_FX_FAILURE;
|
status = SSH2_FX_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,8 +713,6 @@ process_do_stat(u_int32_t id, int do_lstat)
|
|||||||
int ret, status = SSH2_FX_FAILURE;
|
int ret, status = SSH2_FX_FAILURE;
|
||||||
|
|
||||||
name = get_string(NULL);
|
name = get_string(NULL);
|
||||||
debug3("request %u: %sstat", id, do_lstat ? "l" : "");
|
|
||||||
verbose("%sstat name \"%s\"", do_lstat ? "l" : "", name);
|
|
||||||
ret = do_lstat ? lstat(name, &st) : stat(name, &st);
|
ret = do_lstat ? lstat(name, &st) : stat(name, &st);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
status = errno_to_portable(errno);
|
status = errno_to_portable(errno);
|
||||||
@ -766,8 +746,6 @@ process_fstat(u_int32_t id)
|
|||||||
int fd, ret, handle, status = SSH2_FX_FAILURE;
|
int fd, ret, handle, status = SSH2_FX_FAILURE;
|
||||||
|
|
||||||
handle = get_handle();
|
handle = get_handle();
|
||||||
debug("request %u: fstat \"%s\" (handle %u)",
|
|
||||||
id, handle_to_name(handle), handle);
|
|
||||||
fd = handle_to_fd(handle);
|
fd = handle_to_fd(handle);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
ret = fstat(fd, &st);
|
ret = fstat(fd, &st);
|
||||||
@ -804,7 +782,6 @@ process_setstat(u_int32_t id)
|
|||||||
|
|
||||||
name = get_string(NULL);
|
name = get_string(NULL);
|
||||||
a = get_attrib();
|
a = get_attrib();
|
||||||
debug("request %u: setstat name \"%s\"", id, name);
|
|
||||||
if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
|
if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
|
||||||
ret = truncate(name, a->size);
|
ret = truncate(name, a->size);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
@ -843,7 +820,6 @@ process_fsetstat(u_int32_t id)
|
|||||||
|
|
||||||
handle = get_handle();
|
handle = get_handle();
|
||||||
a = get_attrib();
|
a = get_attrib();
|
||||||
debug("request %u: fsetstat handle %d", id, handle);
|
|
||||||
fd = handle_to_fd(handle);
|
fd = handle_to_fd(handle);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
status = SSH2_FX_FAILURE;
|
status = SSH2_FX_FAILURE;
|
||||||
@ -921,8 +897,6 @@ process_readdir(u_int32_t id)
|
|||||||
int handle;
|
int handle;
|
||||||
|
|
||||||
handle = get_handle();
|
handle = get_handle();
|
||||||
debug("request %u: readdir \"%s\" (handle %d)", id,
|
|
||||||
handle_to_name(handle), handle);
|
|
||||||
dirp = handle_to_dir(handle);
|
dirp = handle_to_dir(handle);
|
||||||
path = handle_to_name(handle);
|
path = handle_to_name(handle);
|
||||||
if (dirp == NULL || path == NULL) {
|
if (dirp == NULL || path == NULL) {
|
||||||
@ -1021,8 +995,6 @@ process_realpath(u_int32_t id)
|
|||||||
free(path);
|
free(path);
|
||||||
path = xstrdup(".");
|
path = xstrdup(".");
|
||||||
}
|
}
|
||||||
debug3("request %u: realpath", id);
|
|
||||||
verbose("realpath \"%s\"", path);
|
|
||||||
if (realpath(path, resolvedname) == NULL) {
|
if (realpath(path, resolvedname) == NULL) {
|
||||||
send_status(id, errno_to_portable(errno));
|
send_status(id, errno_to_portable(errno));
|
||||||
} else {
|
} else {
|
||||||
@ -1098,8 +1070,6 @@ process_readlink(u_int32_t id)
|
|||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
path = get_string(NULL);
|
path = get_string(NULL);
|
||||||
debug3("request %u: readlink", id);
|
|
||||||
verbose("readlink \"%s\"", path);
|
|
||||||
if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1)
|
if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1)
|
||||||
send_status(id, errno_to_portable(errno));
|
send_status(id, errno_to_portable(errno));
|
||||||
else {
|
else {
|
||||||
@ -1165,8 +1135,6 @@ process_extended_fsync(u_int32_t id)
|
|||||||
int handle, fd, ret, status = SSH2_FX_OP_UNSUPPORTED;
|
int handle, fd, ret, status = SSH2_FX_OP_UNSUPPORTED;
|
||||||
|
|
||||||
handle = get_handle();
|
handle = get_handle();
|
||||||
debug3("request %u: fsync (handle %u)", id, handle);
|
|
||||||
verbose("fsync \"%s\"", handle_to_name(handle));
|
|
||||||
if ((fd = handle_to_fd(handle)) < 0)
|
if ((fd = handle_to_fd(handle)) < 0)
|
||||||
status = SSH2_FX_NO_SUCH_FILE;
|
status = SSH2_FX_NO_SUCH_FILE;
|
||||||
else if (handle_is_ok(handle, HANDLE_FILE)) {
|
else if (handle_is_ok(handle, HANDLE_FILE)) {
|
||||||
@ -1336,9 +1304,6 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
|
|||||||
fatal("Invalid umask \"%s\"", optarg);
|
fatal("Invalid umask \"%s\"", optarg);
|
||||||
(void)umask((mode_t)mask);
|
(void)umask((mode_t)mask);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
default:
|
|
||||||
sftp_server_usage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1416,7 +1381,6 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
|
|||||||
if (FD_ISSET(in, rset)) {
|
if (FD_ISSET(in, rset)) {
|
||||||
len = read(in, buf, sizeof buf);
|
len = read(in, buf, sizeof buf);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
debug("read eof");
|
|
||||||
sftp_server_cleanup_exit(0);
|
sftp_server_cleanup_exit(0);
|
||||||
} else if (len < 0) {
|
} else if (len < 0) {
|
||||||
error("read: %s", strerror(errno));
|
error("read: %s", strerror(errno));
|
||||||
|
2444
openssh/sftp.c
2444
openssh/sftp.c
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
xmalloc(size_t size)
|
xmalloc(size_t size)
|
||||||
|
Loading…
Reference in New Issue
Block a user