[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Jailkit-dev] more jk_jailuser bugs
From: |
Olivier Sessink |
Subject: |
Re: [Jailkit-dev] more jk_jailuser bugs |
Date: |
Fri, 11 Nov 2005 19:59:55 +0100 |
User-agent: |
Debian Thunderbird 1.0.7 (X11/20051010) |
Stephen Tallowitz wrote:
>> 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.
fixed that!
I cannot reproduce the problem however, see my output:
aria:/home/olivier/cvsjailkit/py# ./jk_jailuser.in -v -j /home/jail -m
olitest
user olitest already exists in /home/jail/etc/passwd
modify user olitest; dir /home/jail/./home/olitest/ and shell
/usr/sbin/jk_chrootsh
creating directory /home/jail/./home/olitest
moving files from /home/olitest/ to /home/jail/./home/olitest/
aria:/home/olivier/cvsjailkit/py#
so that works here, python 2.3.5
I only can see the problem if the destination directory exists *and* it
contains files:
mkdir /home/jail/home/olitest
./jk_jailuser.in -j /home/jail -m olitest
works fine, BUT:
mkdir /home/jail/home/olitest
touch /home/jail/home/olitest/helllo
./jk_jailuser.in -j /home/jail -m olitest
Traceback (most recent call last):
File "./jk_jailuser.in", line 258, in ?
main()
File "./jk_jailuser.in", line 249, in main
jailuser(jail, username, movehome, config)
File "./jk_jailuser.in", line 148, in jailuser
shutil.move(pw[5], newhome)
File "/usr/lib/python2.3/shutil.py", line 171, in move
copytree(src, dst, symlinks=True)
File "/usr/lib/python2.3/shutil.py", line 102, in copytree
os.mkdir(dst)
OSError: [Errno 17] File exists: '/home/jail/./home/olitest/'
>> 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.
I've tried with and without trailing slash in the original home directory.
>> 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?
I think that all jailkit programs should work, regardless if the
directories are used with a trailing slash or not. But can you re-try if
the directory possibly contained files already (possible hidden files?)
>> 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).
fixed!
thanks for all your feedback and testing!
Olivier
- [Jailkit-dev] jk_jailuser bug fixed, Olivier Sessink, 2005/11/10
- Re: [Jailkit-dev] more jk_jailuser bugs, Stephen Tallowitz, 2005/11/10
- Re: [Jailkit-dev] more jk_jailuser bugs, Stephen Tallowitz, 2005/11/10
- Re: [Jailkit-dev] more jk_jailuser bugs,
Olivier Sessink <=
- 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