Package: sudo
Version: 1.8.21p2-2
Severity: wishlist
Tags: patch

Dear Maintainer,

Please consider shipping an Apport hook like many other packages in Debian.
I attached the patch carried in Ubuntu for adding the hook, please
consider merging it.

Cheers,
Balint
From 25eaed037cc3754c85687a8672ee7f10cdbf1a04 Mon Sep 17 00:00:00 2001
From: Marc Deslauriers <marc.deslauri...@ubuntu.com>
Date: Fri, 29 Jan 2010 09:31:00 -0500
Subject: [PATCH] debian/{source_sudo.py,rules}: Add apport hook

---
 debian/rules          |  6 ++++++
 debian/source_sudo.py | 33 +++++++++++++++++++++++++++++++++
 debian/sudo-ldap.dirs |  1 +
 debian/sudo.dirs      |  1 +
 4 files changed, 41 insertions(+)
 create mode 100644 debian/source_sudo.py

diff --git a/debian/rules b/debian/rules
index 06a468e..f55d9cf 100755
--- a/debian/rules
+++ b/debian/rules
@@ -155,6 +155,12 @@ install: build-stamp
 	ln -s /dev/null debian/sudo/lib/systemd/system/sudo.service
 	ln -s /dev/null debian/sudo-ldap/lib/systemd/system/sudo.service
 
+	install -o root -g root -m 0644 $(CURDIR)/debian/source_sudo.py \
+		debian/sudo/usr/share/apport/package-hooks/source_sudo.py
+	install -o root -g root -m 0644 $(CURDIR)/debian/source_sudo.py \
+		debian/sudo-ldap/usr/share/apport/package-hooks/source_sudo.py
+
+
 binary-indep: build install
 
 binary-arch: build install
diff --git a/debian/source_sudo.py b/debian/source_sudo.py
new file mode 100644
index 0000000..8def82a
--- /dev/null
+++ b/debian/source_sudo.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+'''Apport package hook for sudo
+
+(c) 2010 Canonical Ltd.
+Contributors:
+Marc Deslauriers <marc.deslauri...@canonical.com>
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
+the full text of the license.
+'''
+
+from apport.hookutils import *
+
+def add_info(report, ui):
+
+    response = ui.yesno("The contents of your /etc/sudoers file may help developers diagnose your bug more quickly, however, it may contain sensitive information.  Do you want to include it in your bug report?")
+
+    if response == None: #user cancelled
+        raise StopIteration
+
+    elif response == True:
+        # This needs to be run as root
+        report['Sudoers'] = root_command_output(['/bin/cat', '/etc/sudoers'])
+        report['VisudoCheck'] = root_command_output(['/usr/sbin/visudo', '-c'])
+
+    elif response == False:
+        ui.information("The contents of your /etc/sudoers will NOT be included in the bug report.")
+
+
diff --git a/debian/sudo-ldap.dirs b/debian/sudo-ldap.dirs
index 8b95431..ace66e5 100644
--- a/debian/sudo-ldap.dirs
+++ b/debian/sudo-ldap.dirs
@@ -5,5 +5,6 @@ usr/bin
 usr/share/man/man8
 usr/share/man/man5
 usr/sbin
+usr/share/apport/package-hooks
 usr/share/doc/sudo-ldap
 usr/share/lintian/overrides
diff --git a/debian/sudo.dirs b/debian/sudo.dirs
index 96b5de3..537713a 100644
--- a/debian/sudo.dirs
+++ b/debian/sudo.dirs
@@ -5,5 +5,6 @@ usr/bin
 usr/share/man/man8
 usr/share/man/man5
 usr/sbin
+usr/share/apport/package-hooks
 usr/share/doc/sudo
 usr/share/lintian/overrides
-- 
2.11.0

Reply via email to