s4-dns: dlz_bind9: Check result to avoid segfault
commit666a5630ef3b03640089a0b6e81bf578b91b88ab
authorStefan Gohmann <gohmann@univention.de>
Fri, 8 Mar 2013 19:57:31 +0000 (8 20:57 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 9 Mar 2013 05:30:21 +0000 (9 06:30 +0100)
treeac2af7f11291fc1bb7c6cff3ec43807119d4f0d8
parent83e4ff9a4ed06bd60a902a3b2f385ab69356b35b
s4-dns: dlz_bind9: Check result to avoid segfault

We saw this issue in a customer environment with many CNF objects. I
wasn't able to reproduce it, but I got the following core dump:

 (gdb) directory samba4-4.0.0~rc6/source4/dns_server/
 Source directories searched: /root/samba4-4.0.0~rc6/source4/dns_server:$cdir:$cwd
 (gdb) bt
 #0  0xb4b0bc13 in dlz_lookup_types (state=0x9648e48, zone=0xb659b9a8 "xxxxxx.xxxxx.de", name=0xb659bda8 "client9173", lookup=0xb6db7588, types=0x0) at ../source4/dns_server/dlz_bind9.c:830
 #1  0xb4b0bdb8 in dlz_lookup (zone=0xb659b9a8 "xxxxxx.xxxxx.de", name=0xb659bda8 "client9173", dbdata=0x9648e48, lookup=0xb6db7588) at ../source4/dns_server/dlz_bind9.c:875
 #2  0x080b43d8 in dlopen_dlz_lookup ()
 #3  0xb7701755 in findnode () from /usr/lib/libdns.so.81
 #4  0xb7701d22 in find () from /usr/lib/libdns.so.81
 #5  0xb7639e5f in dns_db_find () from /usr/lib/libdns.so.81
 #6  0x08075476 in query_find ()
 #7  0x0807acb9 in ns_query_start ()
 #8  0x08060712 in client_request ()
 #9  0xb743022b in run () from /usr/lib/libisc.so.81
 #10 0xb7216955 in start_thread () from /lib/i686/cmov/libpthread.so.0
 #11 0xb706c1de in clone () from /lib/i686/cmov/libc.so.6
 (gdb) f 0
 #0  0xb4b0bc13 in dlz_lookup_types (state=0x9648e48, zone=0xb659b9a8 "xxxxxx.xxxxx.de", name=0xb659bda8 "client9173", lookup=0xb6db7588, types=0x0) at ../source4/dns_server/dlz_bind9.c:830
 830             el = ldb_msg_find_element(res->msgs[0], "dnsRecord");
 (gdb) p res->msgs
 $1 = (struct ldb_message **) 0x0
 (gdb) p res->count
 $2 = 0
 (gdb)

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dns_server/dlz_bind9.c