|
@@ -20,6 +20,9 @@
|
|
#include "shellmatta.h"
|
|
#include "shellmatta.h"
|
|
#include "shellmatta_autocomplete.h"
|
|
#include "shellmatta_autocomplete.h"
|
|
#include "shellmatta_utils.h"
|
|
#include "shellmatta_utils.h"
|
|
|
|
+#ifdef SHELLMATTA_AUTHENTICATION
|
|
|
|
+#include "shellmatta_auth.h"
|
|
|
|
+#endif
|
|
#include <stdint.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <string.h>
|
|
|
|
|
|
@@ -50,6 +53,13 @@ void autocomplete_run(shellmatta_instance_t *inst)
|
|
/** -# loop through all registered commands */
|
|
/** -# loop through all registered commands */
|
|
while (NULL != cmd)
|
|
while (NULL != cmd)
|
|
{
|
|
{
|
|
|
|
+#ifdef SHELLMATTA_AUTHENTICATION
|
|
|
|
+ if (SHELLMATTA_OK != shellmatta_auth_is_cmd_permitted(inst, cmd))
|
|
|
|
+ {
|
|
|
|
+ cmd = cmd->next;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
/** -# check if command matches the input */
|
|
/** -# check if command matches the input */
|
|
if( (strlen(cmd->cmd) >= inst->cursor)
|
|
if( (strlen(cmd->cmd) >= inst->cursor)
|
|
&& (0 == strncmp(cmd->cmd, inst->buffer, inst->cursor)))
|
|
&& (0 == strncmp(cmd->cmd, inst->buffer, inst->cursor)))
|
|
@@ -98,6 +108,13 @@ void autocomplete_run(shellmatta_instance_t *inst)
|
|
/** -# loop through all registered commands */
|
|
/** -# loop through all registered commands */
|
|
while (NULL != cmd)
|
|
while (NULL != cmd)
|
|
{
|
|
{
|
|
|
|
+#ifdef SHELLMATTA_AUTHENTICATION
|
|
|
|
+ if (SHELLMATTA_OK != shellmatta_auth_is_cmd_permitted(inst, cmd))
|
|
|
|
+ {
|
|
|
|
+ cmd = cmd->next;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
/** -# check if command matches the input */
|
|
/** -# check if command matches the input */
|
|
if( (strlen(cmd->cmd) >= inst->cursor)
|
|
if( (strlen(cmd->cmd) >= inst->cursor)
|
|
&& (0 == strncmp(cmd->cmd, inst->buffer, inst->cursor)))
|
|
&& (0 == strncmp(cmd->cmd, inst->buffer, inst->cursor)))
|