]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
prettier, now for the zone syntax check.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 23 Feb 2016 13:29:35 +0000 (13:29 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 23 Feb 2016 13:29:35 +0000 (13:29 +0000)
git-svn-id: file:///svn/unbound/trunk@3637 be551aaa-1e26-0410-a405-d3ace91eadb9

libunbound/libunbound.c

index adf0a5764f27def500892b5d9dca5476cdda005d..992509e7e27ea36c0ec39be947dec4cac65211e2 100644 (file)
@@ -931,15 +931,18 @@ int ub_ctx_set_stub(struct ub_ctx* ctx, const char* zone, const char* addr,
        struct config_stub **prev, *elem;
 
        /* check syntax for zone name */
-       uint8_t* nm;
-       int nmlabs;
-       size_t nmlen;
-       if(!parse_dname(zone, &nm, &nmlen, &nmlabs)) {
-               errno=EINVAL;
-               return UB_SYNTAX; /* should have zone name, or "." for root */
+       if(zone) {
+               uint8_t* nm;
+               int nmlabs;
+               size_t nmlen;
+               if(!parse_dname(zone, &nm, &nmlen, &nmlabs)) {
+                       errno=EINVAL;
+                       return UB_SYNTAX;
+               }
+               free(nm);
+       } else {
+               zone = ".";
        }
-       free(nm);
-       nm = NULL;
 
        /* check syntax for addr (if not NULL) */
        if(addr) {