aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluis <luis>2007-08-19 07:17:40 +0000
committerluis <luis>2007-08-19 07:17:40 +0000
commitbec16fd176f4d16d322d61edaf70a61b18513a0b (patch)
tree01e48ca3b3ef819a9c0e3123403167b0a9e31455
parent57de6a93873f12ca5368d702357f7b3cc9d1a5c8 (diff)
downloadfirma-bec16fd176f4d16d322d61edaf70a61b18513a0b.tar.gz
firma-bec16fd176f4d16d322d61edaf70a61b18513a0b.tar.bz2
Discard STDERR on all touch/chown/chmod calls.
-rwxr-xr-xfirma55
1 files changed, 34 insertions, 21 deletions
diff --git a/firma b/firma
index e23f557..de0d2ff 100755
--- a/firma
+++ b/firma
@@ -142,7 +142,7 @@ function CheckFirmaConfigFile {
LOG_TO_SYSLOG="0"
LogMessage "\
WARNING: LOG_TO_SYSLOG should be set either to '0' or '1'.
-WARNING: Setting LOG_TO_SYSLOG to '0'."
+WARNING: Setting LOG_TO_SYSLOG to '0' for this run."
elif [[ -z "$LOG_TO_SYSLOG" ]]; then
LOG_TO_SYSLOG="0"
@@ -153,7 +153,7 @@ WARNING: Setting LOG_TO_SYSLOG to '0'."
LOG_TO_SYSLOG="0"
LogMessage "\
WARNING: Logger binary ($LOGGER_BINARY) could not be found.
-WARNING: Setting LOG_TO_SYSLOG to '0'."
+WARNING: Setting LOG_TO_SYSLOG to '0' for this run."
else # SYSLOG_PRIORITY defaults to "user.err"
SYSLOG_PRIORITY=${SYSLOG_PRIORITY:-"user.err"}
@@ -187,7 +187,7 @@ WARNING: Setting LOG_TO_SYSLOG to '0'."
LogMessage "\
WARNING: USE_GPG_HIDDEN_RECIPIENT_OPTION should be set either to '0' or '1'.
-WARNING: Setting USE_GPG_HIDDEN_RECIPIENT_OPTION to '0'."
+WARNING: Setting USE_GPG_HIDDEN_RECIPIENT_OPTION to '0' for this run."
USE_GPG_HIDDEN_RECIPIENT_OPTION="0"
elif [[ -z "$USE_GPG_HIDDEN_RECIPIENT_OPTION" ]]; then
@@ -199,7 +199,7 @@ WARNING: Setting USE_GPG_HIDDEN_RECIPIENT_OPTION to '0'."
LogMessage "\
WARNING: GPG's \"--hidden-recipient\" option is only available from version 1.4.0 onwards.
-WARNING: Setting USE_GPG_HIDDEN_RECIPIENT_OPTION to '0'."
+WARNING: Setting USE_GPG_HIDDEN_RECIPIENT_OPTION to '0' for this run."
USE_GPG_HIDDEN_RECIPIENT_OPTION="0"
fi
@@ -306,7 +306,7 @@ WARNING: $LIST_NAME: Removing this address from LIST_ADMIN for this run."
LogMessage "\
WARNING: $LIST_NAME: REQUIRE_SIGNATURE should be set either to '0' or '1'.
-WARNING: $LIST_NAME: Setting REQUIRE_SIGNATURE to '1'."
+WARNING: $LIST_NAME: Setting REQUIRE_SIGNATURE to '1' for this run."
REQUIRE_SIGNATURE="1"
elif [[ -z "$REQUIRE_SIGNATURE" ]]; then
@@ -321,7 +321,7 @@ WARNING: $LIST_NAME: Setting REQUIRE_SIGNATURE to '1'."
LogMessage "\
WARNING: $LIST_NAME: REPLIES_SHOULD_GO_TO_LIST should be set either to '0' or '1'.
-WARNING: $LIST_NAME: Setting REPLIES_SHOULD_GO_TO_LIST to '0'."
+WARNING: $LIST_NAME: Setting REPLIES_SHOULD_GO_TO_LIST to '0' for this run."
REPLIES_SHOULD_GO_TO_LIST="0"
elif [[ -z "$REPLIES_SHOULD_GO_TO_LIST" ]]; then
@@ -336,7 +336,7 @@ WARNING: $LIST_NAME: Setting REPLIES_SHOULD_GO_TO_LIST to '0'."
LogMessage "\
WARNING: $LIST_NAME: REPLAY_PROTECTION should be set either to '0' or '1'.
-WARNING: $LIST_NAME: Setting REPLAY_PROTECTION to '0'."
+WARNING: $LIST_NAME: Setting REPLAY_PROTECTION to '0' for this run."
REPLAY_PROTECTION="0"
elif [[ -z "$REPLAY_PROTECTION" ]]; then
@@ -350,7 +350,7 @@ WARNING: $LIST_NAME: Setting REPLAY_PROTECTION to '0'."
LogMessage "\
WARNING: $LIST_NAME: REPLAY_COUNT should be a number.
-WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150'."
+WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150' for this run."
REPLAY_COUNT="150"
elif [[ -z "$REPLAY_COUNT" ]]; then
@@ -363,7 +363,7 @@ WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150'."
LogMessage "\
WARNING: $LIST_NAME: REPLAY_COUNT has to be greater than '0'.
-WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150'."
+WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150' for this run."
REPLAY_COUNT="150"
fi
@@ -375,6 +375,19 @@ WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150'."
REPLAY_FILE="$REPLAY_DEFAULT_FILE"
fi
+ touch "$REPLAY_FILE" 2> /dev/null
+ chown "$FIRMA_USER":"$FIRMA_GROUP" "$REPLAY_FILE" 2> /dev/null
+ chmod 600 "$REPLAY_FILE" 2> /dev/null
+
+ if [[ ! -r "$REPLAY_FILE" || ! -w "$REPLAY_FILE" ]]; then
+
+ LogMessage "\
+WARNING: $LIST_NAME: REPLAY_FILE ($REPLAY_FILE) can't be read or written to.
+WARNING: $LIST_NAME: Setting REPLAY_PROTECTION to '0' for this run."
+ REPLAY_PROTECTION="0"
+
+ fi
+
fi
# check DELIVERY_RANDOMIZATION value
@@ -384,7 +397,7 @@ WARNING: $LIST_NAME: Setting REPLAY_COUNT to '150'."
LogMessage "\
WARNING: $LIST_NAME: DELIVERY_RANDOMIZATION should be a number.
-WARNING: $LIST_NAME: Setting DELIVERY_RANDOMIZATION to '0'."
+WARNING: $LIST_NAME: Setting DELIVERY_RANDOMIZATION to '0' for this run."
DELIVERY_RANDOMIZATION="0"
else # DELIVERY_RANDOMIZATION is either empty (defaults to 0) or
@@ -402,7 +415,7 @@ WARNING: $LIST_NAME: Setting DELIVERY_RANDOMIZATION to '0'."
LogMessage "\
WARNING: $LIST_NAME: SILENTLY_DISCARD_INVALID_MESSAGES should be set either to '0' or '1'.
-WARNING: $LIST_NAME: Setting SILENTLY_DISCARD_INVALID_MESSAGES to '0'."
+WARNING: $LIST_NAME: Setting SILENTLY_DISCARD_INVALID_MESSAGES to '0' for this run."
SILENTLY_DISCARD_INVALID_MESSAGES="0"
elif [[ -z "$SILENTLY_DISCARD_INVALID_MESSAGES" ]]; then
@@ -1227,9 +1240,9 @@ function NewList {
# config file creation
if [[ "$return_code" == "0" ]]; then
echo "Creating your config..."
- touch $LIST_CONFIG_FILE
- chmod 600 $LIST_CONFIG_FILE
- chown $FIRMA_USER:$FIRMA_GROUP $LIST_CONFIG_FILE
+ touch $LIST_CONFIG_FILE 2> /dev/null
+ chmod 600 $LIST_CONFIG_FILE 2> /dev/null
+ chown $FIRMA_USER:$FIRMA_GROUP $LIST_CONFIG_FILE 2> /dev/null
if [[ -f "$LIST_CONFIG_FILE" ]]; then
DeclareGpgVars
echo -e "LIST_HOMEDIR='$LIST_HOMEDIR'\nLIST_ADDRESS='$LIST_ADDRESS'\nLIST_ADMIN='$LIST_ADMIN'\nPASSPHRASE='$PASSPHRASE'" > $LIST_CONFIG_FILE
@@ -1307,7 +1320,7 @@ EOF
done
# fix permissions
- chown -R $FIRMA_USER:$FIRMA_GROUP $LIST_HOMEDIR
+ chown -R $FIRMA_USER:$FIRMA_GROUP $LIST_HOMEDIR 2> /dev/null
echo "Your list was created. Now check its configuration at $LIST_CONFIG_FILE."
echo "To see a list of optional config parameters, type firma --help config."
@@ -1639,8 +1652,8 @@ function CheckListPermissions {
for file in $config pubring.gpg pubring.gpg~ random_seed secring.gpg trustdb.gpg; do
if ! CheckPermission $folder/$file; then
LogMessage "Fixing permission and ownership for $folder/$file"
- chmod 600 $folder/$file
- chown $FIRMA_USER:$FIRMA_GROUP $folder/$file
+ chmod 600 $folder/$file 2> /dev/null
+ chown $FIRMA_USER:$FIRMA_GROUP $folder/$file 2> /dev/null
fi
done
fi
@@ -1955,7 +1968,7 @@ function FixListOwnership {
#-------------------------------------------------------------
if [[ -d "$LIST_PATH" ]]; then
- chown -R $FIRMA_USER:$FIRMA_GROUP $LIST_PATH
+ chown -R $FIRMA_USER:$FIRMA_GROUP $LIST_PATH 2> /dev/null
fi
return $?
}
@@ -2414,9 +2427,9 @@ function ReplayProtectionFlush {
sed -i -e '1d' $REPLAY_FILE
fi
else
- touch $REPLAY_FILE
- chown $FIRMA_USER:$FIRMA_GROUP $REPLAY_FILE
- chmod 600 $REPLAY_FILE
+ touch $REPLAY_FILE 2> /dev/null
+ chown $FIRMA_USER:$FIRMA_GROUP $REPLAY_FILE 2> /dev/null
+ chmod 600 $REPLAY_FILE 2> /dev/null
fi
fi