mirror of https://github.com/wolfSSL/wolfssh.git
Dead Code Removal
1. In the echoserver's user authentication function, the summary check was refactored and the old code wasn't removed. A more strict compiler noticed the code was never executed. 2. Moved the ret check variable to the section of the function where it is used.pull/471/head
parent
1fa4134304
commit
f88c3d6d3a
|
@ -1873,7 +1873,6 @@ static int wsUserAuth(byte authType,
|
||||||
PwMapList* list;
|
PwMapList* list;
|
||||||
PwMap* map;
|
PwMap* map;
|
||||||
byte authHash[WC_SHA256_DIGEST_SIZE];
|
byte authHash[WC_SHA256_DIGEST_SIZE];
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
fprintf(stderr, "wsUserAuth: ctx not set");
|
fprintf(stderr, "wsUserAuth: ctx not set");
|
||||||
|
@ -1909,6 +1908,7 @@ static int wsUserAuth(byte authType,
|
||||||
word32 fascnSz;
|
word32 fascnSz;
|
||||||
word32 uuidSz;
|
word32 uuidSz;
|
||||||
word32 i;
|
word32 i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
printf("Peer connected with FPKI certificate\n");
|
printf("Peer connected with FPKI certificate\n");
|
||||||
wc_InitDecodedCert(&cert, authData->sf.publicKey.publicKey,
|
wc_InitDecodedCert(&cert, authData->sf.publicKey.publicKey,
|
||||||
|
@ -2001,27 +2001,6 @@ static int wsUserAuth(byte authType,
|
||||||
else {
|
else {
|
||||||
return WOLFSSH_USERAUTH_INVALID_AUTHTYPE;
|
return WOLFSSH_USERAUTH_INVALID_AUTHTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authData->type == map->type) {
|
|
||||||
if (WMEMCMP(map->p, authHash, WC_SHA256_DIGEST_SIZE) == 0) {
|
|
||||||
return WOLFSSH_USERAUTH_SUCCESS;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (authType == WOLFSSH_USERAUTH_PASSWORD) {
|
|
||||||
passwdRetry--;
|
|
||||||
ret = (passwdRetry > 0) ?
|
|
||||||
WOLFSSH_USERAUTH_INVALID_PASSWORD :
|
|
||||||
WOLFSSH_USERAUTH_REJECTED;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = WOLFSSH_USERAUTH_INVALID_PUBLICKEY;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return WOLFSSH_USERAUTH_INVALID_AUTHTYPE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
map = map->next;
|
map = map->next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue