]> gitweb.fluxo.info Git - firma.git/commitdiff
Message replay protection wasn't working at all. Fixed.
authorluis <luis>
Wed, 8 Aug 2007 04:51:14 +0000 (04:51 +0000)
committerluis <luis>
Wed, 8 Aug 2007 04:51:14 +0000 (04:51 +0000)
CHANGELOG
firma

index 2c98e0c0510e25bebceaa60dfd007e395a0ba5c1..3eb664b24a772cdc803a13f8f3d87f55eea5db95 100755 (executable)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,10 +1,15 @@
 Firma CHANGELOG
 ---------------
 
-07/08/2007 - 0.3-cvs (rev 1.173) - luis
+08/08/2007 - 0.3-cvs (rev 1.175) - luis
+
+  - Message replay protection wasn't working at all. Fixed.
 
   - SIGNATURE_MADE_BY_SENDER checking wasn't working. Fixed.
 
+  - REPLIES_SHOULD_GO_TO_LIST couldn't be disabled by setting
+    it to zero. Fixed.
+
   - Improved config files checking.
 
   - Improved logging/printing routine.
diff --git a/firma b/firma
index f72c54a8b1d6432f93e30191410cee90e0d5ae78..092eabb9a62d1512fd8ff540c258a74572e64f87 100755 (executable)
--- a/firma
+++ b/firma
@@ -2427,25 +2427,20 @@ function ReplayProtectionCheck {
   #          1 if message's sha1sum is in the database
   #-------------------------------------------------------------
 
+  local -i return_code=0
   local sha1
 
   if [[ "$REPLAY_PROTECTION" == "1" ]]; then
     ReplayProtectionFlush
-    sha1="$(echo $GPG_MESSAGE | sha1sum | cut -d " " -f 1)"
+    sha1="$(echo "$GPG_MESSAGE" | sha1sum | cut -d " " -f 1)"
     if grep -q "^$sha1$" $REPLAY_FILE; then
-      touch $REPLAY_FILE.tmp
-      chown $FIRMA_USER:$FIRMA_GROUP $REPLAY_FILE.tmp
-      chmod 600 $REPLAY_FILE.tmp
-      sed -e "/^$sha1$/d" $REPLAY_FILE > $REPLAY_FILE.tmp
-      mv -f $REPLAY_FILE.tmp $REPLAY_FILE
-      return 1
-    else
-      return 0
+      sed -i -e "/^$sha1$/d" $REPLAY_FILE
+      return_code=1
     fi
-    echo $sha1 >> $REPLAY_FILE
-  else
-    return 0
+    echo "$sha1" >> $REPLAY_FILE
   fi
+
+  return $return_code
 }
 
 #-------------------------------------------------------------
@@ -2535,7 +2530,9 @@ FUNCTIONS="
   SourceListConfig
   ConfigHelp
   AdminHelp
-  DeliveryRandomization"
+  DeliveryRandomization
+  ReplayProtectionFlush
+  ReplayProtectionCheck"
 
 for VAR in $GLOBAL_VARS; do
   declare $VAR