From 6eed7014c45b3b66a36c0e9ddc3c9fc61611f554 Mon Sep 17 00:00:00 2001 From: Len Kawamoto Date: Wed, 7 Jun 2017 15:32:04 -0700 Subject: [PATCH] Fixed regex pattern for extracting username from /proc/mounts The previous pattern truncated a valid username which contained a hyphen (not as the first character) which resulted in MotionEye repeatedly try to unmount a "no longer necessary" mount point which didn't exist. The end result was that the live preview video switched to the "No Camera" icon, no live preview was showing on the web interface, and no still images nor motion detected movies were being stored in the Network Storage folder. The previous pattern of "[\w\s]+" (1 more occurrence of alpha, number, underscore, or any white space) seemed incorrect to me... though I'm not as familiar with non-Linux usernames nor what restrictions exist for usernames in CIFS mounting. I simply used the default NAME_REGEX pattern specified in /usr/share/adduser/adduser.conf See github issue #356 (https://github.com/ccrisan/motioneyeos/issues/356) and the follow-up google forums post (https://groups.google.com/forum/#!topic/motioneye/0Cve8obKAX8) for more history on this issue. --- motioneye/smbctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motioneye/smbctl.py b/motioneye/smbctl.py index a79e03f..894fbe5 100644 --- a/motioneye/smbctl.py +++ b/motioneye/smbctl.py @@ -94,7 +94,7 @@ def list_mounts(): server, share = match.groups() share = share.replace('\\040', ' ') # spaces are reported oddly by /proc/mounts - match = re.search('username=([\w\s]+)', opts) + match = re.search('username=([a-z][-\w]*)', opts) if match: username = match.group(1) -- 2.39.5