Re: [Spacewalk-devel] spacecmd - new functions patch

2013-08-05 Thread Tomáš Kašpárek

Hello Gregor,

I've reviewed your patch and committed it into Spacewalk master as 
b734d823d36921e4e36ae165bd1fa3e6122ee098.
For future patches please don't change the specfile and 
rel-eng/packages/* as this is done automatically.


Thanks for contribution!

On 08/01/2013 09:58 AM, Gregor Gruener wrote:

Hi spacewalkers,

I've updated the spacecmd misc.py file, to add new functions like 
is_monitoringenabled and list_proxies.

Can you review and add this patch upstream.

Cheers,
Gregor Grüner


___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel



--
Tomáš Kašpárek
Red Hat Satellite 5, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] [PATCH] Fix html not being escaped in package information

2013-08-05 Thread Johannes Renner
Hello,

here is another small bugfix patch fixing HTML not being properly escaped
in package description on this page:

https://hostname/rhn/software/packages/Details.do?pid=pid

Found that with a package where there was an email address in ...
notation that didn't show up.

Thanks and regards,
Johannes

-- 
SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg)
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
From 63be1b2d99b4a594e3cd198565ea5a13197aae87 Mon Sep 17 00:00:00 2001
From: Johannes Renner jren...@suse.de
Date: Mon, 5 Aug 2013 15:42:53 +0200
Subject: [PATCH] Fix HTML not being escaped in package information

---
 .../redhat/rhn/frontend/action/rhnpackage/PackageDetailsAction.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/PackageDetailsAction.java b/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/PackageDetailsAction.java
index b94830c..cf9f7f8 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/PackageDetailsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/PackageDetailsAction.java
@@ -30,6 +30,7 @@ import com.redhat.rhn.frontend.xmlrpc.NoSuchPackageException;
 import com.redhat.rhn.manager.download.DownloadManager;
 import com.redhat.rhn.manager.rhnpackage.PackageManager;
 
+import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -125,8 +126,8 @@ public class PackageDetailsAction extends RhnAction {
 request.setAttribute(pack, pkg);
 // description can be null.
 if (pkg.getDescription() != null) {
-request.setAttribute(description,
-pkg.getDescription().replace(\n, BR\n));
+String description = StringEscapeUtils.escapeHtml(pkg.getDescription());
+request.setAttribute(description, description.replace(\n, BR\n));
 }
 else {
 request.setAttribute(description,
-- 
1.8.1.4

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] spacecmd - Added new scap features

2013-08-05 Thread Gregor Gruener

Hi Spacewalkers,

I have added a few completely new openscap functions to spacecmd. The 
new file scap.py contains the new functions:

scap_getxccdfscandetails
scap_getxccdfscanruleresults
scap_listxccdfscans
scap_schedulexccdfscan

Can you review and add this patch upstream.

Cheers,
Gregor Grüner
From 297a9818d98864e6549429c79af983bbd75466c5 Mon Sep 17 00:00:00 2001
From: Gregor Gruener ggru...@redhat.com
Date: Mon, 5 Aug 2013 19:50:12 +0200
Subject: [PATCH] Added new scap features into spacecmd

---
 spacecmd/spacecmd.spec|  11 +++-
 spacecmd/src/lib/scap.py  | 158 ++
 spacecmd/src/lib/shell.py |   2 +-
 3 files changed, 168 insertions(+), 3 deletions(-)
 create mode 100644 spacecmd/src/lib/scap.py

diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index ecb6b23..5b2d82d 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -64,8 +64,15 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
 %doc %{_mandir}/man1/spacecmd.1.gz
 
 %changelog
-* Mon Aug 05 2013 Gregor Gruener ggru...@redhat.com
-- spacecmd - add new function is_monitoringenabled and list_proxies
+* Mon Aug 05 2013 Gregor Gruener ggru...@redhat.com 2.1.3-1
+- add new function scap_listxccdfscans
+- add new function scap_getxccdfscandetails
+- add new function scap_getxccdfscanruleresults
+- add new function scap_schedulexccdfscan
+
+* Mon Aug 05 2013 Gregor Gruener ggru...@redhat.com 2.1.2-1
+- add new function is_monitoringenabled
+- add new function list_proxies
 
 * Mon Jul 22 2013 Gregor Gruener ggru...@redhat.com 2.1.1-1
 - add new function custominfo_updatekey
diff --git a/spacecmd/src/lib/scap.py b/spacecmd/src/lib/scap.py
new file mode 100644
index 000..4be6512
--- /dev/null
+++ b/spacecmd/src/lib/scap.py
@@ -0,0 +1,158 @@
+#
+# Licensed under the GNU General Public License Version 3
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright 2013 Aron Parsons aronpars...@gmail.com
+# Copyright (c) 2013 Red Hat, Inc.
+#
+
+# NOTE: the 'self' variable is an instance of SpacewalkShell
+
+from optparse import Option
+from spacecmd.utils import *
+
+def help_scap_listxccdfscans(self):
+print 'scap_listxccdfscans: Return a list of finished OpenSCAP scans for given systems'
+print 'usage: scap_listxccdfscans SYSTEMS'
+
+def complete_system_scap_listxccdfscans(self, text, line, beg, end):
+return self.tab_complete_systems(text)
+
+def do_scap_listxccdfscans(self, args):
+(args, options) = parse_arguments(args)
+
+if not len(args):
+self.help_scap_listxccdfscans()
+return
+
+# use the systems listed in the SSM
+if re.match('ssm', args[0], re.I):
+systems = self.ssm.keys()
+else:
+systems = self.expand_systems(args)
+
+add_separator = False
+
+for system in sorted(systems):
+if add_separator: print self.SEPARATOR
+add_separator = True
+
+if len(systems)  1:
+print 'System: %s' % system
+print
+
+system_id = self.get_system_id(system)
+if not system_id: continue
+
+scan_list = self.client.system.scap.listXccdfScans(self.session, system_id)
+
+for s in scan_list:
+print 'XID: %d Profile: %s Path: (%s) Completed: %s' % (s['xid'], s['profile'], s['path'], s['completed'])
+
+
+
+def help_scap_getxccdfscanruleresults(self):
+print 'scap_getxccdfscanruleresults: Return a full list of RuleResults for given OpenSCAP XCCDF scan'
+print 'usage: scap_getxccdfscanruleresults XID'
+
+def do_scap_getxccdfscanruleresults(self, args):
+(args, options) = parse_arguments(args)
+
+if not len(args):
+self.help_scap_getxccdfscanruleresults()
+return
+
+add_separator = False
+
+for xid in args:
+if add_separator: print self.SEPARATOR
+add_separator = True
+
+if len(args)  1:
+print 'XID: %s' % xid
+print
+
+xid = int(xid)
+scan_results = self.client.system.scap.getXccdfScanRuleResults(self.session, xid)
+
+for s in scan_results:
+print 'IDref: %s Result: %s Idents: (%s)' % (s['idref'], s['result'], s['idents'])
+
+
+
+def help_scap_getxccdfscandetails(self):
+print