diff --git a/apps/wolfsshd/auth.c b/apps/wolfsshd/auth.c index e5eca2308..608346a48 100644 --- a/apps/wolfsshd/auth.c +++ b/apps/wolfsshd/auth.c @@ -894,16 +894,10 @@ int wolfSSHD_OpenSecureFile(const char* path, WUID_T ownerUid, #endif } -#if defined(WOLFSSHD_UNIT_TEST) && !defined(_WIN32) -int SearchForPubKey(const char* path, const char* authKeysFile, - const WS_UserAuthData_PublicKey* pubKeyCtx, - WUID_T uid, int strictModes) -#else -static int SearchForPubKey(const char* path, const char* authKeysFile, - const char* user, - const WS_UserAuthData_PublicKey* pubKeyCtx, - WUID_T uid, int strictModes) -#endif +WOLFSSHD_STATIC int SearchForPubKey(const char* path, + const char* authKeysFile, const char* user, + const WS_UserAuthData_PublicKey* pubKeyCtx, + WUID_T uid, int strictModes) { int ret = WSSHD_AUTH_SUCCESS; char authKeysPath[MAX_PATH_SZ]; diff --git a/apps/wolfsshd/auth.h b/apps/wolfsshd/auth.h index 2159c9230..58275f619 100644 --- a/apps/wolfsshd/auth.h +++ b/apps/wolfsshd/auth.h @@ -106,6 +106,7 @@ int wolfSSHD_GetUserGroupNames(void* heap, const char* usr, WGID_T primaryGid, char*** outNames, word32* outCount); void wolfSSHD_FreeUserGroupNames(void* heap, char** names, word32 count); int SearchForPubKey(const char* path, const char* authKeysFile, + const char* user, const WS_UserAuthData_PublicKey* pubKeyCtx, WUID_T uid, int strictModes); #endif diff --git a/apps/wolfsshd/test/test_configuration.c b/apps/wolfsshd/test/test_configuration.c index 4a519dc72..5ccfcf966 100644 --- a/apps/wolfsshd/test/test_configuration.c +++ b/apps/wolfsshd/test/test_configuration.c @@ -1481,7 +1481,7 @@ static int test_SearchForPubKey(void) if (ret == WS_SUCCESS) { Log(" Testing scenario: authorized key is accepted."); pubKeyCtx.publicKey = keyA; - rc = SearchForPubKey(base, keysPath, &pubKeyCtx, uid, 0); + rc = SearchForPubKey(base, keysPath, "testuser", &pubKeyCtx, uid, 0); if (rc == WSSHD_AUTH_SUCCESS) { Log(" PASSED.\n"); } @@ -1496,7 +1496,7 @@ static int test_SearchForPubKey(void) if (ret == WS_SUCCESS) { Log(" Testing scenario: authorized key accepted under StrictModes."); pubKeyCtx.publicKey = keyA; - rc = SearchForPubKey(base, keysPath, &pubKeyCtx, uid, 1); + rc = SearchForPubKey(base, keysPath, "testuser", &pubKeyCtx, uid, 1); if (rc == WSSHD_AUTH_SUCCESS) { Log(" PASSED.\n"); } @@ -1509,7 +1509,7 @@ static int test_SearchForPubKey(void) if (ret == WS_SUCCESS) { Log(" Testing scenario: unauthorized key is rejected."); pubKeyCtx.publicKey = keyB; - rc = SearchForPubKey(base, keysPath, &pubKeyCtx, uid, 0); + rc = SearchForPubKey(base, keysPath, "testuser", &pubKeyCtx, uid, 0); if (rc == WSSHD_AUTH_FAILURE) { Log(" PASSED.\n"); } @@ -1523,7 +1523,7 @@ static int test_SearchForPubKey(void) if (ret == WS_SUCCESS) { Log(" Testing scenario: missing keys file returns an error."); pubKeyCtx.publicKey = keyA; - rc = SearchForPubKey(base, missPath, &pubKeyCtx, uid, 0); + rc = SearchForPubKey(base, missPath, "testuser", &pubKeyCtx, uid, 0); if (rc < 0) { Log(" PASSED.\n"); }