Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
CA-25821: Don't pass non-file licence filenames to xe host-license-add
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Southgate committed Jan 17, 2009
1 parent fa4db29 commit 530f1c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion XSConsoleDialogueBases.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@ def UpdateFieldsCONFIRM(self):
if self.Custom('mode') == 'rw':
fileSize = ' ('+self.vdiMount.SizeString(self.filename, Lang('New file'))+')'
else:
fileSize = ' ('+self.vdiMount.SizeString(self.filename, Lang('File not found'))+')'
if self.filename == '':
fileSize = Lang(' (No file specified)')
elif os.path.isdir(self.filename):
fileSize = Lang(' (Directory)')
else:
fileSize = ' ('+self.vdiMount.SizeString(self.filename, Lang('File not found'))+')'

pane.AddWrappedBoldTextField(Lang("File"))
pane.AddWrappedTextField(self.filename+fileSize)
Expand Down
2 changes: 2 additions & 0 deletions plugins-base/XSFeatureInstallLicence.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def DoAction(self):

filename = self.vdiMount.MountedPath(self.filename)
FileUtils.AssertSafePath(filename)
if not os.path.isfile(filename):
raise Exception(Lang('Cannot read license file'))
command = "/opt/xensource/bin/xe host-license-add license-file='"+filename+"' host-uuid="+hostRef
status, output = commands.getstatusoutput(command)

Expand Down

0 comments on commit 530f1c4

Please sign in to comment.