From 871dfc2d65c3be02eeaede3a988df79778c7e18c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Fri, 10 Dec 2004 11:16:37 +0000 Subject: [PATCH] - only export enviroment when necessary - use "su - - fail if $GLITE_USER is not set --- org.glite.security.proxyrenewal/config/startup | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/org.glite.security.proxyrenewal/config/startup b/org.glite.security.proxyrenewal/config/startup index efbc8d5..db273c2 100755 --- a/org.glite.security.proxyrenewal/config/startup +++ b/org.glite.security.proxyrenewal/config/startup @@ -1,7 +1,6 @@ #!/bin/sh GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_USER=${GLITE_USER:-glite} GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/opt/glite/var} [ -f /etc/glite.conf ] && . /etc/glite.conf @@ -12,9 +11,20 @@ PROXY_REPOSITORY="$GLITE_LOCATION_VAR/spool/glite-renewd" start() { - [ -n "$GLITE_HOST_CERT" ] && X509_USER_CERT="$GLITE_HOST_CERT" - [ -n "$GLITE_HOST_KEY" ] && X509_USER_KEY="$GLITE_HOST_KEY" - export X509_USER_CERT X509_USER_KEY + if test -z "$GLITE_USER" ;then + echo 'Error: GLITE_USER is not set' + echo FAILED + return 1 + fi + + if [ -n "$GLITE_HOST_CERT" ]; then + X509_USER_CERT="$GLITE_HOST_CERT" + export X509_USER_CERT + fi + if [ -n "$GLITE_HOST_KEY" ]; then + X509_USER_KEY="$GLITE_HOST_KEY" + export X509_USER_KEY + fi echo -n Starting ProxyRenewal Daemon: glite-proxy-renewd ... @@ -24,7 +34,7 @@ start() chmod 0700 $PROXY_REPOSITORY fi - su $GLITE_USER -c "$GLITE_LOCATION/bin/glite-proxy-renewd \ + su - $GLITE_USER -c "$GLITE_LOCATION/bin/glite-proxy-renewd \ -r $PROXY_REPOSITORY" && echo " done" } -- 1.8.2.3