summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-info
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbin/bcfg2-info')
-rwxr-xr-xsrc/sbin/bcfg2-info14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 4b26d7890..31a5ff0f9 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -103,8 +103,16 @@ Usage: [quit|exit]"""
def do_build(self, args):
'''build client configuration'''
- if len(args.split()) == 2:
- client, ofile = args.split()
+ alist = args.split()
+ path_force = False
+ if '-f' in args:
+ alist.remove('-f')
+ path_force = True
+ if len(alist) == 2:
+ client, ofile = alist
+ if not ofile.startswith('/tmp') and not path_force:
+ print("Refusing to write files outside of /tmp without -f option")
+ return
output = open(ofile, 'w')
data = lxml.etree.tostring(self.BuildConfiguration(client),
encoding='UTF-8', xml_declaration=True,
@@ -112,7 +120,7 @@ Usage: [quit|exit]"""
output.write(data)
output.close()
else:
- print('Usage: build <hostname> <output file>')
+ print('Usage: build [-f] <hostname> <output file>')
def do_buildall(self, args):
if len(args.split()) != 1: