aboutsummaryrefslogtreecommitdiff
path: root/firma
diff options
context:
space:
mode:
authorrhatto <rhatto>2006-10-09 13:28:25 +0000
committerrhatto <rhatto>2006-10-09 13:28:25 +0000
commite40af508024ee4f63e54c0d8708f1282c3319d41 (patch)
tree139869c2fe23e0d50862e05c88115d6fc41317e7 /firma
parent9601b3f30b5ef3a81dabe7ac37e459c01f61f9e1 (diff)
downloadfirma-e40af508024ee4f63e54c0d8708f1282c3319d41.tar.gz
firma-e40af508024ee4f63e54c0d8708f1282c3319d41.tar.bz2
fix on USER and GROUP evaluation
Diffstat (limited to 'firma')
-rwxr-xr-xfirma38
1 files changed, 24 insertions, 14 deletions
diff --git a/firma b/firma
index 222094f..d8087b6 100755
--- a/firma
+++ b/firma
@@ -185,15 +185,15 @@ WARNING: Setting LOG_TO_SYSLOG to '0'."
fi
if ! grep -q -e "^USER=" $FIRMA_CONFIG_FILE; then
- USER="nobody"
+ FIRMA_USER="nobody"
else
- USER="`grep "^USER=" $FIRMA_CONFIG_FILE | sed -e 's/"//g' -e "s/'//g" | cut -d = -f 2`"
+ FIRMA_USER="`grep "^USER=" $FIRMA_CONFIG_FILE | sed -e 's/"//g' -e "s/'//g" | cut -d = -f 2`"
fi
if ! grep -q -e "^GROUP=" $FIRMA_CONFIG_FILE; then
- GROUP="nobody"
+ FIRMA_GROUP="nobody"
else
- GROUP="`grep "^GROUP=" $FIRMA_CONFIG_FILE | sed -e 's/"//g' -e "s/'//g" | cut -d = -f 2`"
+ FIRMA_GROUP="`grep "^GROUP=" $FIRMA_CONFIG_FILE | sed -e 's/"//g' -e "s/'//g" | cut -d = -f 2`"
fi
return $return_code
@@ -243,6 +243,14 @@ WARNING: $LIST_NAME: Removing this address from LIST_ADMIN."
LIST_ADMIN="$valid_admins"
fi
+ if grep -q -e "^USER=" $LIST_CONFIG_FILE; then
+ FIRMA_USER="`grep "^USER=" $LIST_CONFIG_FILE | sed -e 's/"//g' -e "s/'//g" | cut -d = -f 2`"
+ fi
+
+ if grep -q -e "^GROUP=" $LIST_CONFIG_FILE; then
+ FIRMA_GROUP="`grep "^GROUP=" $LIST_CONFIG_FILE | sed -e 's/"//g' -e "s/'//g" | cut -d = -f 2`"
+ fi
+
return $return_code
}
@@ -875,7 +883,7 @@ function NewList {
echo "Creating your config..."
touch $LIST_CONFIG_FILE
chmod 600 $LIST_CONFIG_FILE
- chown $USER.$GROUP $LIST_CONFIG_FILE
+ chown $FIRMA_USER.$FIRMA_GROUP $LIST_CONFIG_FILE
if [ -f "$LIST_CONFIG_FILE" ]; then
DeclareGpgVars
# removed: MAIL_AGENT=$MAIL_AGENT\nGPG_BINARY=$GPG_BINARY\n
@@ -899,7 +907,7 @@ function NewList {
EOF
# TODO: import admin pubkey and send list pubkey to admin
- chown -R $USER.$GROUP $LIST_HOMEDIR
+ chown -R $FIRMA_USER.$FIRMA_GROUP $LIST_HOMEDIR
else
echo "$(basename $0): cannot create $LIST_PATH: Installation aborted"
@@ -1082,7 +1090,7 @@ EOF
function CheckPermission {
#-------------------------------------------------------------
# check if file has correct permissions (600) and also
- # +if the file is owned by $USER
+ # +if the file is owned by $FIRMA_USER
# +got the idea for this function from backupninja
#
# parameter(s): file name
@@ -1099,8 +1107,8 @@ function CheckPermission {
return 1
fi
- if [ `ls -ld $file | awk '{print $3}'` != "$USER" ]; then
- echo "WARNING: Configuration files must be owned by $USER! Dying on file $file"
+ if [ `ls -ld $file | awk '{print $3}'` != "$FIRMA_USER" ]; then
+ echo "WARNING: Configuration files must be owned by $FIRMA_USER! Dying on file $file"
fi
return 0
@@ -1110,7 +1118,7 @@ function CheckPermission {
function CheckListPermissions {
#-------------------------------------------------------------
# check if list files has correct permissions (600) and also
- # +if the files are owned by $USER
+ # +if the files are owned by $FIRMA_USER
#
# parameter(s): list config file
# depends on function(s): CheckPermission
@@ -1122,7 +1130,7 @@ function CheckListPermissions {
local folder
local config
- # check and fix permissions on all files from $LIST_PATH to $USER.$GROUP
+ # check and fix permissions on all files from $LIST_PATH to $FIRMA_USER.$FIRMA_GROUP
if [ ! -z "$1" ]; then
folder="`dirname $1`"
config="`basename $1`"
@@ -1130,7 +1138,7 @@ function CheckListPermissions {
if ! CheckPermission $folder/$file; then
LogMessage "Fixing permission and ownership for $folder/$file"
chmod 600 $folder/$file
- chown $USER.$GROUP $folder/$file
+ chown $FIRMA_USER.$FIRMA_GROUP $folder/$file
fi
done
fi
@@ -1194,7 +1202,7 @@ function UnsubscribeUser {
done
fi
- chown -R $USER.$GROUP $LIST_PATH
+ chown -R $FIRMA_USER.$FIRMA_GROUP $LIST_PATH
return $return_code
}
@@ -1254,7 +1262,9 @@ GLOBAL_VARS="
GLOBAL_VARS VAR
USER
GROUP
- BASENAME"
+ BASENAME
+ FIRMA_USER
+ FIRMA_GROUP"
FUNCTIONS="
Usage