summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-08-23 15:01:08 +0000
committerTim Potter <tpot@samba.org>2002-08-23 15:01:08 +0000
commit6bca45020764ac36eee77518bc3727aaf5ebc268 (patch)
treeb4b2f364ca4dd13c55e1028d1f907cfac95c1154 /source3
parentf38fc7b3b1ded90c2562bdfc9aaa7a026ec1e56a (diff)
downloadsamba-6bca45020764ac36eee77518bc3727aaf5ebc268.tar.gz
samba-6bca45020764ac36eee77518bc3727aaf5ebc268.tar.bz2
samba-6bca45020764ac36eee77518bc3727aaf5ebc268.zip
Cope with negative cache dns entries better.
(This used to be commit 3404023260a5d6fed5523eb378d4a1ad418302a0)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/namecache.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index d985832613..31341df86e 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -91,19 +91,20 @@ static TDB_DATA namecache_value(struct in_addr *ip_list, int num_names,
{
TDB_DATA retval;
struct nc_value *value;
- int size;
-
- size = sizeof(struct nc_value);
+ int size = sizeof(struct nc_value);
if (num_names > 0)
size += sizeof(struct in_addr) * (num_names-1);
value = (struct nc_value *)malloc(size);
-
+
+ memset(value, 0, size);
+
value->expiry = expiry;
value->count = num_names;
- memcpy(value->ip_list, ip_list, sizeof(*ip_list));
+ if (ip_list)
+ memcpy(value->ip_list, ip_list, sizeof(*ip_list));
retval.dptr = (char *)value;
retval.dsize = size;