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

« back to all changes in this revision

Viewing changes to lib/bind/dst/support.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
 
static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/support.c,v 1.2.2.1.10.2 2005/10/11 00:48:14 marka Exp $";
 
1
static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/support.c,v 1.6 2005/10/11 00:10:13 marka Exp $";
2
2
 
3
3
 
4
4
/*
34
34
 
35
35
#include "port_after.h"
36
36
 
37
 
/*
 
37
/*%
38
38
 * dst_s_verify_str()
39
39
 *     Validate that the input string(*str) is at the head of the input
40
40
 *     buffer(**buf).  If so, move the buffer head pointer (*buf) to
52
52
dst_s_verify_str(const char **buf, const char *str)
53
53
{
54
54
        int b, s;
55
 
        if (*buf == NULL)       /* error checks */
 
55
        if (*buf == NULL)       /*%< error checks */
56
56
                return (0);
57
57
        if (str == NULL || *str == '\0')
58
58
                return (1);
59
59
 
60
 
        b = strlen(*buf);       /* get length of strings */
 
60
        b = strlen(*buf);       /*%< get length of strings */
61
61
        s = strlen(str);
62
 
        if (s > b || strncmp(*buf, str, s))     /* check if same */
63
 
                return (0);     /* not a match */
64
 
        (*buf) += s;            /* advance pointer */
 
62
        if (s > b || strncmp(*buf, str, s))     /*%< check if same */
 
63
                return (0);     /*%< not a match */
 
64
        (*buf) += s;            /*%< advance pointer */
65
65
        return (1);
66
66
}
67
67
 
68
 
/*
 
68
/*%
69
69
 * dst_s_calculate_bits
70
70
 *     Given a binary number represented in a u_char[], determine
71
71
 *     the number of significant bits used.
89
89
        return (bits);
90
90
}
91
91
 
92
 
 
93
 
/*
 
92
/*%
94
93
 * calculates a checksum used in dst for an id.
95
94
 * takes an array of bytes and a length.
96
95
 * returns a 16  bit checksum.
115
114
        return (ac & 0xffff);
116
115
}
117
116
 
118
 
/* 
 
117
/*%
119
118
 * dst_s_dns_key_id() Function to calculate DNSSEC footprint from KEY record
120
119
 *   rdata
121
120
 * Input:
131
130
                return 0;
132
131
 
133
132
        /* compute id */
134
 
        if (dns_key_rdata[3] == KEY_RSA)        /* Algorithm RSA */
 
133
        if (dns_key_rdata[3] == KEY_RSA)        /*%< Algorithm RSA */
135
134
                return dst_s_get_int16((const u_char *)
136
135
                                       &dns_key_rdata[rdata_len - 3]);
137
136
        else if (dns_key_rdata[3] == KEY_HMAC_MD5)
142
141
                return dst_s_id_calc(dns_key_rdata, rdata_len);
143
142
}
144
143
 
145
 
/*
 
144
/*%
146
145
 * dst_s_get_int16
147
146
 *     This routine extracts a 16 bit integer from a two byte character
148
147
 *     string.  The character string is assumed to be in network byte
161
160
        return (a);
162
161
}
163
162
 
164
 
 
165
 
/*
 
163
/*%
166
164
 * dst_s_get_int32
167
165
 *     This routine extracts a 32 bit integer from a four byte character
168
166
 *     string.  The character string is assumed to be in network byte
182
180
        return (a);
183
181
}
184
182
 
185
 
 
186
 
/*
 
183
/*%
187
184
 * dst_s_put_int16
188
185
 *     Take a 16 bit integer and store the value in a two byte
189
186
 *     character string.  The integer is assumed to be in network
201
198
        buf[1] = (u_int8_t)(val);
202
199
}
203
200
 
204
 
 
205
 
/*
 
201
/*%
206
202
 * dst_s_put_int32
207
203
 *     Take a 32 bit integer and store the value in a four byte
208
204
 *     character string.  The integer is assumed to be in network
222
218
        buf[3] = (u_int8_t)(val);
223
219
}
224
220
 
225
 
 
226
 
/*
 
221
/*%
227
222
 *  dst_s_filename_length
228
223
 *
229
224
 *      This function returns the number of bytes needed to hold the
230
225
 *      filename for a key file.  '/', '\' and ':' are not allowed.
231
 
 *      form:  K<keyname>+<alg>+<id>.<suffix>
 
226
 *      form:  K&lt;keyname&gt;+&lt;alg&gt;+&lt;id&gt;.&lt;suffix&gt;
232
227
 *
233
228
 *      Returns 0 if the filename would contain either '\', '/' or ':'
234
229
 */
254
249
        return (1 + strlen(name) + 6 + strlen(suffix));
255
250
}
256
251
 
257
 
 
258
 
/*
 
252
/*%
259
253
 *  dst_s_build_filename ()
260
254
 *      Builds a key filename from the key name, it's id, and a
261
255
 *      suffix.  '\', '/' and ':' are not allowed. fA filename is of the
262
 
 *      form:  K<keyname><id>.<suffix>
263
 
 *      form: K<keyname>+<alg>+<id>.<suffix>
 
256
 *      form:  K&lt;keyname&gt;&lt;id&gt;.&lt;suffix&gt;
 
257
 *      form: K&lt;keyname&gt;+&lt;alg&gt;+&lt;id&gt;.&lt;suffix&gt;
264
258
 *
265
259
 *      Returns -1 if the conversion fails:
266
260
 *        if the filename would be too long for space allotted
294
288
        return (0);
295
289
}
296
290
 
297
 
/*
 
291
/*%
298
292
 *  dst_s_fopen ()
299
293
 *     Open a file in the dst_path directory.  If perm is specified, the
300
294
 *     file is checked for existence first, and not opened if it exists.
344
338
#endif
345
339
        }
346
340
}
 
341
 
 
342
/*! \file */