DNS Tsig buffer
simo
idra at samba.org
Wed Sep 5 06:38:45 MDT 2012
On Wed, 2012-09-05 at 10:46 +0200, Kai Blin wrote:
> +struct dns_server_tkey *dns_find_tkey(struct dns_server_tkey_store
> *store,
> + const char *name)
> +{
> + struct dns_server_tkey *tkey = NULL;
> + uint16_t i = 0;
> +
> + do {
> + struct dns_server_tkey *tmp_key = store->tkeys[i];
> +
> + i++;
> + i %= TKEY_BUFFER_SIZE;
> +
> + if (tmp_key == NULL) {
> + continue;
> + }
> + if (dns_name_equal(name, tmp_key->name)) {
> + tkey = tmp_key;
> + break;
> + }
> + } while (i != 0);
> +
> + return tkey;
> +}
> +
Kai,
it would be better to use a hash table (for example a tdb file) rather
than a circular buffer. A buffer like this is extremely inefficient,l
and will be quite slow in the worst situation when the buffer is filling
up.
Simo.
--
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>
More information about the samba-technical
mailing list