tags 567995 patch
thanks

I'm attaching a patch that adds a snippet to /etc/sudoers.d/, so that sudo
preserves $HOME during its actions.

This seems the cleanest approach to me, but it needs a
"#includedir /etc/sudoers.d/" line in /etc/sudoers. This isn't the case
everywhere.

I also thought at coding something into parameter.c, i.e. try to parse
$SUDO_USER, and try to detect the correct $HOME (getenv + getpwnam). I couldn't
test this, and I already had a patch ready, but inadvertently deleted it. If
needed I can make it again.

Kindly,
David

-- 
 . ''`.   Debian developer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://deb.li/dapal
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
commit 169ffe5f91bc4eb1ae887b6aae0651b405318fab
Author: David Paleino <[email protected]>
Date:   Thu Sep 29 20:58:09 2011 +0200

    Install sudoers.d snippet
    
      This ensures that $HOME is kept intact, and the correct ~/.pbuilderrc
      is considered.

diff --git a/Makefile b/Makefile
index b2e37f1..bc4fa83 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ BINARY=libcowdancer.so cow-shell cowbuilder qemubuilder cowdancer-ilistcreate \
 	cowdancer-ilistdump
 INSTALL_DIR=install -d -o root -g root -m 755
 INSTALL_FILE=install -o root -g root -m 644
+INSTALL_FILE_NOPERM=install -o root -g root
 INSTALL_PROGRAM=install -o root -g root -m 755
 DESTDIR=
 PREFIX=/usr
@@ -36,6 +37,9 @@ install: $(BINARY)
 	$(INSTALL_FILE) bash_completion.qemubuilder $(DESTDIR)/etc/bash_completion.d/qemubuilder
 	$(INSTALL_FILE) bash_completion.cowbuilder $(DESTDIR)/etc/bash_completion.d/cowbuilder
 
+	$(INSTALL_DIR) $(DESTDIR)/etc/sudoers.d
+	$(INSTALL_FILE_NOPERM) -m 440 sudoers.cowbuilder $(DESTDIR)/etc/sudoers.d/cowbuilder
+
 libcowdancer.so: cowdancer.lo ilistcreate.lo
 	$(CC) $(CFLAGS) -ldl -shared -o $@ $^
 
diff --git a/debian/changelog b/debian/changelog
index 1e1a8c2..43f19d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+cowdancer (0.66) UNRELEASED; urgency=low
+
+  * Install sudoers.d snippet to preserve $HOME (Closes: #567995)
+
+ -- David Paleino <[email protected]>  Thu, 29 Sep 2011 20:56:22 +0200
+
 cowdancer (0.65) unstable; urgency=low
 
   [ Junichi Uekawa ]
diff --git a/debian/cowbuilder.files b/debian/cowbuilder.files
index 1da1fff..7277b1f 100644
--- a/debian/cowbuilder.files
+++ b/debian/cowbuilder.files
@@ -1,3 +1,4 @@
 /usr/sbin/cowbuilder
 /usr/share/man/man8/cowbuilder.8
 /etc/bash_completion.d/cowbuilder
+/etc/sudoers.d/cowbuilder
diff --git a/debian/rules b/debian/rules
index 074d85d..7eff1c8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -68,7 +68,7 @@ binary-arch: build install
 	dh_strip -s 
 	dh_shlibdeps -s 
 	dh_compress -s 
-	dh_fixperms -s 
+	dh_fixperms -s -Xsudoers
 	dh_installdeb -s 
 	dh_gencontrol -s 
 	dh_md5sums -s 
diff --git a/sudoers.cowbuilder b/sudoers.cowbuilder
new file mode 100644
index 0000000..dff7cc4
--- /dev/null
+++ b/sudoers.cowbuilder
@@ -0,0 +1,2 @@
+# see Debian bug #567995
+Defaults env_keep += "HOME"

Attachment: signature.asc
Description: PGP signature

Reply via email to