libcli/nbt Cope with blank lines in DNS hosts file
authorAndrew Bartlett <abartlet@samba.org>
Wed, 6 Apr 2011 02:09:41 +0000 (12:09 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 6 Apr 2011 02:34:57 +0000 (12:34 +1000)
libcli/nbt/dns_hosts_file.c

index c6491a925e96e57a566d50565e0b4c5745a14c4b..801393650e037afde741ab79f5be77c0afbe6518 100644 (file)
@@ -85,15 +85,15 @@ static bool getdns_hosts_fileent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, cha
                        ++count;
                if (next_token_talloc(ctx, &ptr, &name, NULL))
                        ++count;
-               if (strcasecmp(name_type, "A") == 0) {
+               if (name_type && strcasecmp(name_type, "A") == 0) {
                        if (next_token_talloc(ctx, &ptr, &ip, NULL))
                                ++count;
-               } else if (strcasecmp(name_type, "SRV") == 0) {
+               } else if (name_type && strcasecmp(name_type, "SRV") == 0) {
                        if (next_token_talloc(ctx, &ptr, &next_name, NULL))
                                ++count;
                        if (next_token_talloc(ctx, &ptr, &port, NULL))
                                ++count;
-               } else if (strcasecmp(name_type, "CNAME") == 0) {
+               } else if (name_type && strcasecmp(name_type, "CNAME") == 0) {
                        if (next_token_talloc(ctx, &ptr, &next_name, NULL))
                                ++count;
                }