]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
dd-schroot-cmd: Relax session name check
authorJames McCoy <jamessan@debian.org>
Wed, 31 Dec 2014 03:01:18 +0000 (22:01 -0500)
committerPaul Wise <pabs@debian.org>
Wed, 31 Dec 2014 05:22:53 +0000 (13:22 +0800)
As per schroot.conf(5):

  A  number  of characters or words are not permitted in a chroot name,
  session name or configuration filename.  The name may not contain a
  leading period (‘.’).  The characters ‘:’ (colon), ‘,’ (comma) and ‘/’
  (forward slash) are not permitted anywhere in the name.  The name may
  also not contain  a  trailing  tilde  (‘~’).

Relaxing the session name check in get_session_owner to better align
with schroot's actual restrictions reduces the chance that a user will
create a session yet be unable to manipulate it with dd-schroot-cmd.

Signed-off-by: James McCoy <jamessan@debian.org>
Signed-off-by: Paul Wise <pabs@debian.org>
modules/porterbox/files/dd-schroot-cmd

index 6506b6ed10b4ab62f7f44bfe9555cc840e7f5842..598fb12589b5dc57f86aea508345482fa1c6b551 100755 (executable)
@@ -56,7 +56,7 @@ def die(s):
     sys.exit(1)
 
 def get_session_owner(session):
-    if re.search('[^0-9a-zA-Z_-]', session):
+    if re.search('^\.|~$|[^0-9a-zA-Z_.~-]', session):
         die("Invalid session name.")
 
     path = os.path.join('/var/lib/schroot/session', session)