From a51384fe4eadf7f892b3a4c426cd625408405bf9 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 8 Sep 2025 19:15:10 +0200 Subject: [PATCH] sftpserver: Remove some needless parts Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- examples/sample_sftpserver.c | 13 +------------ tests/server/test_server/sftpserver_cb.c | 21 ++------------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/examples/sample_sftpserver.c b/examples/sample_sftpserver.c index 3725aa55..d4b12eb3 100644 --- a/examples/sample_sftpserver.c +++ b/examples/sample_sftpserver.c @@ -216,10 +216,7 @@ static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL}; #endif /* HAVE_ARGP_H */ /* A userdata struct for channel. */ -struct channel_data_struct -{ - /* Event which is used to poll the above descriptors. */ - ssh_event event; +struct channel_data_struct { 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) { 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)); ssh_channel_send_eof(sdata.channel); diff --git a/tests/server/test_server/sftpserver_cb.c b/tests/server/test_server/sftpserver_cb.c index 6c58b262..7b66fb0a 100644 --- a/tests/server/test_server/sftpserver_cb.c +++ b/tests/server/test_server/sftpserver_cb.c @@ -239,19 +239,9 @@ void sftp_handle_session_cb(ssh_event event, int n; 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. */ struct channel_data_st cdata = { - .event = NULL, - .winsize = &wsize, - .sftp = NULL + .sftp = NULL, }; /* Our struct holding information about the session. */ @@ -260,7 +250,7 @@ void sftp_handle_session_cb(ssh_event event, .auth_attempts = 0, .authenticated = 0, .username = SSHD_DEFAULT_USER, - .password = SSHD_DEFAULT_PASSWORD + .password = SSHD_DEFAULT_PASSWORD, }; 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) { 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)); ssh_channel_send_eof(sdata.channel);