diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2011-02-21 18:39:48 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-02-21 18:39:48 +0100 |
commit | 292fb47cb67837bc203c3038f75968a978440be7 (patch) | |
tree | c6accb4d7adb365801b7f0c91e0b5a11067650ba /src/plugins | |
parent | 004882408d093d324cc712c1f45166427589eac5 (diff) | |
download | abrt-292fb47cb67837bc203c3038f75968a978440be7.tar.gz abrt-292fb47cb67837bc203c3038f75968a978440be7.tar.xz abrt-292fb47cb67837bc203c3038f75968a978440be7.zip |
run abrt-action-install-debuginfo.py using trivial sgid wrapper
Signed-off-by: Jiri Moskovcak <jmoskovc@redhat.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Makefile.am | 12 | ||||
-rw-r--r-- | src/plugins/abrt-action-install-debuginfo.c | 16 | ||||
-rwxr-xr-x | src/plugins/abrt-action-install-debuginfo.py | 11 |
3 files changed, 34 insertions, 5 deletions
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 3ba454e2..938f88ba 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -14,7 +14,8 @@ bin_PROGRAMS = \ abrt-action-kerneloops \ abrt-action-upload \ abrt-action-mailx \ - abrt-action-print + abrt-action-print \ + abrt-action-install-debuginfo dist_pluginslib_DATA = \ Logger.glade \ @@ -278,4 +279,13 @@ abrt_action_print_CPPFLAGS = \ abrt_action_print_LDADD = \ ../lib/libreport.la +abrt_action_install_debuginfo_SOURCES = \ + abrt-action-install-debuginfo.c +abrt_action_install_debuginfo_CPPFLAGS = \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ + -I$(srcdir)/../lib \ + -D_GNU_SOURCE \ + -Wall +abrt_action_install_debuginfo_LDADD = + DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ diff --git a/src/plugins/abrt-action-install-debuginfo.c b/src/plugins/abrt-action-install-debuginfo.c new file mode 100644 index 00000000..dc7eed79 --- /dev/null +++ b/src/plugins/abrt-action-install-debuginfo.c @@ -0,0 +1,16 @@ +#include <unistd.h> +#include <string.h> + +#define EXECUTABLE "abrt-action-install-debuginfo.py" + +/* A binary wrapper is needed around python scripts if we want + * to run them in sgid/suid mode. + * + * This is such a wrapper. + */ +int main(int argc, char **argv) +{ + execvp(EXECUTABLE, argv); + write(2, "Can't execute "EXECUTABLE"\n", strlen("Can't execute "EXECUTABLE"\n")); + return 1; +} diff --git a/src/plugins/abrt-action-install-debuginfo.py b/src/plugins/abrt-action-install-debuginfo.py index d59d0e5f..535796e6 100755 --- a/src/plugins/abrt-action-install-debuginfo.py +++ b/src/plugins/abrt-action-install-debuginfo.py @@ -51,7 +51,11 @@ def unmute_stdout(): def ask_yes_no(prompt, retries=4): while True: - response = raw_input(prompt) + try: + response = raw_input(prompt) + except EOFError: + log1("got eof, probably executed from helper, assuming - yes") + response = 'y' if response in ('y', 'Y'): return True if response in ('n', 'N', ''): @@ -412,7 +416,7 @@ if __name__ == "__main__": help_text = _("Usage: %s --core=<COREFILE> " "--tmpdir=<TMPDIR> " - "--cachedir=<CACHEDIR>") % sys.argv[0] + "--cache=<CACHEDIR>") % sys.argv[0] try: opts, args = getopt.getopt(sys.argv[1:], "vyhc:", ["help", "core=", "cache=", "tmpdir=", @@ -443,7 +447,7 @@ if __name__ == "__main__": print help_text exit(RETURN_FAILURE) if not cachedir: - print _("You have to specify the path to cachedir.") + print _("You have to specify the path to cache.") print help_text exit(RETURN_FAILURE) if not tmpdir: @@ -469,4 +473,3 @@ if __name__ == "__main__": print _("Complete!") exit(result) - |