From c81fcbca39f8f154f2d0a94b391203cc8aa52093 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Tue, 24 May 2022 17:05:53 -0600 Subject: [PATCH] initial autotools sshd addition --- .gitignore | 3 +++ Makefile.am | 1 + apps/include.am | 13 +++++++++++++ apps/wolfsshd.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 9 +++++++++ 5 files changed, 73 insertions(+) create mode 100644 apps/include.am create mode 100644 apps/wolfsshd.c diff --git a/.gitignore b/.gitignore index cad67e11..6a688fca 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,9 @@ examples/portfwd/portfwd examples/sftpclient/wolfsftp examples/scpclient/wolfscp +# applications +apps/wolfsshd + # test output tests/*.test *.trs diff --git a/Makefile.am b/Makefile.am index 51838c46..f03df800 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,6 +33,7 @@ EXTRA_DIST+= LICENSING README.md ChangeLog.md include src/include.am include wolfssh/include.am +include apps/include.am include examples/include.am include tests/include.am include keys/include.am diff --git a/apps/include.am b/apps/include.am new file mode 100644 index 00000000..437139c1 --- /dev/null +++ b/apps/include.am @@ -0,0 +1,13 @@ +# vim:ft=automake +# All paths should be given relative to the root + +if BUILD_SSHD +bin_PROGRAMS += apps/wolfsshd +noinst_HEADERS += examples/client/client.h +apps_wolfsshd_SOURCES = apps/wolfsshd.c +apps_wolfsshd_LDADD = src/libwolfssh.la +apps_wolfsshd_DEPENDENCIES = src/libwolfssh.la +endif + +DISTCLEANFILES+= apps/.libs/wolfsshd + diff --git a/apps/wolfsshd.c b/apps/wolfsshd.c new file mode 100644 index 00000000..c97ed940 --- /dev/null +++ b/apps/wolfsshd.c @@ -0,0 +1,47 @@ +/* wolfsshd.c + * + * Copyright (C) 2014-2021 wolfSSL Inc. + * + * This file is part of wolfSSH. + * + * wolfSSH is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with wolfSSH. If not, see . + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#ifdef WOLFSSH_SSHD + +#include +#include +#include +#include +#include + +#ifdef NO_INLINE + #include +#else + #define WOLFSSH_MISC_INCLUDED + #include "src/misc.c" +#endif + +int main(int argc, char** argv) +{ + (void)argc; + (void)argv; + printf("wolfSSH SSHD application\n"); + return 0; +} +#endif /* WOLFSSH_SSHD */ diff --git a/configure.ac b/configure.ac index 88ecbe93..071585d9 100644 --- a/configure.ac +++ b/configure.ac @@ -171,6 +171,11 @@ AC_ARG_ENABLE([sftp], [AS_HELP_STRING([--enable-sftp],[Enable SFTP support (default: disabled)])], [ENABLED_SFTP=$enableval],[ENABLED_SFTP=no]) +# SSHD +AC_ARG_ENABLE([sshd], + [AS_HELP_STRING([--enable-sshd],[Enable SSHD support (default: disabled)])], + [ENABLED_SSHD=$enableval],[ENABLED_SSHD=no]) + # TCP/IP Forwarding AC_ARG_ENABLE([fwd], [AS_HELP_STRING([--enable-fwd],[Enable TCP/IP Forwarding support (default: disabled)])], @@ -230,6 +235,8 @@ AS_IF([test "x$ENABLED_SHELL" = "xyes"], AS_IF([test "x$ENABLED_AGENT" = "xyes"],[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_AGENT"]) AS_IF([test "x$ENABLED_SMALLSTACK" = "xyes"], [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SMALL_STACK"]) +AS_IF([test "x$ENABLED_SSHD" = "xyes"], + [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SSHD"]) # Set the automake conditionals. AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS],[test "x$ENABLED_EXAMPLES" = "xyes"]) @@ -242,6 +249,7 @@ AM_CONDITIONAL([BUILD_FWD],[test "x$ENABLED_FWD" = "xyes"]) AM_CONDITIONAL([BUILD_TERM],[test "x$ENABLED_TERM" = "xyes"]) AM_CONDITIONAL([BUILD_SHELL],[test "x$ENABLED_SHELL" = "xyes"]) AM_CONDITIONAL([BUILD_AGENT],[test "x$ENABLED_AGENT" = "xyes"]) +AM_CONDITIONAL([BUILD_SSHD],[test "x$ENABLED_SSHD" = "xyes"]) AX_HARDEN_CC_COMPILER_FLAGS @@ -282,6 +290,7 @@ AS_ECHO([" * psuedo-terminal: $ENABLED_PTERM"]) AS_ECHO([" * echoserver shell support: $ENABLED_SHELL"]) AS_ECHO([" * scp: $ENABLED_SCP"]) AS_ECHO([" * sftp: $ENABLED_SFTP"]) +AS_ECHO([" * sshd: $ENABLED_SSHD"]) AS_ECHO([" * agent: $ENABLED_AGENT"]) AS_ECHO([" * TCP/IP Forwarding: $ENABLED_FWD"]) AS_ECHO([" * Examples: $ENABLED_EXAMPLES"])