summaryrefslogtreecommitdiffstats
path: root/0087-RHBZ-1110013-config-error-checking.patch
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2014-09-16 18:22:40 -0500
committerBenjamin Marzinski <bmarzins@redhat.com>2014-09-16 18:22:40 -0500
commitefd38c93e9c0be988af2bc7e2d1d2d1931286ef5 (patch)
tree2dfc07fc06b8e30f4b0a11b5a7ff7fef6f59da30 /0087-RHBZ-1110013-config-error-checking.patch
parent2a2c963dcd724db5038f2975f91b378ff430b496 (diff)
device-mapper-multipath-0.4.9-68
Modify multipath.conf * remove getuid_callout example Re-add 0050-RH-listing-speedup.patch Add 0081-RHBZ-1066264-check-prefix-on-rename.patch * make multipath check the prefix on kpartx partitions during rename, and copy the existing behaviour Add 0082-UPBZ-1109995-no-sync-turs-on-pthread_cancel.patch * If async tur checker fails on threads, don't retry with the sync version Add 0083-RHBZ-1080055-orphan-paths-on-reload.patch * Fix case where pathlist wasn't getting updated properly Add 0084-RHBZ-1110000-multipath-man.patch * fix errors in multipath man page Add 0085-UPBZ-1110006-datacore-config.patch * Add support for DataCore Virtual Disk Add 0086-RHBZ-1110007-orphan-path-on-failed-add.patch * If multipathd fails to add path correctly, it now fully orphans the path Add 0087-RHBZ-1110013-config-error-checking.patch * Improve multipath.conf error checking. Add 0088-RHBZ-1069811-configurable-prio-timeout.patch * checker_timeout now adjusts the timeouts of the prioritizers as well. Add 0089-RHBZ-1110016-add-noasync-option.patch * Add a new defaults option, "force_sync", that disables the async mode of the path checkers. This is for cases where to many parallel checkers hog the cpu Add 0090-UPBZ-1080038-reorder-paths-for-round-robin.patch * make multipathd order paths for better throughput in round-robin mode Add 0091-RHBZ-1069584-fix-empty-values-fast-io-fail-and-dev-loss.patch * check for null pointers in configuration reading code. Add 0092-UPBZ-1104605-reload-on-rename.patch * Reload table on rename if necessary Add 0093-UPBZ-1086825-user-friendly-name-remap.patch * Keep existing user_friend_name if possible Add 0094-RHBZ-1086825-cleanup-remap.patch * Cleanup issues with upstream patch Add 0095-RHBZ-1127944-xtremIO-config.patch * Add support for EMC ExtremIO devices Add 0096-RHBZ-979474-new-wildcards.patch * Add N, n, R, and r path wildcards to print World Wide ids Add 0097-RH-fix-coverity-errors.patch * Fix a number of unterminated strings and memory leaks on failure paths. Add 0098-UPBZ-1067171-mutipath-i.patch * Add -i option to ignore wwids file when checking for valid paths Add 0099-RH-add-all-devs.patch * Add new devices config option all_devs. This makes the configuration overwrite the specified values in all builtin configs Add 0100-RHBZ-1067171-multipath-i-update.patch * make -i work correctly with find_multipaths Add 0101-RH-adapter-name-wildcard.patch * Add 'a' path wildcard to print adapter name
Diffstat (limited to '0087-RHBZ-1110013-config-error-checking.patch')
-rw-r--r--0087-RHBZ-1110013-config-error-checking.patch190
1 files changed, 190 insertions, 0 deletions
diff --git a/0087-RHBZ-1110013-config-error-checking.patch b/0087-RHBZ-1110013-config-error-checking.patch
new file mode 100644
index 0000000..c774bc5
--- /dev/null
+++ b/0087-RHBZ-1110013-config-error-checking.patch
@@ -0,0 +1,190 @@
+---
+ libmultipath/parser.c | 154 ++++++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 126 insertions(+), 28 deletions(-)
+
+Index: multipath-tools-130222/libmultipath/parser.c
+===================================================================
+--- multipath-tools-130222.orig/libmultipath/parser.c
++++ multipath-tools-130222/libmultipath/parser.c
+@@ -395,36 +395,57 @@ set_value(vector strvec)
+ char *alloc = NULL;
+ char *tmp;
+
+- if (!str)
++ if (!str) {
++ condlog(0, "option '%s' missing value",
++ (char *)VECTOR_SLOT(strvec, 0));
+ return NULL;
+-
++ }
+ size = strlen(str);
+- if (size == 0)
++ if (size == 0) {
++ condlog(0, "option '%s' has empty value",
++ (char *)VECTOR_SLOT(strvec, 0));
+ return NULL;
+-
+- if (*str == '"') {
+- for (i = 2; i < VECTOR_SIZE(strvec); i++) {
+- str = VECTOR_SLOT(strvec, i);
+- len += strlen(str);
+- if (!alloc)
+- alloc =
+- (char *) MALLOC(sizeof (char *) *
+- (len + 1));
+- else {
+- alloc =
+- REALLOC(alloc, sizeof (char *) * (len + 1));
+- tmp = VECTOR_SLOT(strvec, i-1);
+- if (alloc && *str != '"' && *tmp != '"')
+- strncat(alloc, " ", 1);
+- }
+-
+- if (alloc && i != VECTOR_SIZE(strvec)-1)
+- strncat(alloc, str, strlen(str));
+- }
+- } else {
+- alloc = MALLOC(sizeof (char *) * (size + 1));
++ }
++ if (*str != '"') {
++ alloc = MALLOC(sizeof (char) * (size + 1));
+ if (alloc)
+ memcpy(alloc, str, size);
++ else
++ condlog(0, "can't allocate memeory for option '%s'",
++ (char *)VECTOR_SLOT(strvec, 0));
++ return alloc;
++ }
++ /* Even empty quotes counts as a value (An empty string) */
++ alloc = (char *) MALLOC(sizeof (char));
++ if (!alloc) {
++ condlog(0, "can't allocate memeory for option '%s'",
++ (char *)VECTOR_SLOT(strvec, 0));
++ return NULL;
++ }
++ for (i = 2; i < VECTOR_SIZE(strvec); i++) {
++ str = VECTOR_SLOT(strvec, i);
++ if (!str) {
++ free(alloc);
++ condlog(0, "parse error for option '%s'",
++ (char *)VECTOR_SLOT(strvec, 0));
++ return NULL;
++ }
++ if (*str == '"')
++ break;
++ tmp = alloc;
++ /* The first +1 is for the NULL byte. The rest are for the
++ * spaces between words */
++ len += strlen(str) + 1;
++ alloc = REALLOC(alloc, sizeof (char) * len);
++ if (!alloc) {
++ FREE(tmp);
++ condlog(0, "can't allocate memeory for option '%s'",
++ (char *)VECTOR_SLOT(strvec, 0));
++ return NULL;
++ }
++ if (*alloc != '\0')
++ strncat(alloc, " ", 1);
++ strncat(alloc, str, strlen(str));
+ }
+ return alloc;
+ }
+@@ -465,6 +486,74 @@ void free_uniques(vector uniques)
+ }
+
+ int
++is_sublevel_keyword(char *str)
++{
++ return (strcmp(str, "defaults") == 0 || strcmp(str, "blacklist") == 0 ||
++ strcmp(str, "blacklist_exceptions") == 0 ||
++ strcmp(str, "devices") == 0 || strcmp(str, "devices") == 0 ||
++ strcmp(str, "device") == 0 || strcmp(str, "multipaths") == 0 ||
++ strcmp(str, "multipath") == 0);
++}
++
++int
++validate_config_strvec(vector strvec)
++{
++ char *str;
++ int i;
++
++ str = VECTOR_SLOT(strvec, 0);
++ if (str == NULL) {
++ condlog(0, "can't parse option on line %d of config file",
++ line_nr);
++ return -1;
++ }
++ if (*str == '}') {
++ if (VECTOR_SIZE(strvec) > 1)
++ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 1), line_nr);
++ return 0;
++ }
++ if (*str == '{') {
++ condlog(0, "invalid keyword '%s' on line %d of config file", str, line_nr);
++ return -1;
++ }
++ if (is_sublevel_keyword(str)) {
++ str = VECTOR_SLOT(strvec, 1);
++ if (str == NULL)
++ condlog(0, "missing '{' on line %d of config file", line_nr);
++ else if (*str != '{')
++ condlog(0, "expecting '{' on line %d of config file. found '%s'", line_nr, str);
++ else if (VECTOR_SIZE(strvec) > 2)
++ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 2), line_nr);
++ return 0;
++ }
++ str = VECTOR_SLOT(strvec, 1);
++ if (str == NULL) {
++ condlog(0, "missing value for option '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 0), line_nr);
++ return -1;
++ }
++ if (*str != '"') {
++ if (VECTOR_SIZE(strvec) > 2)
++ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 2), line_nr);
++ return 0;
++ }
++ for (i = 2; i < VECTOR_SIZE(strvec); i++) {
++ str = VECTOR_SLOT(strvec, i);
++ if (str == NULL) {
++ condlog(0, "can't parse value on line %d of config file", line_nr);
++ return -1;
++ }
++ if (*str == '"') {
++ if (VECTOR_SIZE(strvec) > i + 1)
++ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, (i + 1)), line_nr);
++ return 0;
++ }
++ }
++ condlog(0, "missing closing quotes on line %d of config file",
++ line_nr);
++ return 0;
++}
++
++int
+ process_stream(vector keywords)
+ {
+ int i;
+@@ -494,11 +583,20 @@ process_stream(vector keywords)
+ if (!strvec)
+ continue;
+
++ if (validate_config_strvec(strvec) != 0) {
++ free_strvec(strvec);
++ continue;
++ }
++
+ str = VECTOR_SLOT(strvec, 0);
+
+- if (!strcmp(str, EOB) && kw_level > 0) {
+- free_strvec(strvec);
+- break;
++ if (!strcmp(str, EOB)) {
++ if (kw_level > 0) {
++ free_strvec(strvec);
++ break;
++ }
++ condlog(0, "unmatched '%s' at line %d of config file",
++ EOB, line_nr);
+ }
+
+ for (i = 0; i < VECTOR_SIZE(keywords); i++) {