You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/08/27 20:09:34 UTC

git commit: AMBARI-3039: Security wizard configurations should escape special XML chars. (jaimin)

Updated Branches:
  refs/heads/trunk 88d69cb56 -> 3bc5effcf


AMBARI-3039: Security wizard configurations should escape special XML chars. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/3bc5effc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/3bc5effc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/3bc5effc

Branch: refs/heads/trunk
Commit: 3bc5effcfaa139b353d04632af6aea7d12e35c35
Parents: 88d69cb
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Tue Aug 27 11:07:40 2013 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Tue Aug 27 11:07:40 2013 -0700

----------------------------------------------------------------------
 .../app/controllers/main/admin/security/add/step4.js   | 13 +++++++++++++
 .../app/controllers/main/admin/security/disable.js     | 12 ++++++++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3bc5effc/ambari-web/app/controllers/main/admin/security/add/step4.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step4.js b/ambari-web/app/controllers/main/admin/security/add/step4.js
index 4d7c464..caccb82 100644
--- a/ambari-web/app/controllers/main/admin/security/add/step4.js
+++ b/ambari-web/app/controllers/main/admin/security/add/step4.js
@@ -598,6 +598,7 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
       _tag.configs = data.items.findProperty('type', _tag.siteName).properties;
     }, this);
     if (this.addSecureConfigs()) {
+      this.escapeXMLCharacters(this.get('serviceConfigTags'));
       this.applyConfigurationsToCluster();
     }
   },
@@ -612,6 +613,18 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
     console.log("TRACE: error code status is: " + request.status);
   },
 
+  /*
+    Iterate over keys of all configurations and escape xml characters in their values
+   */
+  escapeXMLCharacters: function(serviceConfigTags) {
+    serviceConfigTags.forEach(function (_serviceConfigTags) {
+      var configs = _serviceConfigTags.configs;
+        for (var key in configs) {
+          configs[key] =  App.config.escapeXMLCharacters(configs[key]);
+        }
+    },this);
+  },
+
   addSecureConfigs: function () {
     try {
       this.get('serviceConfigTags').forEach(function (_serviceConfigTags) {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3bc5effc/ambari-web/app/controllers/main/admin/security/disable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/disable.js b/ambari-web/app/controllers/main/admin/security/disable.js
index 6b397af..b9bdeae 100644
--- a/ambari-web/app/controllers/main/admin/security/disable.js
+++ b/ambari-web/app/controllers/main/admin/security/disable.js
@@ -286,6 +286,7 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
       _tag.configs = data.items.findProperty('type', _tag.siteName).properties;
     }, this);
     if (this.removeSecureConfigs()) {
+      this.escapeXMLCharacters(this.get('serviceConfigTags'));
       this.applyConfigurationsToCluster();
     }
   },
@@ -355,6 +356,17 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
     }
   },
 
+  /*
+   Iterate over keys of all configurations and escape xml characters in their values
+   */
+  escapeXMLCharacters: function(serviceConfigTags) {
+    serviceConfigTags.forEach(function (_serviceConfigTags) {
+      var configs = _serviceConfigTags.configs;
+      for (var key in configs) {
+        configs[key] =  App.config.escapeXMLCharacters(configs[key]);
+      }
+    },this);
+  },
 
   removeSecureConfigs: function () {
     try {