From 38ddfa0ccaaf81a15093b4d3003c9b1428064072 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 23 Sep 2007 20:17:52 -0400 Subject: [PATCH] Don't modify the target value from the command input when creating a target attribute. This fixes creating the target value and when the actual target was changed the literal element path to the target was being used. If the literal path is needed, the literal path should be specified in the command. For example: attr set target somepath destpath attr set target destpath someotherpath Then "somepath" used to point to "destpath" rather than follow the target of "destpath" because no target attribute was found in "destpath" originally and was modifying each element in the target value of "somepath" to be a literal element. --- src/commands.c | 1 - src/xml.c | 11 +---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/commands.c b/src/commands.c index d9066d34..42b106ff 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1681,7 +1681,6 @@ static gpg_error_t target_attribute(struct client_s *client, gchar **req) goto fail; } - again: n = find_account(client->doc, &src, &error, NULL); diff --git a/src/xml.c b/src/xml.c index 85296437..adcfc21e 100644 --- a/src/xml.c +++ b/src/xml.c @@ -471,13 +471,6 @@ xmlNodePtr find_element(xmlNodePtr node, gchar *element) return find_sibling(node, element); } -static void element_to_literal(gchar **element) -{ - gchar *p = g_strdup_printf("!%s", *element); - g_free(*element); - *element = p; -} - xmlChar *node_has_attribute(xmlNodePtr n, xmlChar *attr) { xmlAttrPtr a = xmlHasProp(n, attr); @@ -537,10 +530,8 @@ xmlNodePtr find_elements(xmlDocPtr doc, xmlNodePtr node, xmlChar *content = node_has_attribute(n, (xmlChar *)"target"); gchar **nreq = NULL, **nnreq; - if (!content) { - element_to_literal(&(*p)); + if (!content) continue; - } if (strchr((gchar *)content, '\t') != NULL) { if ((nreq = split_input_line((gchar *)content, "\t", 0)) == NULL) { -- 2.11.4.GIT