Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions apps/wolfsshd/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions apps/wolfsshd/auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions apps/wolfsshd/test/test_configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand All @@ -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");
}
Expand All @@ -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");
}
Expand Down
Loading