[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Jailkit-dev] Auto find binaries in jk_cp
From: |
Markus Weippert |
Subject: |
[Jailkit-dev] Auto find binaries in jk_cp |
Date: |
Thu, 20 Jan 2011 15:25:11 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 |
Hi,
the promised function to find binaries automatically was broken in jk_cp in the
last release (2.13).
The fix also includes some other, minor things.
diff -ur jailkit-2.13/py/jk_check.in jailkit-2.13.patched/py/jk_check.in
--- jailkit-2.13/py/jk_check.in 2010-10-06 11:43:17.000000000 +0200
+++ jailkit-2.13.patched/py/jk_check.in 2011-01-20 00:46:38.380562824 +0100
@@ -35,14 +35,14 @@
import os
import string
from stat import *
-import md5
+import hashlib
import getopt
import random
import stat
INIPREFIX='/etc/jailkit'
LIBDIR='/usr/share/jailkit'
-EXEPREFIX='/usr'
+PREFIX='/usr'
sys.path.append(LIBDIR)
import jk_lib
@@ -54,7 +54,7 @@
def md5Digest(filename, startAt):
"""Returns md5 digest of a 1024 bytes blobk in filename, at position
startAt."""
t = 0
- m = md5.md5()
+ m = hashlib.md5()
f=open(filename, 'rb')
f.seek(startAt)
buf = f.read(1024)
@@ -211,8 +211,8 @@
# test if the user actually exists in the chroot
if (not jk_lib.test_user_exist(rpw[0], chroot+'/etc/passwd')):
print 'ERROR: user '+rpw[0]+' does not exist in
'+chroot+'/etc/passwd'
- chrootsh = os.path.join(PREFIX, '/sbin/jk_chrootsh')
- if (rpw[6].trim() != chrootsh):
+ chrootsh = os.path.join(PREFIX, 'sbin/jk_chrootsh')
+ if (rpw[6].strip() != chrootsh):
print 'ERROR: user '+rpw[0]+' has a /./ but does not have
the '+chrootsh+' shell'
rline = rep.readline()
return retval
diff -ur jailkit-2.13/py/jk_cp.in jailkit-2.13.patched/py/jk_cp.in
--- jailkit-2.13/py/jk_cp.in 2010-09-05 22:21:40.000000000 +0200
+++ jailkit-2.13.patched/py/jk_cp.in 2011-01-20 14:23:17.239367228 +0100
@@ -43,8 +43,7 @@
import jk_lib
def startcopy(config, chroot, filestocopy, checklibs=1):
- f2c2 = jk_lib.find_files_in_path(filestocopy)
- jk_lib.copy_binaries_and_libs(chroot,f2c2,config['force'] , config['verbose'], try_hardlink=config['hardlink'],
retain_owner=config['retainowner'])
+ jk_lib.copy_binaries_and_libs(chroot,filestocopy,config['force'] , config['verbose'],
try_hardlink=config['hardlink'], retain_owner=config['retainowner'])
jk_lib.gen_library_cache(chroot)
def usage():
@@ -106,6 +105,7 @@
if (jail == None and len(args)>0 ):
jail = args[0]
args = args[1:]
+ args = jk_lib.find_files_in_path(args)
testargs(jail, args)
if (jail[-1] != '/'): jail = jail+'/'
if (jk_lib.chroot_is_safe(jail)!=1):
diff -ur jailkit-2.13/py/jk_lib.py jailkit-2.13.patched/py/jk_lib.py
--- jailkit-2.13/py/jk_lib.py 2010-09-05 22:12:58.000000000 +0200
+++ jailkit-2.13.patched/py/jk_lib.py 2011-01-20 14:26:36.569864574 +0100
@@ -97,7 +97,7 @@
return retval
npath = os.path.dirname(path)
while (npath != '/'):
- print npath
+ #print npath
retval = path_is_safe(npath,0)
if (retval != 1):
# print 'testing path='+npath+'returned '+str(retval)
- [Jailkit-dev] Auto find binaries in jk_cp,
Markus Weippert <=