Commit f563eec2526fe1285c5a1a1175d6bbcbb3b23097

Authored by tmcolby
Committed by Gordon Hollingworth
1 parent f4ff1f08

Update main.c

Added check at top of main() to test if user is running as sudo.  Print message and exit if not run as sudo.
Showing 1 changed file with 8 additions and 0 deletions
@@ -96,6 +96,14 @@ int main(int argc, char *argv[]) @@ -96,6 +96,14 @@ int main(int argc, char *argv[])
96 int length; 96 int length;
97 unsigned char signature[20]; 97 unsigned char signature[20];
98 } message; 98 } message;
  99 +
  100 + //exit if not run as sudo
  101 + int user = getuid();
  102 + if(user != 0)
  103 + {
  104 + printf("Must be run with sudo...\n");
  105 + exit(-1);
  106 + }
99 107
100 // Skip the command name 108 // Skip the command name
101 argv++; argc--; 109 argv++; argc--;