From 292fb47cb67837bc203c3038f75968a978440be7 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Mon, 21 Feb 2011 18:39:48 +0100 Subject: run abrt-action-install-debuginfo.py using trivial sgid wrapper Signed-off-by: Jiri Moskovcak Signed-off-by: Denys Vlasenko --- src/plugins/Makefile.am | 12 +++++++++++- src/plugins/abrt-action-install-debuginfo.c | 16 ++++++++++++++++ src/plugins/abrt-action-install-debuginfo.py | 11 +++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 src/plugins/abrt-action-install-debuginfo.c (limited to 'src/plugins') 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 +#include + +#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= " "--tmpdir= " - "--cachedir=") % sys.argv[0] + "--cache=") % 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) - -- cgit