Hi Dave
I dug out some old software versions and made a couple of changes so that the TELNET log-in protection works as expected. [due to an otherwise undefined variable I had to also have the serial support active but this is not a problem for you].
1. In fnCommandInput() there was originally just
fnSaveDebugHandle(iSource); // save present debug handle and set appropriate
fnDoDebug(cDebugIn, (unsigned char)(ucDebugCnt+1), iSource); // treat debug messages
fnRestoreDebugHandle(); // return the present debug output
iReturn = 1; // we will always send something so report that a transmission has been started
I put some code around this as follows
if ((ucPasswordState != PASSWORD_IDLE) && ((usTelnet_state != ES_NETWORK_LOGIN) || (iSource == SOURCE_NETWORK))) {
int iPassword = 0;
cDebugIn[ucDebugCnt] = ':';
while (cDebugIn[iPassword] != ':') {}
if ((fnVerifyUser(cDebugIn, DO_CHECK_USER_NAME) != 0) || (fnVerifyUser(&cDebugIn[iPassword+1], DO_CHECK_PASSWORD) != 0)) {
fnDebugMsg("\n\rError - bad credentials!\n\r");
if (usTelnet_state == ES_NETWORK_LOGIN){
fnTelnet(Telnet_socket, LEAVE_ECHO_MODE);
usTelnet_state = ES_TERMINATE_CONNECTION; // quit an active Telnet session
}
}
else {
usTelnet_state = ES_NETWORK_COMMAND_MODE;
fnTelnet(Telnet_socket, CLEAR_TEXT_ENTRY); // make sure telnet echos in clear text mode again
fnDoAdmin(DO_SHOW_CONFIG, 0);
ucMenu = 0; // set main menu
fnDisplayHelp(0); // display main menu
}
}
else {
fnSaveDebugHandle(iSource); // save present debug handle and set appropriate
fnDoDebug(cDebugIn, (unsigned char)(ucDebugCnt+1), iSource); // treat debug messages
fnRestoreDebugHandle(); // return the present debug output
iReturn = 1; // we will always send something so report that a transmission has been started
}
2. In fnInitiateLogin() I changed the default case from
usTelnet_state = ES_NETWORK_LOGIN;
break;
to
usTelnet_state = ES_NETWORK_LOGIN;
fnDebugMsg("\n\rPlease enter user name and password (user:pass): ");
return DO_PASSWORD_ENTRY;
When the TELNET sever connection is made the server requests a password "Please enter user name and password (user:pass):"
It should be entered as "ADMIN:uTasker" if the default user name and password have not been changed.
On failure the connection is terminated after displaying a log-in failure message.
If it is successful the command menu is displayed.
The serial protection is a little different since it doesn't do through the TELNET listener and used its own set of parameters (protection on one or the other possible), but, based on this working case the serial one should be easier to add.
Regards
Mark