Skip to content

Commit

Permalink
fixed a bug where the relayevent.sh would compute a wrong signature with
Browse files Browse the repository at this point in the history
special characters in passwords
  • Loading branch information
ccrisan committed May 20, 2016
1 parent a141282 commit 2890653
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion motioneye/mediafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import logging
import multiprocessing
import os.path
import pipes
import re
import signal
import stat
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 10 additions & 1 deletion motioneye/relayevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
# 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
Expand Down
3 changes: 1 addition & 2 deletions motioneye/scripts/relayevent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


0 comments on commit 2890653

Please sign in to comment.