Skip to content

Commit adabc6c

Browse files
grembodgeo
authored andcommitted
Prevent slashes in jail names when checking existence
Specifically trailing slashes cause issues, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275738 Affects commands like console, start etc. Jail creation is already covered by a strict regex, see ioc_create.py.
1 parent a414851 commit adabc6c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

iocage_lib/iocage.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ def __check_jail_existence__(self):
252252
tuple: The jails uuid, path
253253
"""
254254

255+
if '/' in self.jail:
256+
msg = f"jail '{self.jail}' not found ('/' not allowed in jail name)!"
257+
258+
ioc_common.logit(
259+
{
260+
"level": "EXCEPTION",
261+
"message": msg
262+
},
263+
_callback=self.callback,
264+
silent=self.silent)
265+
return
266+
255267
if os.path.isdir(f"{self.iocroot}/jails/{self.jail}"):
256268
path = f"{self.iocroot}/jails/{self.jail}"
257269

0 commit comments

Comments
 (0)