summaryrefslogtreecommitdiff
path: root/sys/src/cmd/ip/dhcpd/dhcpd.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-09-25 20:17:56 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2018-09-25 20:17:56 +0200
commit347303b136c41ac5ca4408818fdd1a3fde89888a (patch)
tree3985d0e42cfd5277b25054c66566aaa543563934 /sys/src/cmd/ip/dhcpd/dhcpd.c
parent2160da07de7fcce233e2229318caa6f4f98f4a45 (diff)
ip/dhcpd: handle internationalized domain names
Diffstat (limited to 'sys/src/cmd/ip/dhcpd/dhcpd.c')
-rw-r--r--sys/src/cmd/ip/dhcpd/dhcpd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/src/cmd/ip/dhcpd/dhcpd.c b/sys/src/cmd/ip/dhcpd/dhcpd.c
index d74e6391c..d468c8190 100644
--- a/sys/src/cmd/ip/dhcpd/dhcpd.c
+++ b/sys/src/cmd/ip/dhcpd/dhcpd.c
@@ -1584,15 +1584,17 @@ hexopt(Req *rp, int t, char *str)
void
dnsnamesopt(Req *rp, int t, char *attr, Ndbtuple *nt)
{
- char *s;
+ char val[Maxstr], *s;
uchar *d;
int n, l;
for(; nt != nil; nt = nt->entry){
if(strcmp(nt->attr, attr) != 0)
continue;
+ if(utf2idn(nt->val, val, sizeof(val)) == nil)
+ continue;
d = &rp->p[2];
- for(s = nt->val; *s != 0; s++){
+ for(s = val; *s != 0; s++){
for(l = 0; *s != 0 && *s != '.'; l++)
s++;
if(l > 077)
@@ -1602,6 +1604,8 @@ dnsnamesopt(Req *rp, int t, char *attr, Ndbtuple *nt)
return;
d[-l-1] = l;
memmove(d-l, s-l, l);
+ if(*s != '.')
+ break;
}
*d++ = 0;
n = d - &rp->p[2];
@@ -1610,7 +1614,7 @@ dnsnamesopt(Req *rp, int t, char *attr, Ndbtuple *nt)
rp->p[0] = t;
rp->p[1] = n;
rp->p = d;
- op = seprint(op, oe, "%s(%s)", optname[t], nt->val);
+ op = seprint(op, oe, "%s(%s)", optname[t], val);
Skip:;
}
}