68,6 → 68,8 |
tmp = cli_strdup(usr->line); |
|
/* Break up what the user typed, space delimited */ |
|
/* TODO: Protect things in quotes / ticks, expand wildcards */ |
cmd[n] = cli_strtok(tmp, " "); |
while (cmd[n] && n < WORD_MAX) { |
cmd[++n] = cli_strtok(NULL, " "); |
79,11 → 81,10 |
goto finit; |
} |
|
/* Check what kind of command argv[0] might be */ |
/* Check what kind of command argv[0] might be, TODO: move this to |
* a function */ |
if ((i = (is_builtin(cmd[0]))) > -1) { |
/* Its a builtin */ |
if (builtin_is_restricted(i)) { |
/* Try an external command matching argv[0] */ |
rc = try_exec(cmd[0], cmd); |
if (rc) |
cli_restricted(cmd[0]); |
92,7 → 93,6 |
rc = run_builtin(i, cmd, usr); |
goto finit; |
} else if ((i = (is_module(cmd[0]))) > -1) { |
/* Its a module, it can't modify cliuser_t */ |
if (module_is_restricted(i)) { |
rc = try_exec(cmd[0], cmd); |
if (rc) |
102,7 → 102,6 |
rc = run_module(i, cmd); |
goto finit; |
} else { |
/* See what try_exec() thinks of it */ |
rc = try_exec(cmd[0], cmd); |
goto finit; |
} |
156,8 → 155,6 |
/* Make sure we don't have rubbish or a C/R happy user */ |
if (len == 0 || line[0] == '\n') |
return; |
if (len == 1 && line[len-1] == '\n') |
return; |
usr->line = cli_strdup(line); |
|
return; |