Changeset c07a479ca7158c58ebf6036351e6a4e1191a54e1

Show
Ignore:
Timestamp:
02/12/10 16:31:14 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1265992274 +0000
git-parent:

[3c6e7b2c6c3b65676bb51326a13b12d505806bce]

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

fixes #256

Files:

Legend:

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

    r3c6e7b2 rc07a479  
    877877  noit_hash_iter iter = NOIT_HASH_ITER_ZERO; 
    878878  char path[256]; 
    879   void *key_id, *vtype
    880   const char *type = NULL
     879  void *key_id, *vstr
     880  const char *type = NULL, *want_cn = NULL
    881881  int klen, n = 0, i, di, cnt; 
    882882  void *vconn; 
     
    887887 
    888888  noit_http_process_querystring(&restc->http_ctx->req); 
    889   if(noit_hash_retrieve(&restc->http_ctx->req.querystring, "type", 4, &vtype)) 
    890     type = vtype; 
     889  if(noit_hash_retrieve(&restc->http_ctx->req.querystring, "type", 4, &vstr)) 
     890    type = vstr; 
     891  if(noit_hash_retrieve(&restc->http_ctx->req.querystring, "cn", 2, &vstr)) 
     892    want_cn = vstr; 
    891893 
    892894  gettimeofday(&now, NULL); 
     
    917919    /* If the user requested a specific type and we're not it, skip. */ 
    918920    if(type && strcmp(feedtype, type)) continue; 
     921    /* If the user wants a specific CN... limit to that. */ 
     922    if(want_cn && (!ctx->remote_cn || strcmp(want_cn, ctx->remote_cn))) 
     923      continue; 
    919924 
    920925    node = xmlNewNode(NULL, (xmlChar *)"noit"); 
     
    10091014  free(ctxs); 
    10101015 
    1011   if(type && !strcmp(type, "configured")) { 
     1016  if(!type || !strcmp(type, "configured")) { 
    10121017    snprintf(path, sizeof(path), "//noits//noit"); 
    10131018    noit_configs = noit_conf_get_sections(NULL, path, &cnt); 
    10141019    for(di=0; di<cnt; di++) { 
    10151020      char address[64], port_str[32], remote_str[98]; 
     1021      char expected_cn_buff[256], *expected_cn = NULL; 
     1022      if(noit_conf_get_stringbuf(noit_configs[di], "self::node()/config/cn", 
     1023                                 expected_cn_buff, sizeof(expected_cn_buff))) 
     1024        expected_cn = expected_cn_buff; 
     1025      if(want_cn && (!expected_cn || strcmp(want_cn, expected_cn))) continue; 
    10161026      if(noit_conf_get_stringbuf(noit_configs[di], "self::node()/@address", 
    10171027                                 address, sizeof(address))) { 
     
    10201030                                   port_str, sizeof(port_str))) 
    10211031          strlcpy(port_str, "43191", sizeof(port_str)); 
     1032 
     1033        /* If the user wants a specific CN... limit to that. */ 
     1034          if(want_cn && (!expected_cn || strcmp(want_cn, expected_cn))) 
     1035            continue; 
     1036 
    10221037        snprintf(remote_str, sizeof(remote_str), "%s:%s", address, port_str); 
    10231038        if(!noit_hash_retrieve(&seen, remote_str, strlen(remote_str), &v)) { 
    1024           char expected_cn[256]; 
    10251039          node = xmlNewNode(NULL, (xmlChar *)"noit"); 
    10261040          xmlSetProp(node, (xmlChar *)"remote", (xmlChar *)remote_str); 
    10271041          xmlSetProp(node, (xmlChar *)"type", (xmlChar *)"configured"); 
    1028           if(noit_conf_get_stringbuf(noit_configs[di], "self::node()/config/cn", 
    1029                                      expected_cn, sizeof(expected_cn))) 
     1042          if(expected_cn) 
    10301043            xmlSetProp(node, (xmlChar *)"cn", (xmlChar *)expected_cn); 
    10311044          xmlAddChild(root, node);