update copyright, wrap isspace, fix formating

pull/435/head
Jacob Barthelmeh 2022-08-16 13:28:06 -06:00
parent 387ac299b0
commit 5a1f42ba07
7 changed files with 23 additions and 66 deletions

View File

@ -1,6 +1,6 @@
/* auth.c
*
* Copyright (C) 2014-2021 wolfSSL Inc.
* Copyright (C) 2014-2022 wolfSSL Inc.
*
* This file is part of wolfSSH.
*
@ -601,7 +601,8 @@ static int RequestAuthentication(const char* usr, int type, const byte* data,
/* temporarily elevate permissions */
if (ret == WOLFSSH_USERAUTH_SUCCESS &&
wolfSSHD_AuthRaisePermissions(auth) != WS_SUCCESS) {
wolfSSH_Log(WS_LOG_ERROR, "[SSHD] Failure to raise permissions for auth");
wolfSSH_Log(WS_LOG_ERROR,
"[SSHD] Failure to raise permissions for auth");
ret = WOLFSSH_USERAUTH_FAILURE;
}

View File

@ -1,6 +1,6 @@
/* auth.h
*
* Copyright (C) 2014-2021 wolfSSL Inc.
* Copyright (C) 2014-2022 wolfSSL Inc.
*
* This file is part of wolfSSH.
*

View File

@ -1,6 +1,6 @@
/* configuration.c
*
* Copyright (C) 2014-2021 wolfSSL Inc.
* Copyright (C) 2014-2022 wolfSSL Inc.
*
* This file is part of wolfSSH.
*
@ -445,7 +445,7 @@ static int HandleInclude(WOLFSSHD_CONFIG *conf, const char *value)
/* Ignore trailing whitespace */
ptr = value + WSTRLEN(value) - 1;
while (ptr != value) {
if (!isspace(*ptr)) {
if (!WISSPACE(*ptr)) {
ptr--;
}
else {
@ -649,12 +649,12 @@ static int CountWhitespace(const char* in, int inSz, byte inv)
if (in != NULL) {
for (; i < inSz; ++i) {
if (inv) {
if (isspace(in[i])) {
if (WISSPACE(in[i])) {
break;
}
}
else {
if (!isspace(in[i])) {
if (!WISSPACE(in[i])) {
break;
}
}

View File

@ -1,6 +1,6 @@
/* configuration.h
*
* Copyright (C) 2014-2021 wolfSSL Inc.
* Copyright (C) 2014-2022 wolfSSL Inc.
*
* This file is part of wolfSSH.
*

View File

@ -1,6 +1,6 @@
/* wolfsshd.c
*
* Copyright (C) 2014-2021 wolfSSL Inc.
* Copyright (C) 2014-2022 wolfSSL Inc.
*
* This file is part of wolfSSH.
*
@ -143,7 +143,8 @@ static void ShowUsage(void)
{
printf("wolfsshd %s\n", LIBWOLFSSH_VERSION_STRING);
printf(" -? display this help and exit\n");
printf(" -f <file name> Configuration file to use, default is /etc/ssh/sshd_config\n");
printf(" -f <file name> Configuration file to use, default is "
"/etc/ssh/sshd_config\n");
printf(" -p <int> Port number to listen on\n");
printf(" -d Turn on debug mode\n");
printf(" -D Run in foreground (do not detach)\n");
@ -271,61 +272,7 @@ static int SetupCTX(WOLFSSHD_CONFIG* conf, WOLFSSH_CTX** ctx)
}
}
/* Load in host public key */
// {
// if (userPubKey) {
// byte* userBuf = NULL;
// word32 userBufSz = 0;
//
// /* get the files size */
// load_file(userPubKey, NULL, &userBufSz);
//
// /* create temp buffer and load in file */
// if (userBufSz == 0) {
// fprintf(stderr, "Couldn't find size of file %s.\n", userPubKey);
// WEXIT(EXIT_FAILURE);
// }
//
// userBuf = (byte*)WMALLOC(userBufSz, NULL, 0);
// if (userBuf == NULL) {
// fprintf(stderr, "WMALLOC failed\n");
// WEXIT(EXIT_FAILURE);
// }
// load_file(userPubKey, userBuf, &userBufSz);
// LoadPublicKeyBuffer(userBuf, userBufSz, &pwMapList);
// }
//
// bufSz = (word32)WSTRLEN(samplePasswordBuffer);
// WMEMCPY(keyLoadBuf, samplePasswordBuffer, bufSz);
// keyLoadBuf[bufSz] = 0;
// LoadPasswordBuffer(keyLoadBuf, bufSz, &pwMapList);
//
// if (userEcc) {
// #ifndef WOLFSSH_NO_ECC
// bufName = samplePublicKeyEccBuffer;
// #endif
// }
// else {
// #ifndef WOLFSSH_NO_RSA
// bufName = samplePublicKeyRsaBuffer;
// #endif
// }
// if (bufName != NULL) {
// bufSz = (word32)WSTRLEN(bufName);
// WMEMCPY(keyLoadBuf, bufName, bufSz);
// keyLoadBuf[bufSz] = 0;
// LoadPublicKeyBuffer(keyLoadBuf, bufSz, &pwMapList);
// }
//
// bufSz = (word32)WSTRLEN(sampleNoneBuffer);
// WMEMCPY(keyLoadBuf, sampleNoneBuffer, bufSz);
// keyLoadBuf[bufSz] = 0;
// LoadNoneBuffer(keyLoadBuf, bufSz, &pwMapList);
//
// #ifdef WOLFSSH_SMALL_STACK
// WFREE(keyLoadBuf, NULL, 0);
// #endif
// }
/* @TODO Load in host public key */
/* Set allowed connection type, i.e. public key / password */

View File

@ -223,7 +223,7 @@ AS_IF([test "x$ENABLED_DISTRO" = "xyes"],
AS_IF([test "x$ENABLED_ALL" = "xyes"],
[ENABLED_KEYGEN=yes; ENABLED_SCP=yes; ENABLED_SFTP=yes; ENABLED_FWD=yes; ENABLED_SHELL=yes; ENABLED_AGENT=yes; ENABLED_SSHD=yes])
AS_IF([test "x$ENABLED_SSHD" = "xyes"],
[ENABLED_SHELL=yes;])
[ENABLED_SHELL=yes])
# Set the defined flags for the code.
AS_IF([test "x$ENABLED_INLINE" = "xno"],

View File

@ -41,6 +41,15 @@ extern "C" {
/* This value needs to stay in sync with the actual value of DYNTYPE_STRING
* from internal.h. */
#ifdef WOLFSSH_SSHD
/* uses isspace (not always available from wolfSSL) */
#ifdef XISSPACE
#define WISSPACE XISSPACE
#else
#define WISSPACE isspace
#endif
#endif
/* setup memory handling */
#ifndef WMALLOC_USER
#ifdef WOLFSSL_USER_SETTINGS