summaryrefslogtreecommitdiff
path: root/src/libs6dns
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs6dns')
-rw-r--r--src/libs6dns/s6dns_domain_decode.c2
-rw-r--r--src/libs6dns/s6dns_domain_fromstring.c6
-rw-r--r--src/libs6dns/s6dns_domain_tostring.c4
-rw-r--r--src/libs6dns/s6dns_fmt_domainlist.c1
4 files changed, 8 insertions, 5 deletions
diff --git a/src/libs6dns/s6dns_domain_decode.c b/src/libs6dns/s6dns_domain_decode.c
index 6fea0d6..e5fab0a 100644
--- a/src/libs6dns/s6dns_domain_decode.c
+++ b/src/libs6dns/s6dns_domain_decode.c
@@ -3,7 +3,6 @@
#include <errno.h>
#include <skalibs/posixishard.h>
-#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-domain.h>
@@ -12,7 +11,6 @@ static inline unsigned int s6dns_domain_label_decode (char *s, unsigned int max)
unsigned int len = *(unsigned char *)s ;
if ((len > 63) || (len >= max)) return (errno = EPROTO, 0) ;
*s = '.' ;
- case_lowerb(s+1, len) ;
return len + 1 ;
}
diff --git a/src/libs6dns/s6dns_domain_fromstring.c b/src/libs6dns/s6dns_domain_fromstring.c
index b87ee10..c8e553b 100644
--- a/src/libs6dns/s6dns_domain_fromstring.c
+++ b/src/libs6dns/s6dns_domain_fromstring.c
@@ -2,7 +2,8 @@
#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
+#include <ctype.h>
+
#include <s6-dns/s6dns-domain.h>
int s6dns_domain_fromstring (s6dns_domain_t *d, char const *s, size_t len)
@@ -16,7 +17,7 @@ int s6dns_domain_fromstring (s6dns_domain_t *d, char const *s, size_t len)
if (lastdot)
{
if ((j >= 255) || (lastdot++ >= 64)) return (errno = ENAMETOOLONG, 0) ;
- d->s[j++] = s[i] ;
+ d->s[j++] = tolower(s[i]) ;
}
if (s[i] == '.') lastdot = 0 ;
else if (!lastdot)
@@ -25,7 +26,6 @@ int s6dns_domain_fromstring (s6dns_domain_t *d, char const *s, size_t len)
lastdot = 1 ;
}
}
- case_lowerb(d->s + 1, j-1) ;
d->len = j ;
return 1 ;
}
diff --git a/src/libs6dns/s6dns_domain_tostring.c b/src/libs6dns/s6dns_domain_tostring.c
index 2c1cf01..cd60f66 100644
--- a/src/libs6dns/s6dns_domain_tostring.c
+++ b/src/libs6dns/s6dns_domain_tostring.c
@@ -2,6 +2,9 @@
#include <string.h>
#include <errno.h>
+
+#include <skalibs/bytestr.h>
+
#include <s6-dns/s6dns-domain.h>
unsigned int s6dns_domain_tostring (char *s, size_t max, s6dns_domain_t const *d)
@@ -18,6 +21,7 @@ unsigned int s6dns_domain_tostring (char *s, size_t max, s6dns_domain_t const *d
{
memcpy(s, d->s + 1, d->len - 1) ;
s[d->len - 1] = 0 ;
+ case_lowerb(s, d->len - 1) ;
return d->len - 1 ;
}
}
diff --git a/src/libs6dns/s6dns_fmt_domainlist.c b/src/libs6dns/s6dns_fmt_domainlist.c
index 22d6f77..837ee97 100644
--- a/src/libs6dns/s6dns_fmt_domainlist.c
+++ b/src/libs6dns/s6dns_fmt_domainlist.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <errno.h>
+
#include <s6-dns/s6dns-domain.h>
#include <s6-dns/s6dns-fmt.h>