diff options
author | Nate Straz <nstraz@redhat.com> | 2005-08-31 18:47:46 +0000 |
---|---|---|
committer | Nate Straz <nstraz@redhat.com> | 2005-08-31 18:47:46 +0000 |
commit | 6ec1970b75504d015116fc6bfe2133e9ee4908cd (patch) | |
tree | f1fe7bff6077495ae8c25572aae38c11fcaa51e8 /qarsh | |
parent | 909bfbad71af4607df9a156ca706f8c79e207e8c (diff) | |
download | qarsh-6ec1970b75504d015116fc6bfe2133e9ee4908cd.tar.gz qarsh-6ec1970b75504d015116fc6bfe2133e9ee4908cd.tar.xz qarsh-6ec1970b75504d015116fc6bfe2133e9ee4908cd.zip |
Remove cmdline splitting. We can just run everything through the shell.
Diffstat (limited to 'qarsh')
-rw-r--r-- | qarsh/qarshd.c | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/qarsh/qarshd.c b/qarsh/qarshd.c index 8919984..f7e5dd6 100644 --- a/qarsh/qarshd.c +++ b/qarsh/qarshd.c @@ -84,34 +84,7 @@ run_cmd(const char *cmd, int p_in, int p_out, int p_err) if (new_err == -1) syslog(LOG_WARNING, "connect to new_err failed"); dup2(new_err, fileno(stderr)); - /* If there are any shell-type characters in the - * cmdline such as '>', '<', '$', '|', '~','*' etc, - * then we exec a shell and run the cmd under a shell. - * - * Otherwise exec the cmd directly. - */ - - if (strpbrk(cmd, "\"';|<>$\\~*&")) { - execlp("sh", "sh", "-c", cmd, NULL); - } else { - char **argv; - char *sp, *tmpcmd; - int argc = 1; - - /* We need to split the string up */ - tmpcmd = strdup(cmd); - for (sp = tmpcmd; (sp = strchr(sp, ' ')); argc++) { - if (*sp == ' ') sp++; - } - syslog(LOG_INFO, "cmdline split into %d args", argc); - argv = calloc(argc+1, sizeof *argv); - for (argc = 0; (sp = strsep(&tmpcmd, " ")); argc++) { - argv[argc] = sp; - } - argv[argc] = NULL; - execvp(argv[0], argv); - printf("exec of %s failed: %d, %s\n", argv[0], errno, strerror(errno)); - } + execlp("sh", "sh", "-c", cmd, NULL); exit(127); } return pid; |