From b2ac5a8556b6ea187592b01b918d742b2c592a7c Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 16 May 2011 11:26:59 +0000
Subject: [PATCH] Fix for OPENDJ-148 : pfexec /usr/opendj/configure does not execute (permission denied). pfexec checks file permissions before the profile and exec attributes on OpenIndiana (and OpenSolaris). So now configure and unconfigure are executable by all, but check for root id, allowing use with pfexec.
---
opends/src/svr4/OpenDJ/layout.xml | 4 ++--
opends/resource/unconfigure | 8 ++++++++
opends/resource/configure | 8 ++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/opends/resource/configure b/opends/resource/configure
index cdccedd..3ce1152 100755
--- a/opends/resource/configure
+++ b/opends/resource/configure
@@ -41,6 +41,14 @@
SCRIPT_NAME=configure
export SCRIPT_NAME
+# Check if running as root. This is required to be able to copy files and
+# enable SMF
+if [[ `id -u` -ne 0 ]]
+then
+ echo "This script must be run as root" 1>&2
+ exit 1
+fi
+
cd "${WORKING_DIR}"
# Set environment variables
diff --git a/opends/resource/unconfigure b/opends/resource/unconfigure
index c8df403..c50d875 100755
--- a/opends/resource/unconfigure
+++ b/opends/resource/unconfigure
@@ -41,6 +41,14 @@
SCRIPT_NAME=unconfigure
export SCRIPT_NAME
+# Check if running as root. This is required to be able to copy files and
+# enable SMF
+if [[ `id -u` -ne 0 ]]
+then
+ echo "This script must be run as root" 1>&2
+ exit 1
+fi
+
cd "${WORKING_DIR}"
# Set environment variables
diff --git a/opends/src/svr4/OpenDJ/layout.xml b/opends/src/svr4/OpenDJ/layout.xml
index c2f9034..5c891b1 100644
--- a/opends/src/svr4/OpenDJ/layout.xml
+++ b/opends/src/svr4/OpenDJ/layout.xml
@@ -123,11 +123,11 @@
<!-- Add configure script -->
<copy file="${resource.dir}/configure"
tofile="${svr4.layout.pkg.dir}/configure" />
- <chmod file="${svr4.layout.pkg.dir}/configure" perm="744" />
+ <chmod file="${svr4.layout.pkg.dir}/configure" perm="755" />
<!-- Add unconfigure script -->
<copy file="${resource.dir}/unconfigure"
tofile="${svr4.layout.pkg.dir}/unconfigure" />
- <chmod file="${svr4.layout.pkg.dir}/unconfigure" perm="744" />
+ <chmod file="${svr4.layout.pkg.dir}/unconfigure" perm="755" />
<!-- Add man pages -->
<copy todir="${svr4.layout.pkg.dir}/man">
<fileset dir="${resource.dir}/man"/>
--
Gitblit v1.10.0