From 0407a874137a268247485ec29a95ce3f17ab015e Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Sun, 7 Nov 2010 11:30:14 +0100 Subject: [PATCH] =?UTF-8?q?[chsh]=20On=20=C3=A9vite=20que=20les=20gens=20s?= =?UTF-8?q?e=20mettent=20rssh=20comme=20login=20shell...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit darcs-hash:20101107103014-ffbb2-bb528dc7d2c60b182f64e94caacbac845db6f6e5.gz --- gestion/chsh.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gestion/chsh.py b/gestion/chsh.py index aaca8f49..75eda1ea 100644 --- a/gestion/chsh.py +++ b/gestion/chsh.py @@ -38,9 +38,11 @@ fd=open('/etc/shells') lines=fd.readlines() fd.close() -if not shell in map(str.strip,lines) : +shells = [line for line in lines if not (line.startswith('#') or line.endswith('/rssh'))] + +if not shell in shells: print 'Shell invalide. Les shells valides sont :' - print ''.join(lines[1:]) + print ''.join(shells) sys.exit(4) adh.chsh(shell)