mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
sftpserver: Remove some needless parts
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -216,10 +216,7 @@ static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};
|
|||||||
#endif /* HAVE_ARGP_H */
|
#endif /* HAVE_ARGP_H */
|
||||||
|
|
||||||
/* A userdata struct for channel. */
|
/* A userdata struct for channel. */
|
||||||
struct channel_data_struct
|
struct channel_data_struct {
|
||||||
{
|
|
||||||
/* Event which is used to poll the above descriptors. */
|
|
||||||
ssh_event event;
|
|
||||||
sftp_session sftp;
|
sftp_session sftp;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -384,14 +381,6 @@ static void handle_session(ssh_event event, ssh_session session)
|
|||||||
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
||||||
ssh_channel_close(sdata.channel);
|
ssh_channel_close(sdata.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If child process's stdout/stderr has been registered with the event,
|
|
||||||
* or the child process hasn't started yet, continue. */
|
|
||||||
if (cdata.event != NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* FIXME The server keeps hanging in the poll above when the client
|
|
||||||
* closes the channel */
|
|
||||||
} while (ssh_channel_is_open(sdata.channel));
|
} while (ssh_channel_is_open(sdata.channel));
|
||||||
|
|
||||||
ssh_channel_send_eof(sdata.channel);
|
ssh_channel_send_eof(sdata.channel);
|
||||||
|
|||||||
@@ -239,19 +239,9 @@ void sftp_handle_session_cb(ssh_event event,
|
|||||||
int n;
|
int n;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
/* Structure for storing the pty size. */
|
|
||||||
struct winsize wsize = {
|
|
||||||
.ws_row = 0,
|
|
||||||
.ws_col = 0,
|
|
||||||
.ws_xpixel = 0,
|
|
||||||
.ws_ypixel = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Our struct holding information about the channel. */
|
/* Our struct holding information about the channel. */
|
||||||
struct channel_data_st cdata = {
|
struct channel_data_st cdata = {
|
||||||
.event = NULL,
|
.sftp = NULL,
|
||||||
.winsize = &wsize,
|
|
||||||
.sftp = NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Our struct holding information about the session. */
|
/* Our struct holding information about the session. */
|
||||||
@@ -260,7 +250,7 @@ void sftp_handle_session_cb(ssh_event event,
|
|||||||
.auth_attempts = 0,
|
.auth_attempts = 0,
|
||||||
.authenticated = 0,
|
.authenticated = 0,
|
||||||
.username = SSHD_DEFAULT_USER,
|
.username = SSHD_DEFAULT_USER,
|
||||||
.password = SSHD_DEFAULT_PASSWORD
|
.password = SSHD_DEFAULT_PASSWORD,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_channel_callbacks_struct *channel_cb = NULL;
|
struct ssh_channel_callbacks_struct *channel_cb = NULL;
|
||||||
@@ -371,13 +361,6 @@ void sftp_handle_session_cb(ssh_event event,
|
|||||||
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
||||||
ssh_channel_close(sdata.channel);
|
ssh_channel_close(sdata.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If child process's stdout/stderr has been registered with the event,
|
|
||||||
* or the child process hasn't started yet, continue. */
|
|
||||||
if (cdata.event != NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (ssh_channel_is_open(sdata.channel));
|
} while (ssh_channel_is_open(sdata.channel));
|
||||||
|
|
||||||
ssh_channel_send_eof(sdata.channel);
|
ssh_channel_send_eof(sdata.channel);
|
||||||
|
|||||||
Reference in New Issue
Block a user