Changeset 2a06f129a8ded380b2b27047520ceb04dfc9a0b0

Show
Ignore:
Timestamp:
03/27/12 20:58:43 (2 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1332881923 +0000
git-parent:

[2148d594359c81ffc07674617e97eef16818690f]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1332881923 +0000
Message:

config name attribute was not supported under checks/set

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_check_rest.c

    rc4fc37f r2a06f12  
    4848#define FAIL(a) do { error = (a); goto error; } while(0) 
    4949 
    50 #define NS_NODE_CONTENT(parent, ns, k, v) do { \ 
     50#define NS_NODE_CONTENT(parent, ns, k, v, followup) do { \ 
    5151  xmlNodePtr tmp; \ 
    5252  if(v) { \ 
    5353    tmp = xmlNewNode(ns, (xmlChar *)(k)); \ 
    5454    xmlNodeAddContent(tmp, (xmlChar *)(v)); \ 
     55    followup \ 
    5556    xmlAddChild(parent, tmp); \ 
    5657  } \ 
    5758} while(0) 
    58 #define NODE_CONTENT(parent, k, v) NS_NODE_CONTENT(parent, NULL, k, v
     59#define NODE_CONTENT(parent, k, v) NS_NODE_CONTENT(parent, NULL, k, v,
    5960 
    6061xmlNodePtr 
     
    221222    snprintf(buff, sizeof(buff), "noit://module/%s", nsname); 
    222223    ns = xmlNewNs(config, (xmlChar *)buff, (xmlChar *)nsname); 
    223     if(NULL != (configh = noit_conf_get_namespaced_hash(node, "config", nsname))) { 
    224       while(noit_hash_next(configh, &iter, &k, &klen, &data)) 
    225         NS_NODE_CONTENT(config, ns, k, data); 
     224    configh = noit_conf_get_namespaced_hash(node, "config", nsname); 
     225    if(configh) { 
     226      memset(&iter, 0, sizeof(iter)); 
     227      while(noit_hash_next(configh, &iter, &k, &klen, &data)) { 
     228        NS_NODE_CONTENT(config, ns, "value", data, 
     229          xmlSetProp(tmp, (xmlChar *)"name", (xmlChar *)k); 
     230        ); 
     231      } 
    226232      noit_hash_destroy(configh, free, free); 
    227233      free(configh); 
     
    411417      } 
    412418      xmlNodePtr co = xmlNewNode(targetns, n->name); 
     419      if(n->ns && !strcmp((char *)n->name, "value")) { 
     420        xmlChar *name = xmlGetProp(n, (xmlChar *)"name"); 
     421        if(name) xmlSetProp(co, (xmlChar *)"name", name); 
     422      } 
    413423      xmlNodeAddContent(co, v); 
    414424      xmlFree(v);