]> www.vanbest.org Git - motioneye-debian/commitdiff
fixed a bug where the relayevent.sh would compute a wrong signature with
authorCalin Crisan <ccrisan@gmail.com>
Fri, 20 May 2016 09:36:45 +0000 (12:36 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Fri, 20 May 2016 09:36:45 +0000 (12:36 +0300)
special characters in passwords

motioneye/mediafiles.py
motioneye/relayevent.py
motioneye/scripts/relayevent.sh

index 28cb1a09d925c11bc3af4aee1b56a9887fc3dc05..398b62bf6e2339ad96979b4abb978813b0de4f41 100644 (file)
@@ -23,6 +23,7 @@ import hashlib
 import logging
 import multiprocessing
 import os.path
+import pipes
 import re
 import signal
 import stat
@@ -211,7 +212,7 @@ def make_movie_preview(camera_config, full_path):
             'path': full_path, 'offs': offs})
 
     cmd = 'ffmpeg -i %(path)s -f mjpeg -vframes 1 -ss %(offs)s -y %(path)s.thumb'
-    actual_cmd = cmd % {'path': full_path, 'offs': offs}
+    actual_cmd = cmd % {'path': pipes.quote(full_path), 'offs': offs}
     logging.debug('running command "%s"' % actual_cmd)
     
     try:
index fa48320fd9def62d353c2bbd54a6e0c483d5279e..cbae71ec31e1949ad63795b7018e2d6064d435b6 100644 (file)
 # GNU General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+
+# THIS SCRIPT IS NO LONGER USED BUT IS KEPT FOR COMPATIBILITY REASONS,
+# AS OLDER CONFIGS MIGHT STILL REFERENCE IT
+# NEWER CONFIGS WILL USE motioneye/scripts/relayevent.sh,
+# AS IT'S CONSIDERABLY FASTER 
+
+
 
 import errno
 import json
index b1d1609ad2e7ab38f4b222a807f5e739dfdf38e6..5d4113a7082b903e44c9048ff514acf750f4ae0f 100755 (executable)
@@ -13,7 +13,7 @@ if [ -f "$motioneye_conf" ]; then
         motion_conf="$conf_path/motion.conf"
         if [ -r "$motion_conf" ]; then
             username=$(cat $motion_conf | grep 'admin_username' | cut -d ' ' -f 3)
-            password=$(cat $motion_conf | grep 'admin_password' | cut -d ' ' -f 3)
+            password=$(cat $motion_conf | grep 'admin_password' | cut -d ' ' -f 3 | sed -r 's/[^a-zA-Z0-9\/?_.=&{}":, _]/-/g')
         fi
     fi
 fi
@@ -31,4 +31,3 @@ signature=$(echo -n "POST:$uri:$data:$password" | sha1sum | cut -d ' ' -f 1)
 
 curl -H "Content-Type: application/json" -X POST "http://127.0.0.1:$port$uri&_signature=$signature" -d "$data" &>/dev/null
 
-