fix bash test failures

This commit is contained in:
Tess Gauthier 2024-08-15 15:59:46 -04:00
parent 8e7aee937a
commit 9215a127ba
3 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: sftp-cmds.sh,v 1.20 2024/07/01 03:10:19 djm Exp $
# Placed in the Public Domain.
# XXX - TODO:
# XXX - TODO:
# - chmod / chown / chgrp
# - -p flag for get & put
@ -45,8 +45,14 @@ echo "ls ${OBJ}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
# XXX always successful
verbose "$tid: shell"
echo "!echo hi there" | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
egrep '^hi there$' >/dev/null || fail "shell failed"
if [ "$os" == "windows" ]; then
# Windows output has additional text so change grep check to be less strict
echo "!echo hi there" | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
grep -E 'hi there' >/dev/null || fail "shell failed"
else
echo "!echo hi there" | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
grep -E '^hi there$' >/dev/null || fail "shell failed"
fi
verbose "$tid: pwd"
echo "pwd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \

View File

@ -494,7 +494,11 @@ fill_default_server_options(ServerOptions *options)
if (options->unused_connection_timeout == -1)
options->unused_connection_timeout = 0;
if (options->sshd_session_path == NULL)
#ifdef WINDOWS
options->sshd_session_path = derelativise_path(_PATH_SSHD_SESSION);
#else
options->sshd_session_path = xstrdup(_PATH_SSHD_SESSION);
#endif /* WINDOWS */
assemble_algorithms(options);
@ -3062,7 +3066,7 @@ parse_server_config(ServerOptions *options, const char *filename,
if (!reexec)
process_queued_listen_addrs(options);
#ifdef WINDOWS
#ifdef WINDOWS
/* TODO - Refactor this into a platform specific post-read config processing routine.
* TODO - support all forms of username, groupname.
* a) domain\groupname

6
sshd.c
View File

@ -1154,8 +1154,8 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s,
posix_spawnattr_setpgroup(&attributes, 0) != 0)
error("posix_spawn initialization failed");
else {
pid_t pid;
if (posix_spawn(&pid, rexec_argv[0], &actions, &attributes, rexec_argv, NULL) != 0)
child = child_register(startup_p[0], *newsock);
if (posix_spawn(&child->pid, rexec_argv[0], &actions, &attributes, rexec_argv, NULL) != 0)
error("%s, posix_spawn failed", __func__);
posix_spawn_file_actions_destroy(&actions);
posix_spawnattr_destroy(&attributes);
@ -1922,7 +1922,7 @@ main(int ac, char **av)
send_rexec_state(config_s[0], cfg);
close(config_s[0]);
close(newsock);
cleanup_exit(0);
cleanup_exit(255);
#endif /* FORK_NOT_SUPPORTED */
}