|
@@ -202,7 +202,8 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- shellmatta_printf(handle, "Unknown option: %c\r\n", option);
|
|
|
+ shellmatta_write(handle, "Unknown option\r\n", 16);
|
|
|
+ return SHELLMATTA_USE_FAULT;
|
|
|
break;
|
|
|
}
|
|
|
ret = shellmatta_opt_long(handle, options, &option, &argument, &argLen);
|
|
@@ -213,6 +214,22 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
|
|
|
inst->tmpUserId = getUserIdFromName(inst, username);
|
|
|
checkPassword(handle, inst->tmpUserId, password);
|
|
|
}
|
|
|
+ else if(NULL != username)
|
|
|
+ {
|
|
|
+ /** -# reinitialize input */
|
|
|
+ inst->inputCount = 0u;
|
|
|
+ inst->cursor = 0u;
|
|
|
+
|
|
|
+ inst->tmpUserId = getUserIdFromName(handle, username);
|
|
|
+ shellmatta_write(handle, "\r\nenter password:\r\n", 19);
|
|
|
+ inst->loginState = SHELLMATTA_AUTH_PASSWORD;
|
|
|
+ ret = SHELLMATTA_CONTINUE;
|
|
|
+ }
|
|
|
+ else if (NULL != password)
|
|
|
+ {
|
|
|
+ shellmatta_write(handle, "Missing username\r\n", 18);
|
|
|
+ ret = SHELLMATTA_USE_FAULT;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
/** -# no credentials are passed with the command - start the input */
|
|
@@ -221,7 +238,7 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
|
|
|
/** -# store pointer to username in buffer */
|
|
|
shellmatta_write(handle, "enter username:\r\n", 17);
|
|
|
inst->loginState = SHELLMATTA_AUTH_USERNAME;
|
|
|
- return SHELLMATTA_CONTINUE;
|
|
|
+ ret = SHELLMATTA_CONTINUE;
|
|
|
}
|
|
|
break;
|
|
|
|