Skip to content

Commit

Permalink
fix bash test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tgauth committed Aug 16, 2024
1 parent 8e7aee9 commit 9215a12
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 9 additions & 3 deletions regress/sftp-cmds.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 \
Expand Down
6 changes: 5 additions & 1 deletion servconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions sshd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
}

Expand Down

0 comments on commit 9215a12

Please sign in to comment.