diff -u snort-2.8.5.2/debian/snort-mysql.postinst snort-2.8.5.2/debian/snort-mysql.postinst
--- snort-2.8.5.2/debian/snort-mysql.postinst
+++ snort-2.8.5.2/debian/snort-mysql.postinst
@@ -114,19 +114,20 @@
 		fi
 		echo " " >> $TEMPFILE
 		mv -f $TEMPFILE /etc/snort/database.conf
+	    fi # of if $RET
 
-		# Ensure the config file is readable by root.root and mode 600
-		if ! dpkg-statoverride --list /etc/snort/snort.conf >/dev/null
-		then
-			chown root:snort /etc/snort/snort.conf
-			chmod 640 /etc/snort/snort.conf
-		fi
-		if ! dpkg-statoverride --list /etc/snort/database.conf >/dev/null
-			chown root:snort /etc/snort/database.conf
-			chmod 640 /etc/snort/database.conf
-		fi
-	    fi
-	fi
+            # Ensure the config file is readable by root.root and mode 600
+            if ! dpkg-statoverride --list /etc/snort/snort.conf >/dev/null
+            then
+                chown root:snort /etc/snort/snort.conf
+                chmod 640 /etc/snort/snort.conf
+            fi
+            if ! dpkg-statoverride --list /etc/snort/database.conf >/dev/null
+            then
+                chown root:snort /etc/snort/database.conf
+                chmod 640 /etc/snort/database.conf
+            fi 
+	fi # of if $STARTUP
 	db_stop
 
 	# Check for left-over files from woody packages.
diff -u snort-2.8.5.2/debian/changelog snort-2.8.5.2/debian/changelog
--- snort-2.8.5.2/debian/changelog
+++ snort-2.8.5.2/debian/changelog
@@ -1,3 +1,11 @@
+snort (2.8.5.2-4) unstable; urgency=high
+
+  * debian/snort-{pgsql,mysql}.postinst: Fix syntax error in postinst scripts (Closes: 607678)
+
+ -- Javier Fernandez-Sanguino Pen~a <jfs@debian.org>  Wed, 22 Dec 2010 00:49:58 +0100
+
 snort (2.8.5.2-3) unstable; urgency=low
 
   * Move the database configuration code for the -mysql and -pgsql packages
diff -u snort-2.8.5.2/debian/snort-pgsql.postinst snort-2.8.5.2/debian/snort-pgsql.postinst
--- snort-2.8.5.2/debian/snort-pgsql.postinst
+++ snort-2.8.5.2/debian/snort-pgsql.postinst
@@ -111,7 +111,7 @@
 				echo -n "host=$DB_HOST " >> $TEMPFILE
 			fi
 			mv -f $TEMPFILE /etc/snort/database.conf
-		fi
+		fi # of  if $RET
 
 		# Ensure the config file is readable by root.root and mode 600
 		if ! dpkg-statoverride --list /etc/snort/snort.conf >/dev/null
@@ -120,11 +120,11 @@
 			chmod 640 /etc/snort/snort.conf
 		fi
 		if ! dpkg-statoverride --list /etc/snort/database.conf >/dev/null
+                then
 			chown root:snort /etc/snort/database.conf
 			chmod 640 /etc/snort/database.conf
 		fi
-	  fi
-	fi
+	fi # of if $STARTUP
 	db_stop
 
 	# Check for left-over files from woody packages.
