X-Git-Url: https://git.sur5r.net/?p=gsconf;a=blobdiff_plain;f=shell.c;h=da91eb96aee2873730b9a4893567e1666be89bfa;hp=eceb152184c93961feefddc1128a9671fb8de511;hb=11ae7c1958d87f75fb840c6556fa99abf85e6607;hpb=bdf95351d3563e4039ee2cc229452d78b3b6a612 diff --git a/shell.c b/shell.c index eceb152..da91eb9 100644 --- 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); + } +