Commit 45e22378 authored by Brian Wellington's avatar Brian Wellington
Browse files

dns_name_tofilenametext() now downcases the name, which means the callers

don't need to.
parent c0968380
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-makekeyset.c,v 1.50 2001/03/27 22:57:40 bwelling Exp $ */
/* $Id: dnssec-makekeyset.c,v 1.51 2001/03/27 23:43:12 bwelling Exp $ */
#include <config.h>
......@@ -246,7 +246,6 @@ main(int argc, char *argv[]) {
for (i = 0; i < argc; i++) {
char namestr[DNS_NAME_FORMATSIZE];
dns_fixedname_t fname;
isc_buffer_t namebuf;
key = NULL;
......@@ -258,11 +257,7 @@ main(int argc, char *argv[]) {
rdatalist.rdclass = dst_key_class(key);
isc_buffer_init(&namebuf, namestr, sizeof namestr);
dns_fixedname_init(&fname);
dns_name_downcase(dst_key_name(key),
dns_fixedname_name(&fname),
NULL);
result = dns_name_tofilenametext(dns_fixedname_name(&fname),
result = dns_name_tofilenametext(dst_key_name(key),
ISC_FALSE,
&namebuf);
check_result(result, "dns_name_tofilenametext");
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.132 2001/03/27 22:57:43 bwelling Exp $ */
/* $Id: dnssec-signzone.c,v 1.133 2001/03/27 23:43:13 bwelling Exp $ */
#include <config.h>
......@@ -505,7 +505,6 @@ static void
opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
dns_db_t **dbp)
{
dns_fixedname_t fname;
char filename[256];
isc_buffer_t b;
isc_result_t result;
......@@ -517,10 +516,7 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
isc_buffer_putstr(&b, "/");
}
isc_buffer_putstr(&b, prefix);
dns_fixedname_init(&fname);
(void)dns_name_downcase(name, dns_fixedname_name(&fname), NULL);
result = dns_name_tofilenametext(dns_fixedname_name(&fname),
ISC_FALSE, &b);
result = dns_name_tofilenametext(name, ISC_FALSE, &b);
check_result(result, "dns_name_tofilenametext()");
if (isc_buffer_availablelength(&b) == 0) {
char namestr[DNS_NAME_FORMATSIZE];
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.h,v 1.92 2001/03/27 22:57:47 bwelling Exp $ */
/* $Id: name.h,v 1.93 2001/03/27 23:43:10 bwelling Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
......@@ -919,7 +919,8 @@ dns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot,
isc_buffer_t *target);
/*
* Convert 'name' into an alternate text format appropriate for filenames,
* storing the result in 'target'.
* storing the result in 'target'. The name data is downcased, guaranteeing
* that the filename does not depend on the case of the converted name.
*
* Notes:
* If 'omit_final_dot' is true, then the final '.' in absolute
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.c,v 1.122 2001/03/27 22:57:45 bwelling Exp $ */
/* $Id: name.c,v 1.123 2001/03/27 23:43:09 bwelling Exp $ */
#include <config.h>
......@@ -1926,6 +1926,9 @@ dns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot,
{
if (trem == 0)
return (ISC_R_NOSPACE);
/* downcase */
if (c >= 0x41 && c <= 0x5A)
c += 0x20;
CONVERTFROMASCII(c);
*tdata++ = c;
ndata++;
......
......@@ -19,7 +19,7 @@
/*
* Principal Author: Brian Wellington
* $Id: dst_api.c,v 1.75 2001/03/27 22:57:48 bwelling Exp $
* $Id: dst_api.c,v 1.76 2001/03/27 23:43:15 bwelling Exp $
*/
#include <config.h>
......@@ -937,7 +937,6 @@ buildfilename(dns_name_t *name, const dns_keytag_t id,
const char *suffix = "";
unsigned int len;
isc_result_t result;
dns_fixedname_t fname;
REQUIRE(out != NULL);
if ((type & DST_TYPE_PRIVATE) != 0)
......@@ -954,11 +953,8 @@ buildfilename(dns_name_t *name, const dns_keytag_t id,
}
if (isc_buffer_availablelength(out) < 1)
return (ISC_R_NOSPACE);
dns_fixedname_init(&fname);
(void)dns_name_downcase(name, dns_fixedname_name(&fname), NULL);
isc_buffer_putstr(out, "K");
result = dns_name_tofilenametext(dns_fixedname_name(&fname),
ISC_FALSE, out);
result = dns_name_tofilenametext(name, ISC_FALSE, out);
if (result != ISC_R_SUCCESS)
return (result);
len = 1 + 3 + 1 + 5 + strlen(suffix) + 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment