Skip to content

Commit 8e852db

Browse files
committed
Low: fencer: Drop support for escaped characters in pcmk_host_map
This reverts e95198f. Backslash escapes are useful in C and on the command line, but it's not clear how they would be useful in a pcmk_host_map value. Backslash escapes are not used in XML, where the configuration is stored. The removed code did the following upon finding a backslash: * If we're not inside the value part of a host-to-port mapping, skip both a backslash and the character after it. * Otherwise, skip the backslash and keep the character after it (unless that character is also a backslash). This doesn't seem to make sense. Any characters that are special in XML attribute values would need to be escaped using XML entities. Other characters, including backslashes, are allowed as literals. * https://www.w3.org/TR/REC-xml/#NT-AttValue Signed-off-by: Reid Wahl <[email protected]>
1 parent 0af49a3 commit 8e852db

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

daemons/fenced/fenced_commands.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,6 @@ build_port_aliases(const char *hostmap, GList ** targets)
915915
len = strlen(hostmap);
916916
for (int i = 0; i <= len; i++) {
917917
switch (hostmap[i]) {
918-
/* Skip escaped chars */
919-
case '\\':
920-
i++;
921-
break;
922-
923918
/* Assignment chars */
924919
case '=':
925920
case ':':
@@ -938,19 +933,11 @@ build_port_aliases(const char *hostmap, GList ** targets)
938933
case ' ':
939934
case '\t':
940935
if (name) {
941-
int k = 0;
942936
char *value = pcmk__assert_alloc(1 + i - last,
943937
sizeof(char));
944938

945939
memcpy(value, hostmap + last, i - last);
946940

947-
for (int i = 0; value[i] != '\0'; i++) {
948-
if (value[i] != '\\') {
949-
value[k++] = value[i];
950-
}
951-
}
952-
value[k] = '\0';
953-
954941
crm_debug("Adding alias '%s'='%s'", name, value);
955942
g_hash_table_replace(aliases, name, value);
956943
*targets = g_list_append(*targets, pcmk__str_copy(value));

0 commit comments

Comments
 (0)