ソースを参照

adding permissions when adding a command if matching permissions are found

Strobel, Stefan | Friedrich Lütze GmbH 9 ヶ月 前
コミット
4924f9f176
1 ファイル変更16 行追加0 行削除
  1. 16 0
      src/shellmatta.c

+ 16 - 0
src/shellmatta.c

@@ -257,6 +257,22 @@ shellmatta_retCode_t shellmatta_addCmd(shellmatta_handle_t handle, shellmatta_cm
                 tempCmd = tempCmd->next;
             }
         }
+
+#ifdef SHELLMATTA_AUTHENTICATION
+        /** -# append permissions to added command if any */
+        if (inst->permList)
+        {
+            /** -# Search for command in perm list */
+            for (uint32_t i = 0u; i < inst->permListLength; i++)
+            {
+                if (0 == strcmp(cmd->cmd, inst->permList[i].cmd))
+                {
+                    cmd->authLink = &inst->permList[i];
+                    break;
+                }
+            }
+        }
+#endif
     }
     else
     {