cluster: STABLE31 - config: fix escaping of xml special characters
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ccfe7c7037d784cd4b004a4ff808f93517738247
Parent: 538becbe4b3779bf8173e6c09164aa7c8d5521ad
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Thu Aug 4 12:19:44 2011 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Thu Aug 4 12:19:44 2011 +0200
config: fix escaping of xml special characters
when transforming config data from objdb to xml, we need to parse CDATA sections
for &<>"' chars and make sure the are correctly transformed into escaped versions
or xml parser will refuse to load.
Resolves: rhbz#726065
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
config/libs/libccsconfdb/fullxpath.c | 34 +++++++++++++++++++++++++++++++++-
config/tools/xml/ccs_config_dump.c | 28 +++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/config/libs/libccsconfdb/fullxpath.c b/config/libs/libccsconfdb/fullxpath.c
index 994c8d8..577c74a 100644
--- a/config/libs/libccsconfdb/fullxpath.c
+++ b/config/libs/libccsconfdb/fullxpath.c
@@ -73,10 +73,42 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
confdb_key_iter(dump_handle, parent_object_handle, key_name,
&key_name_len, key_value,
&key_value_len)) == CS_OK) {
+ int char_pos = 0;
key_name[key_name_len] = '\0';
key_value[key_value_len] = '\0';
- snprintf(temp, PATH_MAX - 1, " %s=\"%s\"", key_name, key_value);
+ snprintf(temp, PATH_MAX - 1, " %s=\"", key_name);
+ if (add_to_buffer(temp, buffer, bufsize))
+ return -1;
+
+ for (char_pos = 0; char_pos < key_value_len-1; char_pos++) {
+ switch (key_value[char_pos]) {
+
+ case '&':
+ snprintf(temp, PATH_MAX - 1, "&");
+ break;
+ case '<':
+ snprintf(temp, PATH_MAX - 1, "<");
+ break;
+ case '>':
+ snprintf(temp, PATH_MAX - 1, ">");
+ break;
+ case '"':
+ snprintf(temp, PATH_MAX - 1, """);
+ break;
+ case '\'':
+ snprintf(temp, PATH_MAX - 1, "'");
+ break;
+ default:
+ temp[0] = key_value[char_pos];
+ temp[1] = '\0';
+ break;
+ }
+ if (add_to_buffer(temp, buffer, bufsize))
+ return -1;
+ }
+
+ snprintf(temp, PATH_MAX - 1, "\"");
if (add_to_buffer(temp, buffer, bufsize))
return -1;
}
diff --git a/config/tools/xml/ccs_config_dump.c b/config/tools/xml/ccs_config_dump.c
index b6fe742..74c33c2 100644
--- a/config/tools/xml/ccs_config_dump.c
+++ b/config/tools/xml/ccs_config_dump.c
@@ -25,9 +25,35 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
while (confdb_key_iter(dump_handle, parent_object_handle, key_name,
&key_name_len, key_value,
&key_value_len) == CS_OK) {
+ int char_pos = 0;
+
key_name[key_name_len] = '\0';
key_value[key_value_len] = '\0';
- printf(" %s=\"%s\"", key_name, key_value);
+ printf(" %s=\"", key_name);
+ for (char_pos = 0; char_pos < key_value_len-1; char_pos++) {
+ switch (key_value[char_pos]) {
+
+ case '&':
+ printf("&");
+ break;
+ case '<':
+ printf("<");
+ break;
+ case '>':
+ printf(">");
+ break;
+ case '"':
+ printf(""");
+ break;
+ case '\'':
+ printf("'");
+ break;
+ default:
+ putchar(key_value[char_pos]);
+ break;
+ }
+ }
+ printf("\"");
}
if (confdb_object_iter_start(dump_handle, parent_object_handle) != CS_OK)
12 years, 9 months
gfs2-utils: master - tunegfs2: Add some malloc error checking
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 2d2b671fc8118f4896b9cfdd33c1631a850ae42b
Parent: c7c11093e8182f27ad543457028a7ccbd9f00212
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Aug 4 10:39:05 2011 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Aug 4 10:44:53 2011 +0100
tunegfs2: Add some malloc error checking
Static analysis found a possible null pointer dereference due to a
missing check in read_super. The malloc'd memory was also not being
freed on error conditions. This patch adds a check for a null pointer
and frees the allocated memory.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/tune/super.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
index 65e8d5b..49d87d6 100644
--- a/gfs2/tune/super.c
+++ b/gfs2/tune/super.c
@@ -94,14 +94,21 @@ int read_super(struct tunegfs2 *tfs)
int n;
tfs->sb_start = GFS2_SB_ADDR << GFS2_BASIC_BLOCK_SHIFT;
block = malloc(sizeof(char) * GFS2_DEFAULT_BSIZE);
+ if (!block) {
+ perror("read_super: malloc");
+ return EX_UNAVAILABLE;
+ }
n = pread(tfs->fd, block, GFS2_DEFAULT_BSIZE, tfs->sb_start);
if (n < 0) {
perror("read_super: pread");
+ free(block);
return EX_IOERR;
}
tfs->sb = block;
if (be32_to_cpu(tfs->sb->sb_header.mh_magic) != GFS2_MAGIC) {
fprintf(stderr, _("Not a GFS/GFS2 device\n"));
+ tfs->sb = NULL;
+ free(block);
return EX_IOERR;
}
/* Ensure that table and proto are NULL terminated */
12 years, 9 months
fence-agents: RHEL6 - fence_kdump: Fix metadata
by rohara
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 4b90f43b77f9a44e6239d0d3b6a02cfccf4ee1f5
Parent: 15860efcf92300d52fda31386efa1e5b0efdbc98
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Aug 1 15:33:50 2011 -0400
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Aug 2 10:59:13 2011 -0500
fence_kdump: Fix metadata
Having duplicate "verbose" parameters is not valid.
Resolves: rhbz#461948
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/kdump/fence_kdump.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/kdump/fence_kdump.c b/fence/agents/kdump/fence_kdump.c
index 8fdb681..2844a3e 100644
--- a/fence/agents/kdump/fence_kdump.c
+++ b/fence/agents/kdump/fence_kdump.c
@@ -230,7 +230,7 @@ do_action_metadata (const char *self)
"Print version");
fprintf (stdout, "\t</parameter>\n");
- fprintf (stdout, "\t<parameter name=\"verbose\" unique=\"1\" required=\"0\">\n");
+ fprintf (stdout, "\t<parameter name=\"usage\" unique=\"1\" required=\"0\">\n");
fprintf (stdout, "\t\t<getopt mixed=\"-h, --help\" />\n");
fprintf (stdout, "\t\t<content type=\"boolean\" />\n");
fprintf (stdout, "\t\t<shortdesc lang=\"en\">%s</shortdesc>\n",
12 years, 9 months
fence-agents: master - fence_kdump: Fix metadata
by rohara
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 412aa5cd03d6ef556997294f8f1346795f93ffd1
Parent: cb379c612524d6494c94153525699deb9712d028
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Aug 1 15:33:50 2011 -0400
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Aug 2 10:55:48 2011 -0500
fence_kdump: Fix metadata
Having duplicate "verbose" parameters is not valid.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/kdump/fence_kdump.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/kdump/fence_kdump.c b/fence/agents/kdump/fence_kdump.c
index 8fdb681..2844a3e 100644
--- a/fence/agents/kdump/fence_kdump.c
+++ b/fence/agents/kdump/fence_kdump.c
@@ -230,7 +230,7 @@ do_action_metadata (const char *self)
"Print version");
fprintf (stdout, "\t</parameter>\n");
- fprintf (stdout, "\t<parameter name=\"verbose\" unique=\"1\" required=\"0\">\n");
+ fprintf (stdout, "\t<parameter name=\"usage\" unique=\"1\" required=\"0\">\n");
fprintf (stdout, "\t\t<getopt mixed=\"-h, --help\" />\n");
fprintf (stdout, "\t\t<content type=\"boolean\" />\n");
fprintf (stdout, "\t\t<shortdesc lang=\"en\">%s</shortdesc>\n",
12 years, 9 months
cluster: RHEL6 - rgmanager: Fix race in shutdown vs. notification
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 53d23b0172773b2a17bb2a019d4bbc2118d9e307
Parent: ad95ee30836d14185885596b64ee4cff30729c51
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Aug 2 09:53:20 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Aug 2 11:15:30 2011 -0400
rgmanager: Fix race in shutdown vs. notification
The check of db prior to taking the mutex was done as a tiny performance
gain in the event that there was no dbus connection, but causes
dbus_connection_get_is_connected() to crash the program if db is NULL.
Resolves: rhbz#697446
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index f465d1d..bff1644 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -149,12 +149,12 @@ _rgm_dbus_notify(const char *svcname,
DBusMessage *msg = NULL;
int ret = -1;
+ pthread_mutex_lock(&mu);
+
if (!db) {
- goto out_free;
+ goto out_unlock;
}
- pthread_mutex_lock(&mu);
-
/* Check to ensure the connection is still valid. If it
* isn't, clean up and shut down the dbus connection.
*
12 years, 9 months
cluster: RHEL6 - config: Add 'disabled' flag to rm element
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ad95ee30836d14185885596b64ee4cff30729c51
Parent: 3c0c6c699eeb23c55496bb587133e98f1d6d2a76
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Thu Jul 21 11:21:43 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Aug 2 11:15:17 2011 -0400
config: Add 'disabled' flag to rm element
Related: rhbz#723925
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
config/tools/xml/cluster.rng.in.head | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/config/tools/xml/cluster.rng.in.head b/config/tools/xml/cluster.rng.in.head
index f9606ad..7696533 100644
--- a/config/tools/xml/cluster.rng.in.head
+++ b/config/tools/xml/cluster.rng.in.head
@@ -869,6 +869,11 @@ To validate your cluster.conf against this schema, run:
of the following keywords: auth, authpriv, cron, daemon, kern,
lpr, mail, news, syslog, user, uucp and local0 through local7"/>
</optional>
+ <optional>
+ <attribute name="disabled" rha:description="Disables rgmanager entirely if set to 1. Do not set unless you really mean it." rha:sample="">
+ <data type="integer"/>
+ </attribute>
+ </optional>
<interleave>
<optional>
<element name="failoverdomains" rha:description="Failover domain definitions.">
12 years, 9 months
cluster: RHEL6 - rgmanager: Add 'disabled' configuration option
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3c0c6c699eeb23c55496bb587133e98f1d6d2a76
Parent: a727ea072c9d108301266828d9d10e68c4ca0100
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Jul 27 13:42:55 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Aug 2 11:15:06 2011 -0400
rgmanager: Add 'disabled' configuration option
The option turns off rgmanager, which will shut down if
running and cause rgmanager to refuse to start if
starting up.
Resolves: rhbz#723925
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/main.c | 51 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 3c39c46..38c7007 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -745,6 +745,14 @@ event_loop(msgctx_t *localctx, msgctx_t *clusterctx)
if (need_reconfigure) {
need_reconfigure = 0;
configure_rgmanager(-1, 0, NULL);
+
+ /*
+ * A shutdown during reconfiguration would slow down
+ * the exit request, so it's pointless to run the
+ * deltas at this point
+ */
+ if (shutdown_pending)
+ return 0;
config_event_q();
return 0;
}
@@ -778,7 +786,6 @@ cleanup(msgctx_t *clusterctx)
}
-
static void
statedump(int __attribute__ ((unused)) sig)
{
@@ -786,6 +793,36 @@ statedump(int __attribute__ ((unused)) sig)
}
+static int
+rgmanager_disabled(int ccsfd)
+{
+ char *v;
+ int disabled = 0;
+ int internal;
+
+ if (ccsfd < 0) {
+ internal = 1;
+ ccsfd = ccs_force_connect(NULL, 0);
+ if (ccsfd < 0)
+ return -1;
+ }
+
+ if (ccs_get(ccsfd, "/cluster/rm/@disabled", &v) == 0) {
+ if (atoi(v) == 1) {
+ disabled = 1;
+ shutdown_pending = 1;
+ logt_print(LOG_NOTICE, "Resource Group Manager Disabled\n");
+ }
+ free(v);
+ }
+
+ if (internal)
+ ccs_disconnect(ccsfd);
+
+ return disabled;
+}
+
+
/*
* Configure logging based on data in cluster.conf
*/
@@ -806,6 +843,8 @@ configure_rgmanager(int ccsfd, int dbg, int *token_secs)
setup_logging(ccsfd);
+ rgmanager_disabled(ccsfd);
+
if (token_secs && ccs_get(ccsfd, "/cluster/totem/@token", &v) == 0) {
tmp = atoi(v);
if (tmp >= 1000) {
@@ -978,6 +1017,13 @@ main(int argc, char **argv)
debug = 1;
}
+ /* If we're disabled in the configuration, don't fork */
+ if (rgmanager_disabled(-1) > 0) {
+ fprintf(stderr,
+ "rgmanager disabled in configuration; not starting\n");
+ return 2;
+ }
+
if (!foreground && (geteuid() == 0)) {
daemon_init(argv[0]);
if (wd && !debug && !watchdog_init())
@@ -1036,6 +1082,9 @@ main(int argc, char **argv)
*/
xmlInitParser();
configure_rgmanager(-1, debug, &cluster_timeout);
+ if (shutdown_pending == 1)
+ goto out_ls;
+
logt_print(LOG_NOTICE, "Resource Group Manager Starting\n");
if (rgm_dbus_notify && rgm_dbus_init() != 0) {
12 years, 9 months
cluster: STABLE31 - rgmanager: Fix race in shutdown vs. notification
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 538becbe4b3779bf8173e6c09164aa7c8d5521ad
Parent: b5f6b9d830bc4111d6de37ffe5bd7ea2c30f989c
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Aug 2 09:53:20 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Aug 2 10:47:38 2011 -0400
rgmanager: Fix race in shutdown vs. notification
The check of db prior to taking the mutex was done as a tiny performance
gain in the event that there was no dbus connection, but causes
dbus_connection_get_is_connected() to crash the program if db is NULL.
Resolves: rhbz#697446
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index f465d1d..bff1644 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -149,12 +149,12 @@ _rgm_dbus_notify(const char *svcname,
DBusMessage *msg = NULL;
int ret = -1;
+ pthread_mutex_lock(&mu);
+
if (!db) {
- goto out_free;
+ goto out_unlock;
}
- pthread_mutex_lock(&mu);
-
/* Check to ensure the connection is still valid. If it
* isn't, clean up and shut down the dbus connection.
*
12 years, 9 months
cluster: STABLE31 - rgmanager: Fix clusvcadm message when run with -F
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: b5f6b9d830bc4111d6de37ffe5bd7ea2c30f989c
Parent: 8e6660824136681b73506d49776f70b8a372ec63
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Aug 1 16:31:57 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Aug 1 16:35:55 2011 -0400
rgmanager: Fix clusvcadm message when run with -F
The new_owner was not being correctly set when enabling a service with
-F when run without central processing enabled.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 9292add..3db6bd9 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -2300,6 +2300,7 @@ handle_fd_start_req(char *svcName, int request, int *new_owner)
switch(ret) {
case RG_ESUCCESS:
+ *new_owner = target;
ret = RG_ESUCCESS;
goto out;
case RG_ERUN:
12 years, 9 months
cluster: STABLE31 - config: Add 'disabled' flag to rm element
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 8e6660824136681b73506d49776f70b8a372ec63
Parent: edc20419a06e9c96cabdf070ba676562ad22ec2c
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Thu Jul 21 11:21:43 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Aug 1 16:34:23 2011 -0400
config: Add 'disabled' flag to rm element
Related: rhbz#723925
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
config/tools/xml/cluster.rng.in.head | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/config/tools/xml/cluster.rng.in.head b/config/tools/xml/cluster.rng.in.head
index f9606ad..7696533 100644
--- a/config/tools/xml/cluster.rng.in.head
+++ b/config/tools/xml/cluster.rng.in.head
@@ -869,6 +869,11 @@ To validate your cluster.conf against this schema, run:
of the following keywords: auth, authpriv, cron, daemon, kern,
lpr, mail, news, syslog, user, uucp and local0 through local7"/>
</optional>
+ <optional>
+ <attribute name="disabled" rha:description="Disables rgmanager entirely if set to 1. Do not set unless you really mean it." rha:sample="">
+ <data type="integer"/>
+ </attribute>
+ </optional>
<interleave>
<optional>
<element name="failoverdomains" rha:description="Failover domain definitions.">
12 years, 9 months