Changeset c07a479ca7158c58ebf6036351e6a4e1191a54e1
- Timestamp:
- 02/12/10 16:31:14
(3 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
| r3c6e7b2 |
rc07a479 |
|
| 877 | 877 | noit_hash_iter iter = NOIT_HASH_ITER_ZERO; |
|---|
| 878 | 878 | 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; |
|---|
| 881 | 881 | int klen, n = 0, i, di, cnt; |
|---|
| 882 | 882 | void *vconn; |
|---|
| … | … | |
| 887 | 887 | |
|---|
| 888 | 888 | 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; |
|---|
| 891 | 893 | |
|---|
| 892 | 894 | gettimeofday(&now, NULL); |
|---|
| … | … | |
| 917 | 919 | /* If the user requested a specific type and we're not it, skip. */ |
|---|
| 918 | 920 | 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; |
|---|
| 919 | 924 | |
|---|
| 920 | 925 | node = xmlNewNode(NULL, (xmlChar *)"noit"); |
|---|
| … | … | |
| 1009 | 1014 | free(ctxs); |
|---|
| 1010 | 1015 | |
|---|
| 1011 | | if(type && !strcmp(type, "configured")) { |
|---|
| | 1016 | if(!type || !strcmp(type, "configured")) { |
|---|
| 1012 | 1017 | snprintf(path, sizeof(path), "//noits//noit"); |
|---|
| 1013 | 1018 | noit_configs = noit_conf_get_sections(NULL, path, &cnt); |
|---|
| 1014 | 1019 | for(di=0; di<cnt; di++) { |
|---|
| 1015 | 1020 | 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; |
|---|
| 1016 | 1026 | if(noit_conf_get_stringbuf(noit_configs[di], "self::node()/@address", |
|---|
| 1017 | 1027 | address, sizeof(address))) { |
|---|
| … | … | |
| 1020 | 1030 | port_str, sizeof(port_str))) |
|---|
| 1021 | 1031 | 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 | |
|---|
| 1022 | 1037 | snprintf(remote_str, sizeof(remote_str), "%s:%s", address, port_str); |
|---|
| 1023 | 1038 | if(!noit_hash_retrieve(&seen, remote_str, strlen(remote_str), &v)) { |
|---|
| 1024 | | char expected_cn[256]; |
|---|
| 1025 | 1039 | node = xmlNewNode(NULL, (xmlChar *)"noit"); |
|---|
| 1026 | 1040 | xmlSetProp(node, (xmlChar *)"remote", (xmlChar *)remote_str); |
|---|
| 1027 | 1041 | 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) |
|---|
| 1030 | 1043 | xmlSetProp(node, (xmlChar *)"cn", (xmlChar *)expected_cn); |
|---|
| 1031 | 1044 | xmlAddChild(root, node); |
|---|