|
@@ -541,6 +541,44 @@ shellmatta_retCode_t shellmatta_auth_getLoggedInUserName(shellmatta_handle_t han
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @brief changes the password of the passed username
|
|
|
+ * @param[in] handle shellmatta instance handle
|
|
|
+ * @param[in] username username to change the password of
|
|
|
+ * @param[in] password password to be set for the user
|
|
|
+ * @return errorcode #SHELLMATTA_OK
|
|
|
+ * #SHELLMATTA_ERROR (user not found)
|
|
|
+ * #SHELLMATTA_USE_FAULT (param err)
|
|
|
+ */
|
|
|
+shellmatta_retCode_t shellmatta_auth_chpasswd(shellmatta_handle_t handle, const char *username, const char *password)
|
|
|
+{
|
|
|
+ shellmatta_retCode_t ret = SHELLMATTA_ERROR;
|
|
|
+ shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
|
|
|
+ uint32_t i;
|
|
|
+
|
|
|
+ /** -# check parameters for plausibility */
|
|
|
+ if( (NULL != inst)
|
|
|
+ && (SHELLMATTA_MAGIC == inst->magic)
|
|
|
+ && (username != NULL)
|
|
|
+ && (password != NULL))
|
|
|
+ {
|
|
|
+ for (i = 0u; i < inst->userListLength; i++)
|
|
|
+ {
|
|
|
+ /** -# search for user */
|
|
|
+ if (0 == strcmp(inst->userList[i].username, username))
|
|
|
+ {
|
|
|
+ inst->userList[i].password = password;
|
|
|
+ return SHELLMATTA_OK;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ret = SHELLMATTA_USE_FAULT;
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* @brief checks if a command is accessible by the logged in user
|
|
|
* @param[in] inst shellmatta instance to work with
|