~andreserl/ubuntu/lucid/bind9/bind9-apport-533601

« back to all changes in this revision

Viewing changes to lib/dns/compress.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 
2
 * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3
3
 * Copyright (C) 1999-2001  Internet Software Consortium.
4
4
 *
5
 
 * Permission to use, copy, modify, and distribute this software for any
 
5
 * Permission to use, copy, modify, and/or distribute this software for any
6
6
 * purpose with or without fee is hereby granted, provided that the above
7
7
 * copyright notice and this permission notice appear in all copies.
8
8
 *
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: compress.c,v 1.50.206.2 2004/03/06 08:13:37 marka Exp $ */
 
18
/* $Id: compress.c,v 1.59 2007/06/19 23:47:16 tbox Exp $ */
 
19
 
 
20
/*! \file */
19
21
 
20
22
#define DNS_NAME_USEINLINE 1
21
23
 
82
84
dns_compress_setmethods(dns_compress_t *cctx, unsigned int allowed) {
83
85
        REQUIRE(VALID_CCTX(cctx));
84
86
 
85
 
        cctx->allowed = allowed;
 
87
        cctx->allowed &= ~DNS_COMPRESS_ALL;
 
88
        cctx->allowed |= (allowed & DNS_COMPRESS_ALL);
86
89
}
87
90
 
88
91
unsigned int
89
92
dns_compress_getmethods(dns_compress_t *cctx) {
90
93
        REQUIRE(VALID_CCTX(cctx));
91
 
        return (cctx->allowed);
 
94
        return (cctx->allowed & DNS_COMPRESS_ALL);
 
95
}
 
96
 
 
97
void
 
98
dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive) {
 
99
        REQUIRE(VALID_CCTX(cctx));
 
100
 
 
101
        if (sensitive)
 
102
                cctx->allowed |= DNS_COMPRESS_CASESENSITIVE;
 
103
        else
 
104
                cctx->allowed &= ~DNS_COMPRESS_CASESENSITIVE;
 
105
}
 
106
 
 
107
isc_boolean_t
 
108
dns_compress_getsensitive(dns_compress_t *cctx) {
 
109
        REQUIRE(VALID_CCTX(cctx));
 
110
 
 
111
        return (ISC_TF((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) != 0));
92
112
}
93
113
 
94
114
int
111
131
 * If no match is found return ISC_FALSE.
112
132
 */
113
133
isc_boolean_t
114
 
dns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name,
 
134
dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name,
115
135
                        dns_name_t *prefix, isc_uint16_t *offset)
116
136
{
117
137
        dns_name_t tname, nname;
138
158
                for (node = cctx->table[hash]; node != NULL; node = node->next)
139
159
                {
140
160
                        NODENAME(node, &nname);
141
 
                        if (dns_name_equal(&nname, &tname))
142
 
                                break;
 
161
                        if ((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) != 0) {
 
162
                                if (dns_name_caseequal(&nname, &tname))
 
163
                                        break;
 
164
                        } else {
 
165
                                if (dns_name_equal(&nname, &tname))
 
166
                                        break;
 
167
                        }
143
168
                }
144
169
                if (node != NULL)
145
170
                        break;
161
186
}
162
187
 
163
188
static inline unsigned int
164
 
name_length(dns_name_t *name) {
 
189
name_length(const dns_name_t *name) {
165
190
        isc_region_t r;
166
191
        dns_name_toregion(name, &r);
167
192
        return (r.length);
168
193
}
169
194
 
170
195
void
171
 
dns_compress_add(dns_compress_t *cctx, dns_name_t *name, dns_name_t *prefix,
172
 
                 isc_uint16_t offset)
 
196
dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
 
197
                 const dns_name_t *prefix, isc_uint16_t offset)
173
198
{
174
199
        dns_name_t tname;
175
200
        unsigned int start;