diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-22 17:52:23 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-22 17:52:23 +0000 |
commit | 3e38c60925c16fdf4bd5fdd1e26f7be3d20be985 (patch) | |
tree | 4bfac5a6715d80bb29d8b78c26ca3de8e47dd534 /src | |
parent | 9393482faf10c55fc3a28d160afd23844c44be45 (diff) | |
download | gnunet-3e38c60925c16fdf4bd5fdd1e26f7be3d20be985.tar.gz gnunet-3e38c60925c16fdf4bd5fdd1e26f7be3d20be985.zip |
-cli tool fix, bugfix
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-gns.c | 33 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 4 | ||||
-rw-r--r-- | src/gns/proxy/proxy.py | 2 |
3 files changed, 23 insertions, 16 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index f2600b6a8..b7102eaa9 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -89,27 +89,25 @@ process_lookup_result(void* cls, uint32_t rd_count, | |||
89 | const struct GNUNET_NAMESTORE_RecordData *rd) | 89 | const struct GNUNET_NAMESTORE_RecordData *rd) |
90 | { | 90 | { |
91 | int i; | 91 | int i; |
92 | char* addr; | ||
93 | char* name = (char*) cls; | 92 | char* name = (char*) cls; |
93 | const char* typename; | ||
94 | char* string_val; | ||
94 | 95 | ||
95 | if (rd_count == 0) | 96 | if (rd_count == 0) |
96 | printf("No results.\n"); | 97 | printf("No results.\n"); |
98 | else | ||
99 | printf("%s:\n", name); | ||
100 | |||
101 | |||
97 | 102 | ||
98 | for (i=0; i<rd_count; i++) | 103 | for (i=0; i<rd_count; i++) |
99 | { | 104 | { |
100 | if (rd[i].record_type != rtype) | 105 | typename = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type); |
101 | continue; | 106 | string_val = GNUNET_NAMESTORE_value_to_string(rd[i].record_type, |
102 | if (rd[i].record_type == GNUNET_GNS_RECORD_TYPE_A) | 107 | rd[i].data, |
103 | { | 108 | rd[i].data_size); |
104 | addr = inet_ntoa(*((struct in_addr*)rd[i].data)); | 109 | printf("Got %s record: %s\n", typename, string_val); |
105 | printf("Got A record for %s: %s\n", name, addr); | 110 | |
106 | } | ||
107 | if (rd[i].record_type == GNUNET_GNS_RECORD_MX) | ||
108 | { | ||
109 | printf("Got MX record for %s: %s\n", name, (char*)rd[i].data); | ||
110 | } | ||
111 | |||
112 | //FIXME others? maybe to string method for records? | ||
113 | } | 111 | } |
114 | 112 | ||
115 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 113 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
@@ -135,7 +133,10 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
135 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 133 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
136 | { | 134 | { |
137 | gns = GNUNET_GNS_connect (cfg); | 135 | gns = GNUNET_GNS_connect (cfg); |
138 | rtype = GNUNET_GNS_RECORD_TYPE_A; | 136 | if (lookup_type != NULL) |
137 | rtype = GNUNET_NAMESTORE_typename_to_number(lookup_type); | ||
138 | else | ||
139 | rtype = GNUNET_GNS_RECORD_TYPE_A; | ||
139 | 140 | ||
140 | if (NULL == gns) | 141 | if (NULL == gns) |
141 | { | 142 | { |
@@ -153,6 +154,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
153 | 154 | ||
154 | if (lookup_name != NULL) | 155 | if (lookup_name != NULL) |
155 | { | 156 | { |
157 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
158 | "Lookup\n"); | ||
156 | GNUNET_GNS_lookup(gns, lookup_name, rtype, | 159 | GNUNET_GNS_lookup(gns, lookup_name, rtype, |
157 | &process_lookup_result, lookup_name); | 160 | &process_lookup_result, lookup_name); |
158 | } | 161 | } |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 4e074577f..c4d06e410 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -1168,6 +1168,10 @@ expand_plus(char** dest, char* src, char* repl) | |||
1168 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1168 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1169 | "Expanded to %s\n", *dest); | 1169 | "Expanded to %s\n", *dest); |
1170 | } | 1170 | } |
1171 | else | ||
1172 | { | ||
1173 | memcpy(*dest, src, s_len+1); | ||
1174 | } | ||
1171 | } | 1175 | } |
1172 | 1176 | ||
1173 | /** | 1177 | /** |
diff --git a/src/gns/proxy/proxy.py b/src/gns/proxy/proxy.py index 4438f33fa..9191c1b4e 100644 --- a/src/gns/proxy/proxy.py +++ b/src/gns/proxy/proxy.py | |||
@@ -140,7 +140,7 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): | |||
140 | arr.pop(0) | 140 | arr.pop(0) |
141 | data = re.sub('(a href="http://(\w+\.)*)(\+)', | 141 | data = re.sub('(a href="http://(\w+\.)*)(\+)', |
142 | self.replace_and_shorten(to_repl), data) | 142 | self.replace_and_shorten(to_repl), data) |
143 | print data | 143 | #print data |
144 | out.send(data) | 144 | out.send(data) |
145 | count = 0 | 145 | count = 0 |
146 | else: | 146 | else: |