]> git.sur5r.net Git - gsconf/blobdiff - shell.c
added sys [name|password|restart] and vlan enable
[gsconf] / shell.c
diff --git a/shell.c b/shell.c
index eceb152184c93961feefddc1128a9671fb8de511..da91eb96aee2873730b9a4893567e1666be89bfa 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -77,10 +77,17 @@ void shell_set(char ** argv, int elem) {
         }
 }
 
+char * copyString(char * data) {
+        char * ret = (char * )malloc(strlen(data) + 1);
+        memcpy(ret, data, strlen(data) + 1);
+        ret[strlen(data)] = 0;
+        return ret;
+}
+
 void password(void) {
         if (settings.password == NULL) {
                printf("\033[91mWarning: As the protocol of the switch wants it that way, all configuration packets are send as broadcasts, meaning everyone on this net can sniff your password!\033[0m\n");
-                settings.password = getpass("Password: ");
+                settings.password = copyString(getpass("Password: "));
         }
 }
 
@@ -209,6 +216,10 @@ int shell (void) {
                         shell_port(argv, elem);
                 }
                 
+                if (strncmp(argv[0], "sys", 3) == 0) {
+                        shell_sys(argv, elem);
+                }
+