Parcourir la source

adding permissions when adding a command if matching permissions are found

Strobel, Stefan | Friedrich Lütze GmbH il y a 9 mois
Parent
commit
4924f9f176
1 fichiers modifiés avec 16 ajouts et 0 suppressions
  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
     {