[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Jailkit-dev] more jk_jailuser bugs
From: |
Stephen Tallowitz |
Subject: |
Re: [Jailkit-dev] more jk_jailuser bugs |
Date: |
Fri, 11 Nov 2005 00:04:43 +0100 |
Olivier,
I have discovered some more bugs. I'm using python 2.4, just in case anyone is
wondering. Diff to fix some python errors is attached to this mail:
- I can only use exception class "IOError" with shutil.move().
- The "else" has to be added, otherwise python complains that movehome is not
initialised.
output produced with patched jk_jailuser:
-----
adding user jailtest to /srv/jaily/etc/passwd with shell /bin/bash
adding group users to /srv/jaily/etc/group
modify user jailtest; dir /srv/jaily/./home/jailtest/ and shell
/usr/sbin/jk_chrootsh
creating directory /srv/jaily/./home/jailtest
moving files from /home/jailtest/ to /srv/jaily/./home/jailtest/
Traceback (most recent call last):
File "/usr/sbin/jk_jailuser", line 254, in ?
main()
File "/usr/sbin/jk_jailuser", line 245, in main
jailuser(jail, username, movehome, config)
File "/usr/sbin/jk_jailuser", line 148, in jailuser
shutil.move(pw[5], newhome)
File "/usr/lib/python2.4/shutil.py", line 190, in move
copytree(src, dst, symlinks=True)
File "/usr/lib/python2.4/shutil.py", line 111, in copytree
os.mkdir(dst)
OSError: [Errno 17] File exists: '/srv/jaily/./home/jailtest/'
-----
I believe this is an error rooting in a problem called "trailing slash / no
trailing slash". Looking at /etc/passwd I noticed that all entries don't use a
trailing slash for the home directory of a user, whereas the jailkit entries do
use a trailing slash. Seeing that in jk_lib.py trailing slashes aren't removed
in the method nextpathup(), nextpathup() probably returns
/srv/jaily/./home/jailtest as the next path up of /srv/jaily/./home/jailtest/.
So /srv/jaily/./home/jailtest is created before shutil.move() is executed.
shutil.move() then complains about "File exists". Is my analysis correct? I
don't know if you want to correct this mistake in the /etc/passwd files,
jk_lib.py or jk_jailuser?
Then I have already mentioned something in my first mail about jk_jailuser. You
probably haven't had time to read it or I didn't express myself clearly enough:
When leaving out the "username" parameter on the commandline, nothing happens,
not even an error about the missing parameter. This could become confusing for
users (it has already confused me).
This is the last time I'll be nagging you today - it's quite late already.
Cheers,
Stephen
jk_jailuser.diff
Description: Text Data
- [Jailkit-dev] jk_jailuser bug fixed, Olivier Sessink, 2005/11/10
- Re: [Jailkit-dev] more jk_jailuser bugs,
Stephen Tallowitz <=
- Re: [Jailkit-dev] more jk_jailuser bugs, Stephen Tallowitz, 2005/11/10
- Re: [Jailkit-dev] more jk_jailuser bugs, Olivier Sessink, 2005/11/11
- Re: [Jailkit-dev] more jk_jailuser bugs, Olivier Sessink, 2005/11/13
- Re: [Jailkit-dev] more jk_jailuser bugs, Stephen Tallowitz, 2005/11/14
- Re: [Jailkit-dev] more jk_jailuser bugs, Olivier Sessink, 2005/11/14
- Re: [Jailkit-dev] more jk_jailuser bugs, Stephen Tallowitz, 2005/11/14
- Re: [Jailkit-dev] more jk_jailuser bugs, Olivier Sessink, 2005/11/14