diff options
author | Michal Toman <mtoman@redhat.com> | 2011-06-09 10:42:47 +0200 |
---|---|---|
committer | Michal Toman <mtoman@redhat.com> | 2011-06-09 10:42:47 +0200 |
commit | 1bd7646c8536e7cb1731aceb294233ef55a2a0c0 (patch) | |
tree | 199e7ec61c92286c17a91b8a65ebf8fa44fd3653 /src/retrace/worker.c | |
parent | fc1a5c5f0021570c33c8e52e755eb1f20b10f0eb (diff) | |
download | abrt-1bd7646c8536e7cb1731aceb294233ef55a2a0c0.tar.gz abrt-1bd7646c8536e7cb1731aceb294233ef55a2a0c0.tar.xz abrt-1bd7646c8536e7cb1731aceb294233ef55a2a0c0.zip |
remove Retrace server code
Diffstat (limited to 'src/retrace/worker.c')
-rw-r--r-- | src/retrace/worker.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/src/retrace/worker.c b/src/retrace/worker.c deleted file mode 100644 index a49f74c3..00000000 --- a/src/retrace/worker.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <stdio.h> -#include <ctype.h> -#include <pwd.h> -#include <stdlib.h> -#include <unistd.h> - -/* - Launches Retrace Server worker (worker.py) with root permissions. - Binary needs to be owned by root and needs to set SUID bit. -*/ - -int main(int argc, char **argv) -{ - char command[256]; - FILE *pipe; - int i; - struct passwd *apache_user; - const char *apache_username = "apache"; - pid_t pid; - - if (argc != 2) - { - fprintf(stderr, "Usage: %s task_id\n", argv[0]); - return 1; - } - - if (setuid(0) != 0) - { - fprintf(stderr, "You must run %s with root permissions.\n", argv[0]); - return 2; - } - - for (i = 0; argv[1][i]; ++i) - if (!isdigit(argv[1][i])) - { - fputs("Task ID may only contain digits.", stderr); - return 3; - } - - apache_user = getpwnam(apache_username); - if (!apache_user) - { - fprintf(stderr, "User \"%s\" not found.\n", apache_username); - return 4; - } - - sprintf(command, "%d", apache_user->pw_uid); - - setenv("SUDO_USER", apache_username, 1); - setenv("SUDO_UID", command, 1); - /* required by mock to be able to write into result directory */ - setenv("SUDO_GID", "0", 1); - - /* fork and launch worker.py */ - pid = fork(); - - if (pid < 0) - { - fputs("Unable to fork.", stderr); - return 6; - } - - /* parent - exit */ - if (pid > 0) - return 0; - - /* child */ - sprintf(command, "/usr/bin/python /usr/share/abrt-retrace/worker.py \"%s\"", argv[1]); - pipe = popen(command, "r"); - if (pipe == NULL) - { - fputs("Unable to run 'worker.py'.", stderr); - return 5; - } - - return pclose(pipe) >> 8; -} |