From 860a126e56ece4d664aa55ce4949763b16a33c64 Mon Sep 17 00:00:00 2001 From: Zetok Zalbavar Date: Sun, 29 Mar 2015 17:52:28 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20DNS=20naming=20|=20'tox#'=20=E2=86=92=20'?= =?UTF-8?q?toxdns#'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to occurrences of people who were confused by 'tox#', it is deemed necessary to rename it to 'toxdns#'. This way people will not be confused by error messages about 'not secure tox1 protocol', which is a major improvement when it comes to being user friendly. --- dns.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dns.c b/dns.c index 9e79aca3..389f7e06 100644 --- a/dns.c +++ b/dns.c @@ -1,7 +1,7 @@ #include "main.h" #include -static struct tox3 +static struct toxdns3 { uint8_t *name; void *dns3; @@ -22,8 +22,8 @@ static struct tox3 static void* istox3(uint8_t *name, uint16_t name_length) { int i; - for(i = 0; i != countof(tox3_server); i++) { - struct tox3 *t = &tox3_server[i]; + for(i = 0; i != countof(toxdns3_server); i++) { + struct toxdns3 *t = &toxdns3_server[i]; if(memcmp(name, t->name, name_length) == 0 && t->name[name_length] == 0) { //what if two threads reach this point at the same time?->initialize all dns3 at start instead if(!t->dns3) { @@ -106,7 +106,7 @@ static int64_t parseargument(uint8_t *dest, char_t *src, uint16_t length, void * case '@': { void *dns3; - if((dns3 = istox3(a + 1, b - (a + 1)))) { + if((dns3 = istoxdns3(a + 1, b - (a + 1)))) { uint8_t out[256]; int len = tox_generate_dns3_string(dns3, out, sizeof(out), &pin, dest, d - dest); if(len != -1) { @@ -137,7 +137,7 @@ static int64_t parseargument(uint8_t *dest, char_t *src, uint16_t length, void * if ((d - dest) > TOXDNS_MAX_RECOMMENDED_NAME_LENGTH) return -1; - void *dns3 = istox3((uint8_t *)"utox.org", sizeof("utox.org") - 1); + void *dns3 = istoxdns3((uint8_t *)"utox.org", sizeof("utox.org") - 1); if (!dns3) return -1; @@ -255,10 +255,10 @@ static _Bool parserecord(uint8_t *dest, uint8_t *src, uint32_t pin, void *dns3) a += 3; } - if(!version && memcmp("v=tox", a, 5) == 0) { - if(a[5] >= '1' && a[5] <= '3') { - version = a[5] - '0'; - a += 5; + if(!version && memcmp("v=toxdns", a, 8) == 0) { + if(a[8] >= '1' && a[8] <= '3') { + version = a[8] - '0'; + a += 8; } } @@ -366,7 +366,7 @@ static void dns_thread(void *data) debug("%s reponded %u\n", value, len); - p = memmem(packet, len, "v=tox", 5); + p = memmem(packet, len, "v=toxdns", 8); if(p) { debug("test %u\n", *(p - 1)); p[*(p - 1)] = 0;