integ/base/lshell/files/lshell_cgcs.patch
Dean Troyer 3cd12006bb StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:35 -07:00

55 lines
2.5 KiB
Diff

Index: lshell-0.9.16/setup.py
===================================================================
--- lshell-0.9.16.orig/setup.py
+++ lshell-0.9.16/setup.py
@@ -40,10 +40,7 @@ choose a list of allowed commands for ev
scripts = ['bin/lshell'],
package_dir = {'lshell':'lshell'},
packages = ['lshell'],
- data_files = [('/etc', ['etc/lshell.conf']),
- ('/etc/logrotate.d', ['etc/logrotate.d/lshell']),
- ('share/doc/lshell',['README', 'COPYING', 'CHANGES']),
- ('share/man/man1/', ['man/lshell.1']) ],
+ data_files = [],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console'
Index: lshell-0.9.16/lshell/shellcmd.py
===================================================================
--- lshell-0.9.16.orig/lshell/shellcmd.py
+++ lshell-0.9.16/lshell/shellcmd.py
@@ -199,7 +199,7 @@ class ShellCmd(cmd.Cmd, object):
env = self.g_line.split(" ", 1)[1]
# if it conatins the equal sign, consider only the first one
if env.count('='):
- var, value = env.split(' ')[0].split('=')[0:2]
+ var, value = env.split('=', 1)
# expand values, if variable is surcharged by other variables
try:
import subprocess
@@ -212,7 +212,7 @@ class ShellCmd(cmd.Cmd, object):
cin, cout = os.popen2('`which echo` %s' % value)
value = cout.readlines()[0]
- os.environ.update({var: value})
+ os.environ.update({var: value.rstrip()})
def cd(self):
""" implementation of the "cd" command
@@ -361,7 +361,14 @@ class ShellCmd(cmd.Cmd, object):
# for all other commands check in allowed list
if command not in self.conf['allowed'] and command:
- return self.warn_count('command', oline, strict, ssh, command)
+ export_pattern = re.compile('^[a-zA-Z0-9\-\_]*=')
+ if export_pattern.match(oline):
+ self.g_cmd = 'export'
+ new_cmd_line = 'export ' + oline
+ self.g_line = new_cmd_line
+ self.check_secure(new_cmd_line, strict = strict)
+ else:
+ return self.warn_count('command', oline, strict, ssh, command)
return 0
def warn_count(self, messagetype, line=None, strict=None, ssh=None, command=None):