summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2002-05-28 11:23:21 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2002-05-28 11:23:21 +0000
commitb7b42c02814ce96ad9e72e1041e4e9a4ad08ec7b (patch)
tree4f48558cab7ae8e5c15532c55d25aed190c387a0 /sbin
parenta110bd034b66c81e3f4781d6d286ba5c4b488f41 (diff)
off_t to size_t change for printf format and malloc. Pointed out by <greg@nest.cx>
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/conf.c4
-rw-r--r--sbin/isakmpd/ike_auth.c13
-rw-r--r--sbin/isakmpd/policy.c16
-rw-r--r--sbin/isakmpd/util.c6
-rw-r--r--sbin/isakmpd/util.h4
5 files changed, 23 insertions, 20 deletions
diff --git a/sbin/isakmpd/conf.c b/sbin/isakmpd/conf.c
index 1de08e1c46a..f09f19d8e83 100644
--- a/sbin/isakmpd/conf.c
+++ b/sbin/isakmpd/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.39 2002/04/29 06:26:50 pvalchev Exp $ */
+/* $OpenBSD: conf.c,v 1.40 2002/05/28 11:23:20 ho Exp $ */
/* $EOM: conf.c,v 1.48 2000/12/04 02:04:29 angelos Exp $ */
/*
@@ -574,7 +574,7 @@ conf_reinit (void)
{
struct conf_binding *cb = 0;
int fd, i, trans;
- off_t sz;
+ size_t sz;
char *new_conf_addr = 0;
struct stat sb;
diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c
index ad0be27a868..c5f7b06b264 100644
--- a/sbin/isakmpd/ike_auth.c
+++ b/sbin/isakmpd/ike_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_auth.c,v 1.61 2002/01/23 17:14:28 ho Exp $ */
+/* $OpenBSD: ike_auth.c,v 1.62 2002/05/28 11:23:20 ho Exp $ */
/* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */
/*
@@ -205,6 +205,7 @@ ike_auth_get_key (int type, char *id, char *local_id, size_t *keylen)
struct keynote_deckey dc;
char *privkeyfile, *buf2;
int fd, pkflen;
+ size_t size;
pkflen = strlen (keyfile) + strlen (local_id) +
sizeof PRIVATE_KEY_FILE + sizeof "//" - 1;
@@ -225,6 +226,7 @@ ike_auth_get_key (int type, char *id, char *local_id, size_t *keylen)
free (keyfile);
goto ignorekeynote;
}
+ size = (size_t)sb.st_size;
fd = open (keyfile, O_RDONLY, 0);
if (fd < 0)
@@ -234,21 +236,20 @@ ike_auth_get_key (int type, char *id, char *local_id, size_t *keylen)
return 0;
}
- buf = calloc (sb.st_size + 1, sizeof (char));
+ buf = calloc (size + 1, sizeof (char));
if (!buf)
{
log_print ("ike_auth_get_key: failed allocating %d bytes",
- sb.st_size + 1);
+ size + 1);
free (keyfile);
return 0;
}
- if (read (fd, buf, sb.st_size) != sb.st_size)
+ if (read (fd, buf, size) != size)
{
free (buf);
log_print ("ike_auth_get_key: "
- "failed reading %d bytes from \"%s\"",
- sb.st_size, keyfile);
+ "failed reading %d bytes from \"%s\"", size, keyfile);
free (keyfile);
return 0;
}
diff --git a/sbin/isakmpd/policy.c b/sbin/isakmpd/policy.c
index 962f8d9e319..dc44c146707 100644
--- a/sbin/isakmpd/policy.c
+++ b/sbin/isakmpd/policy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: policy.c,v 1.50 2002/01/23 22:14:28 angelos Exp $ */
+/* $OpenBSD: policy.c,v 1.51 2002/05/28 11:23:20 ho Exp $ */
/* $EOM: policy.c,v 1.49 2000/10/24 13:33:39 niklas Exp $ */
/*
@@ -1806,7 +1806,7 @@ policy_init (void)
{
char *ptr, *policy_file;
char **asserts;
- off_t sz;
+ size_t sz;
int fd, len, i;
LOG_DBG ((LOG_POLICY, 30, "policy_init: initializing"));
@@ -2004,6 +2004,7 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert,
{
char *dirname, *file, *addr_str;
struct stat sb;
+ size_t size;
int idtype, fd, len;
if (!id)
@@ -2079,12 +2080,13 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert,
free (file);
return 0;
}
+ size = (size_t)sb.st_size;
- *cert = calloc (sb.st_size + 1, sizeof (char));
+ *cert = calloc (size + 1, sizeof (char));
if (*cert == NULL)
{
log_error ("keynote_cert_obtain: failed to allocate %d bytes",
- sb.st_size);
+ size);
free (file);
return 0;
}
@@ -2098,10 +2100,10 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert,
return 0;
}
- if (read (fd, *cert, sb.st_size) != sb.st_size)
+ if (read (fd, *cert, size) != size)
{
LOG_DBG ((LOG_POLICY, 30, "keynote_cert_obtain: failed to read %d "
- "bytes from \"%s\"", sb.st_size, file));
+ "bytes from \"%s\"", size, file));
free (file);
close (fd);
return 0;
@@ -2109,7 +2111,7 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert,
close (fd);
free (file);
- *certlen = sb.st_size;
+ *certlen = size;
return 1;
}
diff --git a/sbin/isakmpd/util.c b/sbin/isakmpd/util.c
index d5f67aebd75..7ca1221c637 100644
--- a/sbin/isakmpd/util.c
+++ b/sbin/isakmpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.26 2002/01/23 18:44:48 ho Exp $ */
+/* $OpenBSD: util.c,v 1.27 2002/05/28 11:23:20 ho Exp $ */
/* $EOM: util.c,v 1.23 2000/11/23 12:22:08 niklas Exp $ */
/*
@@ -489,7 +489,7 @@ util_ntoa (char **buf, int af, u_int8_t *addr)
* Also, if FILE_SIZE is a not a null pointer, store file size here.
*/
int
-check_file_secrecy (char *name, off_t *file_size)
+check_file_secrecy (char *name, size_t *file_size)
{
struct stat st;
@@ -514,7 +514,7 @@ check_file_secrecy (char *name, off_t *file_size)
}
if (file_size)
- *file_size = st.st_size;
+ *file_size = (size_t)st.st_size;
return 0;
}
diff --git a/sbin/isakmpd/util.h b/sbin/isakmpd/util.h
index ca1bb27322b..33fa924fa89 100644
--- a/sbin/isakmpd/util.h
+++ b/sbin/isakmpd/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.13 2001/10/26 12:03:07 ho Exp $ */
+/* $OpenBSD: util.h,v 1.14 2002/05/28 11:23:20 ho Exp $ */
/* $EOM: util.h,v 1.10 2000/10/24 13:33:39 niklas Exp $ */
/*
@@ -49,7 +49,7 @@ extern unsigned long seed;
struct message;
struct sockaddr;
-extern int check_file_secrecy (char *, off_t *);
+extern int check_file_secrecy (char *, size_t *);
extern u_int16_t decode_16 (u_int8_t *);
extern u_int32_t decode_32 (u_int8_t *);
extern u_int64_t decode_64 (u_int8_t *);