diff mbox

sudo: fix main executable permissions

Message ID 1343998111-15331-1-git-send-email-spdawson@gmail.com
State Rejected
Headers show

Commit Message

Simon Dawson Aug. 3, 2012, 12:48 p.m. UTC
From: Simon Dawson <spdawson@gmail.com>

The sudo executable is installed without the setuid bit set, which prevents
sudo from working.

This patch adds a post-install hook to fix the permissions of the sudo
executable.

Signed-off-by: Simon Dawson <spdawson@gmail.com>
---
 package/sudo/sudo.mk |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Thomas Petazzoni Aug. 4, 2012, 12:43 p.m. UTC | #1
Le Fri,  3 Aug 2012 13:48:31 +0100,
spdawson@gmail.com a écrit :

> +define SUDO_FIX_PERMISSIONS
> +  chmod 4755 $(TARGET_DIR)/usr/bin/sudo
> +endef
> +
> +SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_FIX_PERMISSIONS

The principle is good, but not the way it is implemented.  Please use
the <pkg>_PERMISSIONS infrastructure instead. See the documentation, or
package/busybox/busybox.mk for an example.

Thanks!

Thomas
Simon Dawson Aug. 4, 2012, 8:10 p.m. UTC | #2
On 4 August 2012 13:43, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> The principle is good, but not the way it is implemented.  Please use
> the <pkg>_PERMISSIONS infrastructure instead. See the documentation, or
> package/busybox/busybox.mk for an example.

Okay, thanks Thomas.

Simon.
diff mbox

Patch

diff --git a/package/sudo/sudo.mk b/package/sudo/sudo.mk
index 9b0ebed..542edb6 100644
--- a/package/sudo/sudo.mk
+++ b/package/sudo/sudo.mk
@@ -14,4 +14,10 @@  SUDO_CONF_OPT = \
 		--without-interfaces \
 		--without-pam
 
+define SUDO_FIX_PERMISSIONS
+  chmod 4755 $(TARGET_DIR)/usr/bin/sudo
+endef
+
+SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_FIX_PERMISSIONS
+
 $(eval $(autotools-package))