Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/dist/bind/lib/dst Pull up revision 1.5 (requested by it...
details: https://anonhg.NetBSD.org/src/rev/3e1805048a18
branches: netbsd-1-6
changeset: 528181:3e1805048a18
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Jun 28 11:43:03 2002 +0000
description:
Pull up revision 1.5 (requested by itojun in ticket #387):
Update to BIND 8.3.3. Fixes buffer overrun in resolver code.
diffstat:
dist/bind/lib/dst/dst_api.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diffs (81 lines):
diff -r 89c5d8749834 -r 3e1805048a18 dist/bind/lib/dst/dst_api.c
--- a/dist/bind/lib/dst/dst_api.c Fri Jun 28 11:42:54 2002 +0000
+++ b/dist/bind/lib/dst/dst_api.c Fri Jun 28 11:43:03 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: dst_api.c,v 1.4 2001/05/17 23:00:18 itojun Exp $ */
+/* $NetBSD: dst_api.c,v 1.4.2.1 2002/06/28 11:43:03 lukem Exp $ */
#ifndef LINT
-static const char rcsid[] = "Header: /proj/cvs/isc/bind8/src/lib/dst/dst_api.c,v 1.17 2001/04/05 22:00:02 bwelling Exp";
+static const char rcsid[] = "Header: /proj/cvs/isc/bind8/src/lib/dst/dst_api.c,v 1.20 2001/07/26 01:20:08 marka Exp";
#endif
/*
@@ -64,7 +64,8 @@
/* static variables */
static int done_init = 0;
dst_func *dst_t_func[DST_MAX_ALGS];
-char *dst_path = "";
+const char *key_file_fmt_str = "Private-key-format: v%s\nAlgorithm: %d (%s)\n";
+const char *dst_path = "";
/* internal I/O functions */
static DST_KEY *dst_s_read_public_key(const char *in_name,
@@ -110,12 +111,14 @@
} else if (stat(s, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
EREPORT(("%s is not a valid directory\n", s));
} else {
- dst_path = (char *) malloc(len + 2);
- memcpy(dst_path, s, len + 1);
- if (dst_path[strlen(dst_path) - 1] != '/') {
- dst_path[strlen(dst_path) + 1] = 0;
- dst_path[strlen(dst_path)] = '/';
+ char *tmp;
+ tmp = (char *) malloc(len + 2);
+ memcpy(tmp, s, len + 1);
+ if (tmp[strlen(tmp) - 1] != '/') {
+ tmp[strlen(tmp) + 1] = 0;
+ tmp[strlen(tmp)] = '/';
}
+ dst_path = tmp;
}
}
memset(dst_t_func, 0, sizeof(dst_t_func));
@@ -434,7 +437,7 @@
int nn;
if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
- file, out_len, nn, errno));
+ file, len, nn, errno));
return (-5);
}
fclose(fp);
@@ -556,7 +559,7 @@
enckey[--len] = '\0';
/* remove leading spaces */
- for (notspace = (char *) enckey; isspace(*notspace); len--)
+ for (notspace = (char *) enckey; isspace((*notspace)&0xff); len--)
notspace++;
dlen = b64_pton(notspace, deckey, sizeof(deckey));
@@ -590,6 +593,7 @@
u_char out_key[RAW_KEY_SIZE];
char enc_key[RAW_KEY_SIZE];
int len = 0;
+ int mode;
memset(out_key, 0, sizeof(out_key));
if (key == NULL) {
@@ -605,8 +609,10 @@
key->dk_key_name, key->dk_id, PUBLIC_KEY));
return (0);
}
+ /* XXX in general this should be a check for symmetric keys */
+ mode = (key->dk_alg == KEY_HMAC_MD5) ? 0600 : 0644;
/* create public key file */
- if ((fp = dst_s_fopen(filename, "w+", 0644)) == NULL) {
+ if ((fp = dst_s_fopen(filename, "w+", mode)) == NULL) {
EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n",
filename, errno));
return (0);
Home |
Main Index |
Thread Index |
Old Index