diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-01 07:44:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-01 07:44:23 +0000 |
commit | f513dc36f4e8026dcc54d6eca9240142830b7670 (patch) | |
tree | a7695df419f6006fc1e66fb26caedd25d34087d7 /sbin | |
parent | 715efc5fb1f53da06a4bbf265ecf4758c59b5f52 (diff) |
size_t must be cast to (unsigned long) and printed using %lu
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/cert.c | 4 | ||||
-rw-r--r-- | sbin/isakmpd/conf.c | 13 | ||||
-rw-r--r-- | sbin/isakmpd/connection.c | 8 | ||||
-rw-r--r-- | sbin/isakmpd/crypto.c | 8 | ||||
-rw-r--r-- | sbin/isakmpd/exchange.c | 19 | ||||
-rw-r--r-- | sbin/isakmpd/ike_auth.c | 42 | ||||
-rw-r--r-- | sbin/isakmpd/ike_phase_1.c | 57 | ||||
-rw-r--r-- | sbin/isakmpd/ike_quick_mode.c | 140 | ||||
-rw-r--r-- | sbin/isakmpd/ipsec.c | 23 | ||||
-rw-r--r-- | sbin/isakmpd/isakmp_cfg.c | 20 | ||||
-rw-r--r-- | sbin/isakmpd/isakmpd.c | 6 | ||||
-rw-r--r-- | sbin/isakmpd/key.c | 8 | ||||
-rw-r--r-- | sbin/isakmpd/math_group.c | 12 | ||||
-rw-r--r-- | sbin/isakmpd/message.c | 45 | ||||
-rw-r--r-- | sbin/isakmpd/pf_key_v2.c | 31 | ||||
-rw-r--r-- | sbin/isakmpd/policy.c | 124 | ||||
-rw-r--r-- | sbin/isakmpd/prf.c | 6 | ||||
-rw-r--r-- | sbin/isakmpd/sa.c | 18 | ||||
-rw-r--r-- | sbin/isakmpd/udp.c | 16 | ||||
-rw-r--r-- | sbin/isakmpd/ui.c | 10 | ||||
-rw-r--r-- | sbin/isakmpd/x509.c | 21 |
21 files changed, 333 insertions, 298 deletions
diff --git a/sbin/isakmpd/cert.c b/sbin/isakmpd/cert.c index d1046dee606..c1a06620f3c 100644 --- a/sbin/isakmpd/cert.c +++ b/sbin/isakmpd/cert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cert.c,v 1.19 2001/11/03 12:15:36 ho Exp $ */ +/* $OpenBSD: cert.c,v 1.20 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: cert.c,v 1.18 2000/09/28 12:53:27 niklas Exp $ */ /* @@ -133,7 +133,7 @@ certreq_decode (u_int16_t type, u_int8_t *data, u_int32_t datalen) ret = malloc (sizeof aca); if (!ret) { - log_error ("certreq_decode: malloc (%d) failed", sizeof aca); + log_error ("certreq_decode: malloc (%lu) failed", (unsigned long)sizeof aca); handler->free_aca (aca.data); return 0; } diff --git a/sbin/isakmpd/conf.c b/sbin/isakmpd/conf.c index f09f19d8e83..5ac87436390 100644 --- a/sbin/isakmpd/conf.c +++ b/sbin/isakmpd/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.40 2002/05/28 11:23:20 ho Exp $ */ +/* $OpenBSD: conf.c,v 1.41 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: conf.c,v 1.48 2000/12/04 02:04:29 angelos Exp $ */ /* @@ -202,7 +202,7 @@ conf_set_now (char *section, char *tag, char *value, int override, node = calloc (1, sizeof *node); if (!node) { - log_error ("conf_set: calloc (1, %d) failed", sizeof *node); + log_error ("conf_set: calloc (1, %lu) failed", (unsigned long)sizeof *node); return 1; } node->section = strdup (section); @@ -593,15 +593,15 @@ conf_reinit (void) new_conf_addr = malloc (sz); if (!new_conf_addr) { - log_error ("conf_reinit: malloc (%d) failed", sz); + log_error ("conf_reinit: malloc (%lu) failed", (unsigned long)sz); goto fail; } /* XXX I assume short reads won't happen here. */ if (read (fd, new_conf_addr, sz) != sz) { - log_error ("conf_reinit: read (%d, %p, %d) failed", - fd, new_conf_addr, sz); + log_error ("conf_reinit: read (%d, %p, %lu) failed", + fd, new_conf_addr, (unsigned long)sz); goto fail; } close (fd); @@ -921,7 +921,8 @@ conf_trans_node (int transaction, enum conf_op op) node = calloc (1, sizeof *node); if (!node) { - log_error ("conf_trans_node: calloc (1, %d) failed", sizeof *node); + log_error ("conf_trans_node: calloc (1, %lu) failed", + (unsigned long)sizeof *node); return 0; } node->trans = transaction; diff --git a/sbin/isakmpd/connection.c b/sbin/isakmpd/connection.c index 8cbb0f12688..b2c9655ff5d 100644 --- a/sbin/isakmpd/connection.c +++ b/sbin/isakmpd/connection.c @@ -1,4 +1,4 @@ -/* $OpenBSD: connection.c,v 1.22 2001/07/06 14:37:11 ho Exp $ */ +/* $OpenBSD: connection.c,v 1.23 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: connection.c,v 1.28 2000/11/23 12:21:18 niklas Exp $ */ /* @@ -287,7 +287,7 @@ connection_setup (char *name) conn = calloc (1, sizeof *conn); if (!conn) { - log_error ("connection_setup: calloc (1, %d) failed", sizeof *conn); + log_error ("connection_setup: calloc (1, %ld) failed", sizeof *conn); goto fail; } @@ -349,8 +349,8 @@ connection_record_passive (char *name) conn = calloc (1, sizeof *conn); if (!conn) { - log_error ("connection_record_passive: calloc (1, %d) failed", - sizeof *conn); + log_error ("connection_record_passive: calloc (1, %lu) failed", + (unsigned long)sizeof *conn); return -1; } diff --git a/sbin/isakmpd/crypto.c b/sbin/isakmpd/crypto.c index 7c776d56169..c46eba7ac44 100644 --- a/sbin/isakmpd/crypto.c +++ b/sbin/isakmpd/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.11 2001/02/24 04:42:48 angelos Exp $ */ +/* $OpenBSD: crypto.c,v 1.12 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: crypto.c,v 1.32 2000/03/07 20:08:51 niklas Exp $ */ /* @@ -283,7 +283,8 @@ crypto_init (struct crypto_xf *xf, u_int8_t *key, u_int16_t len, ks = calloc (1, sizeof *ks); if (!ks) { - log_error ("crypto_init: calloc (1, %d) failed", sizeof *ks); + log_error ("crypto_init: calloc (1, %lu) failed", + (unsigned long)sizeof *ks); *err = ENOCRYPTO; return 0; } @@ -365,7 +366,8 @@ crypto_clone_keystate (struct keystate *oks) ks = malloc (sizeof *ks); if (!ks) { - log_error ("crypto_clone_keystate: malloc (%d) failed", sizeof *ks); + log_error ("crypto_clone_keystate: malloc (%lu) failed", + (unsigned long)sizeof *ks); return 0; } memcpy (ks, oks, sizeof *ks); diff --git a/sbin/isakmpd/exchange.c b/sbin/isakmpd/exchange.c index 826005aba9b..9ff70e07085 100644 --- a/sbin/isakmpd/exchange.c +++ b/sbin/isakmpd/exchange.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exchange.c,v 1.64 2002/01/23 18:24:34 ho Exp $ */ +/* $OpenBSD: exchange.c,v 1.65 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: exchange.c,v 1.143 2000/12/04 00:02:25 angelos Exp $ */ /* @@ -614,7 +614,8 @@ exchange_create (int phase, int initiator, int doi, int type) exchange = calloc (1, sizeof *exchange); if (!exchange) { - log_error ("exchange_create: calloc (1, %d) failed", sizeof *exchange); + log_error ("exchange_create: calloc (1, %lu) failed", + (unsigned long)sizeof *exchange); return 0; } exchange->phase = phase; @@ -636,8 +637,8 @@ exchange_create (int phase, int initiator, int doi, int type) exchange->data = calloc (1, exchange->doi->exchange_size); if (!exchange->data) { - log_error ("exchange_create: calloc (1, %d) failed", - exchange->doi->exchange_size); + log_error ("exchange_create: calloc (1, %lu) failed", + (unsigned long)exchange->doi->exchange_size); exchange_free (exchange); return 0; } @@ -701,8 +702,8 @@ exchange_add_finalization (struct exchange *exchange, node = malloc (sizeof *node); if (!node) { - log_error ("exchange_add_finalization: malloc (%d) failed", - sizeof *node); + log_error ("exchange_add_finalization: malloc (%lu) failed", + (unsigned long)sizeof *node); free (arg); return; } @@ -1492,7 +1493,7 @@ exchange_nonce (struct exchange *exchange, int peer, size_t nonce_sz, *nonce = malloc (nonce_sz); if (!*nonce) { - log_error ("exchange_nonce: malloc (%d) failed", nonce_sz); + log_error ("exchange_nonce: malloc (%lu) failed", (unsigned long)nonce_sz); return -1; } memcpy (*nonce, buf, nonce_sz); @@ -1511,8 +1512,8 @@ exchange_gen_nonce (struct message *msg, size_t nonce_sz) buf = malloc (ISAKMP_NONCE_SZ + nonce_sz); if (!buf) { - log_error ("exchange_gen_nonce: malloc (%d) failed", - ISAKMP_NONCE_SZ + nonce_sz); + log_error ("exchange_gen_nonce: malloc (%lu) failed", + ISAKMP_NONCE_SZ + (unsigned long)nonce_sz); return -1; } getrandom (buf + ISAKMP_NONCE_DATA_OFF, nonce_sz); diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c index c5f7b06b264..ec6f7380a96 100644 --- a/sbin/isakmpd/ike_auth.c +++ b/sbin/isakmpd/ike_auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_auth.c,v 1.62 2002/05/28 11:23:20 ho Exp $ */ +/* $OpenBSD: ike_auth.c,v 1.63 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */ /* @@ -176,7 +176,8 @@ ike_auth_get_key (int type, char *id, char *local_id, size_t *keylen) buf = malloc (*keylen); if (!buf) { - log_print ("ike_auth_get_key: malloc (%d) failed", *keylen); + log_print ("ike_auth_get_key: malloc (%lu) failed", + (unsigned long)*keylen); return 0; } if (hex2raw (key + 2, buf, *keylen)) @@ -239,8 +240,8 @@ ike_auth_get_key (int type, char *id, char *local_id, size_t *keylen) buf = calloc (size + 1, sizeof (char)); if (!buf) { - log_print ("ike_auth_get_key: failed allocating %d bytes", - size + 1); + log_print ("ike_auth_get_key: failed allocating %lu bytes", + (unsigned long)size + 1); free (keyfile); return 0; } @@ -249,7 +250,8 @@ ike_auth_get_key (int type, char *id, char *local_id, size_t *keylen) { free (buf); log_print ("ike_auth_get_key: " - "failed reading %d bytes from \"%s\"", size, keyfile); + "failed reading %lu bytes from \"%s\"", + (unsigned long)size, keyfile); free (keyfile); return 0; } @@ -369,8 +371,8 @@ pre_shared_gen_skeyid (struct exchange *exchange, size_t *sz) + ISAKMP_GEN_SZ + 1, sizeof (char)); if (!buf) { - log_print ("pre_shared_gen_skeyid: malloc (%d) failed", - exchange->id_i_len - ISAKMP_ID_DATA_OFF + log_print ("pre_shared_gen_skeyid: malloc (%lu) failed", + (unsigned long)exchange->id_i_len - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1); return 0; } @@ -401,7 +403,8 @@ pre_shared_gen_skeyid (struct exchange *exchange, size_t *sz) exchange->recv_keytype = ISAKMP_KEY_PASSPHRASE; if (!exchange->recv_key) { - log_error ("pre_shared_gen_skeyid: malloc (%d) failed", keylen); + log_error ("pre_shared_gen_skeyid: malloc (%lu) failed", + (unsigned long)keylen); return 0; } memcpy (exchange->recv_key, key, keylen); @@ -415,7 +418,8 @@ pre_shared_gen_skeyid (struct exchange *exchange, size_t *sz) skeyid = malloc (*sz); if (!skeyid) { - log_error ("pre_shared_gen_skeyid: malloc (%d) failed", *sz); + log_error ("pre_shared_gen_skeyid: malloc (%lu) failed", + (unsigned long)*sz); prf_free (prf); return 0; } @@ -460,13 +464,14 @@ sig_gen_skeyid (struct exchange *exchange, size_t *sz) skeyid = malloc (*sz); if (!skeyid) { - log_error ("sig_gen_skeyid: malloc (%d) failed", *sz); + log_error ("sig_gen_skeyid: malloc (%lu) failed", + (unsigned long)*sz); prf_free (prf); return 0; } - LOG_DBG((LOG_NEGOTIATION, 80, "sig_gen_skeyid: g^xy length %d", - ie->g_x_len)); + LOG_DBG((LOG_NEGOTIATION, 80, "sig_gen_skeyid: g^xy length %lu", + (unsigned long)ie->g_x_len)); LOG_DBG_BUF((LOG_NEGOTIATION, 80, "sig_gen_skeyid: SKEYID fed with g^xy", ie->g_xy, ie->g_x_len)); @@ -547,7 +552,8 @@ pre_shared_decode_hash (struct message *msg) *hash_p = malloc (hashsize); if (!*hash_p) { - log_error ("pre_shared_decode_hash: malloc (%d) failed", hashsize); + log_error ("pre_shared_decode_hash: malloc (%lu) failed", + (unsigned long)hashsize); return -1; } @@ -856,7 +862,8 @@ rsa_sig_decode_hash (struct message *msg) { free (*hash_p); *hash_p = 0; - log_print ("rsa_sig_decode_hash: len %d != hashsize %d", len, hashsize); + log_print ("rsa_sig_decode_hash: len %lu != hashsize %lu", + (unsigned long)len, (unsigned long)hashsize); return -1; } @@ -1035,8 +1042,8 @@ rsa_sig_encode_hash (struct message *msg) sizeof (char)); if (!buf2) { - log_print ("rsa_sig_encode_hash: malloc (%d) failed", - id_len - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1); + log_print ("rsa_sig_encode_hash: malloc (%lu) failed", + (unsigned long)id_len - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1); return 0; } memcpy (buf2, id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ, @@ -1092,7 +1099,8 @@ rsa_sig_encode_hash (struct message *msg) buf = malloc (hashsize); if (!buf) { - log_error ("rsa_sig_encode_hash: malloc (%d) failed", hashsize); + log_error ("rsa_sig_encode_hash: malloc (%lu) failed", + (unsigned long)hashsize); return -1; } diff --git a/sbin/isakmpd/ike_phase_1.c b/sbin/isakmpd/ike_phase_1.c index 6dce75ee43d..dc304d5dda6 100644 --- a/sbin/isakmpd/ike_phase_1.c +++ b/sbin/isakmpd/ike_phase_1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_phase_1.c,v 1.31 2001/10/26 12:03:07 ho Exp $ */ +/* $OpenBSD: ike_phase_1.c,v 1.32 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: ike_phase_1.c,v 1.31 2000/12/11 23:47:56 niklas Exp $ */ /* @@ -94,16 +94,16 @@ ike_phase_1_initiator_send_SA (struct message *msg) transform = calloc (conf->cnt, sizeof *transform); if (!transform) { - log_error ("ike_phase_1_initiator_send_SA: calloc (%d, %d) failed", - conf->cnt, sizeof *transform); + log_error ("ike_phase_1_initiator_send_SA: calloc (%d, %lu) failed", + conf->cnt, (unsigned long)sizeof *transform); goto bail_out; } transform_len = calloc (conf->cnt, sizeof *transform_len); if (!transform_len) { - log_error ("ike_phase_1_initiator_send_SA: calloc (%d, %d) failed", - conf->cnt, sizeof *transform_len); + log_error ("ike_phase_1_initiator_send_SA: calloc (%d, %lu) failed", + conf->cnt, (unsigned long)sizeof *transform_len); goto bail_out; } @@ -266,8 +266,8 @@ ike_phase_1_initiator_send_SA (struct message *msg) proposal = malloc (proposal_len); if (!proposal) { - log_error ("ike_phase_1_initiator_send_SA: malloc (%d) failed", - proposal_len); + log_error ("ike_phase_1_initiator_send_SA: malloc (%lu) failed", + (unsigned long)proposal_len); goto bail_out; } @@ -280,8 +280,8 @@ ike_phase_1_initiator_send_SA (struct message *msg) proto = calloc (1, sizeof *proto); if (!proto) { - log_error ("ike_phase_1_initiator_send_SA: calloc (1, %d) failed", - sizeof *proto); + log_error ("ike_phase_1_initiator_send_SA: calloc (1, %lu) failed", + (unsigned long)sizeof *proto); goto bail_out; } @@ -295,7 +295,8 @@ ike_phase_1_initiator_send_SA (struct message *msg) sa_buf = malloc (sa_len); if (!sa_buf) { - log_error ("ike_phase_1_initiator_send_SA: malloc (%d) failed", sa_len); + log_error ("ike_phase_1_initiator_send_SA: malloc (%lu) failed", + (unsigned long)sa_len); goto bail_out; } @@ -335,8 +336,8 @@ ike_phase_1_initiator_send_SA (struct message *msg) ie->sa_i_b = malloc (ie->sa_i_b_len); if (!ie->sa_i_b) { - log_error ("ike_phase_1_initiator_send_SA: malloc (%d) failed", - ie->sa_i_b_len); + log_error ("ike_phase_1_initiator_send_SA: malloc (%lu) failed", + (unsigned long)ie->sa_i_b_len); goto bail_out; } memcpy (ie->sa_i_b, @@ -497,8 +498,8 @@ ike_phase_1_responder_recv_SA (struct message *msg) if (!ie->sa_i_b) { /* XXX How to notify peer? */ - log_error ("ike_phase_1_responder_recv_SA: malloc (%d) failed", - ie->sa_i_b_len); + log_error ("ike_phase_1_responder_recv_SA: malloc (%lu) failed", + (unsigned long)ie->sa_i_b_len); return -1; } memcpy (ie->sa_i_b, sa_p->p + ISAKMP_GEN_SZ, ie->sa_i_b_len); @@ -589,8 +590,8 @@ ike_phase_1_post_exchange_KE_NONCE (struct message *msg) if (!ie->g_xy) { /* XXX How to notify peer? */ - log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%d) failed", - ie->g_x_len); + log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%lu) failed", + (unsigned long)ie->g_x_len); return -1; } if (dh_create_shared (ie->group, ie->g_xy, @@ -620,8 +621,8 @@ ike_phase_1_post_exchange_KE_NONCE (struct message *msg) if (!ie->skeyid_d) { /* XXX How to notify peer? */ - log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%d) failed", - ie->skeyid_len); + log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%lu) failed", + (unsigned long)ie->skeyid_len); return -1; } prf = prf_alloc (ie->prf_type, hash->type, ie->skeyid, ie->skeyid_len); @@ -643,8 +644,8 @@ ike_phase_1_post_exchange_KE_NONCE (struct message *msg) ie->skeyid_a = malloc (ie->skeyid_len); if (!ie->skeyid_a) { - log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%d) failed", - ie->skeyid_len); + log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%lu) failed", + (unsigned long)ie->skeyid_len); prf_free (prf); return -1; } @@ -663,8 +664,8 @@ ike_phase_1_post_exchange_KE_NONCE (struct message *msg) if (!ie->skeyid_e) { /* XXX How to notify peer? */ - log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%d) failed", - ie->skeyid_len); + log_error ("ike_phase_1_post_exchange_KE_NONCE: malloc (%lu) failed", + (unsigned long)ie->skeyid_len); prf_free (prf); return -1; } @@ -810,7 +811,7 @@ ike_phase_1_send_ID (struct message *msg) buf = malloc (sz); if (!buf) { - log_error ("ike_phase_1_send_ID: malloc (%d) failed", sz); + log_error ("ike_phase_1_send_ID: malloc (%lu) failed", (unsigned long)sz); return -1; } @@ -866,7 +867,7 @@ ike_phase_1_send_ID (struct message *msg) *id = malloc (*id_len); if (!*id) { - log_error ("ike_phase_1_send_ID: malloc (%d) failed", *id_len); + log_error ("ike_phase_1_send_ID: malloc (%lu) failed", (unsigned long)*id_len); return -1; } memcpy (*id, buf + ISAKMP_GEN_SZ, *id_len); @@ -941,7 +942,7 @@ ike_phase_1_recv_ID (struct message *msg) rid = malloc (sz); if (!rid) { - log_error ("ike_phase_1_recv_ID: malloc (%d) failed", sz); + log_error ("ike_phase_1_recv_ID: malloc (%lu) failed", (unsigned long)sz); return -1; } @@ -1021,7 +1022,7 @@ ike_phase_1_recv_ID (struct message *msg) *id = malloc (*id_len); if (!*id) { - log_error ("ike_phase_1_recv_ID: malloc (%d) failed", *id_len); + log_error ("ike_phase_1_recv_ID: malloc (%lu) failed", *id_len); return -1; } memcpy (*id, payload->p + ISAKMP_GEN_SZ, *id_len); @@ -1247,7 +1248,7 @@ attribute_unacceptable (u_int16_t type, u_int8_t *value, u_int16_t len, node = malloc (sizeof *node); if (!node) { - log_error ("attribute_unacceptable: malloc (%d) failed", + log_error ("attribute_unacceptable: malloc (%lu) failed", sizeof *node); return 1; } @@ -1352,7 +1353,7 @@ attribute_unacceptable (u_int16_t type, u_int8_t *value, u_int16_t len, node = malloc (sizeof *node); if (!node) { - log_error ("attribute_unacceptable: malloc (%d) failed", + log_error ("attribute_unacceptable: malloc (%lu) failed", sizeof *node); return 1; } diff --git a/sbin/isakmpd/ike_quick_mode.c b/sbin/isakmpd/ike_quick_mode.c index d223c1032a4..142fe7158c4 100644 --- a/sbin/isakmpd/ike_quick_mode.c +++ b/sbin/isakmpd/ike_quick_mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_quick_mode.c,v 1.59 2002/03/06 09:43:08 ho Exp $ */ +/* $OpenBSD: ike_quick_mode.c,v 1.60 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: ike_quick_mode.c,v 1.139 2001/01/26 10:43:17 niklas Exp $ */ /* @@ -147,8 +147,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) if (!keynote_ids) { log_error ("check_policy: " - "failed to allocate %d bytes for book keeping", - keynote_policy_asserts_num * sizeof *keynote_ids); + "failed to allocate %lu bytes for book keeping", + keynote_policy_asserts_num * (unsigned long)sizeof *keynote_ids); return 0; } } @@ -181,8 +181,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal = calloc (nprinc, sizeof *principal); if (!principal) { - log_error ("check_policy: calloc (%d, %d) failed", nprinc, - sizeof *principal); + log_error ("check_policy: calloc (%d, %lu) failed", nprinc, + (unsigned long)sizeof *principal); goto policydone; } @@ -190,8 +190,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal[0] = calloc (len, sizeof (char)); if (!principal[0]) { - log_error ("check_policy: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("check_policy: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto policydone; } @@ -204,8 +204,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal[1] = calloc (len, sizeof (char)); if (!principal[1]) { - log_error ("check_policy: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("check_policy: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto policydone; } @@ -219,8 +219,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal[2] = calloc (len, sizeof (char)); if (!principal[2]) { - log_error ("check_policy: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("check_policy: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto policydone; } @@ -238,8 +238,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal = calloc (nprinc, sizeof *principal); if (!principal) { - log_error ("check_policy: calloc (%d, %d) failed", nprinc, - sizeof *principal); + log_error ("check_policy: calloc (%d, %lu) failed", nprinc, + (unsigned long)sizeof *principal); goto policydone; } @@ -247,8 +247,9 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal[0] = strdup (isakmp_sa->keynote_key); if (!principal[0]) { - log_error ("check_policy: calloc (%d, %d) failed", - strlen (isakmp_sa->keynote_key), sizeof (char)); + log_error ("check_policy: calloc (%lu, %lu) failed", + (unsigned long)strlen (isakmp_sa->keynote_key), + (unsigned long)sizeof (char)); goto policydone; } #endif @@ -259,7 +260,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal = calloc (2, sizeof *principal); if (!principal) { - log_error ("check_policy: calloc (2, %d) failed", sizeof *principal); + log_error ("check_policy: calloc (2, %lu) failed", + (unsigned long)sizeof *principal); goto policydone; } @@ -291,8 +293,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal[1] = calloc (len, sizeof (char)); if (!principal[1]) { - log_error ("check_policy: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("check_policy: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto policydone; } @@ -308,8 +310,8 @@ check_policy (struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) principal[1] = calloc (259, sizeof (char)); if (!principal[1]) { - log_error ("check_policy: calloc (259, %d) failed", - sizeof (char)); + log_error ("check_policy: calloc (259, %lu) failed", + (unsigned long)sizeof (char)); goto policydone; } strlcpy (principal[1], "DN:", 259); @@ -483,8 +485,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!new_proposal) { log_error ("initiator_send_HASH_SA_NONCE: " - "realloc (%p, %d) failed", - proposal, prop_cnt * sizeof *proposal); + "realloc (%p, %lu) failed", + proposal, prop_cnt * (unsigned long)sizeof *proposal); goto bail_out; } proposal = new_proposal; @@ -494,9 +496,9 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!new_transforms_len) { log_error ("initiator_send_HASH_SA_NONCE: " - "realloc (%p, %d) failed", + "realloc (%p, %lu) failed", transforms_len, - prop_cnt * sizeof *transforms_len); + prop_cnt * (unsigned long)sizeof *transforms_len); goto bail_out; } transforms_len = new_transforms_len; @@ -506,8 +508,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!new_transform) { log_error ("initiator_send_HASH_SA_NONCE: " - "realloc (%p, %d) failed", - transform, prop_cnt * sizeof *transform); + "realloc (%p, %lu) failed", + transform, prop_cnt * (unsigned long)sizeof *transform); goto bail_out; } transform = new_transform; @@ -517,8 +519,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!new_transform_cnt) { log_error ("initiator_send_HASH_SA_NONCE: " - "realloc (%p, %d) failed", - transform_cnt, prop_cnt * sizeof *transform_cnt); + "realloc (%p, %lu) failed", + transform_cnt, prop_cnt * (unsigned long)sizeof *transform_cnt); goto bail_out; } transform_cnt = new_transform_cnt; @@ -528,8 +530,9 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!new_transform_len) { log_error ("initiator_send_HASH_SA_NONCE: " - "realloc (%p, %d) failed", - transform_len, prop_cnt * sizeof *transform_len); + "realloc (%p, %lu) failed", + transform_len, + prop_cnt * (unsigned long)sizeof *transform_len); goto bail_out; } transform_len = new_transform_len; @@ -557,8 +560,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!transform[prop_no]) { log_error ("initiator_send_HASH_SA_NONCE: " - "calloc (%d, %d) failed", - transform_cnt[prop_no], sizeof **transform); + "calloc (%d, %lu) failed", + transform_cnt[prop_no], (unsigned long)sizeof **transform); goto bail_out; } @@ -567,8 +570,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!transform_len[prop_no]) { log_error ("initiator_send_HASH_SA_NONCE: " - "calloc (%d, %d) failed", - transform_cnt[prop_no], sizeof **transform_len); + "calloc (%d, %lu) failed", + transform_cnt[prop_no], (unsigned long)sizeof **transform_len); goto bail_out; } @@ -718,8 +721,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) proposal[prop_no] = malloc (proposal_len); if (!proposal[prop_no]) { - log_error ("initiator_send_HASH_SA_NONCE: malloc (%d) failed", - proposal_len); + log_error ("initiator_send_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)proposal_len); goto bail_out; } @@ -730,8 +733,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) proto = calloc (1, sizeof *proto); if (!proto) { - log_error ("initiator_send_HASH_SA_NONCE: calloc (1, %d) failed", - sizeof *proto); + log_error ("initiator_send_HASH_SA_NONCE: calloc (1, %lu) failed", + (unsigned long)sizeof *proto); goto bail_out; } @@ -741,7 +744,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) if (!proto->data) { log_error ("initiator_send_HASH_SA_NONCE: " - "calloc (1, %d) failed", doi->proto_size); + "calloc (1, %lu) failed", + (unsigned long)doi->proto_size); goto bail_out; } } @@ -774,7 +778,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) sa_buf = malloc (sa_len); if (!sa_buf) { - log_error ("initiator_send_HASH_SA_NONCE: malloc (%d) failed", sa_len); + log_error ("initiator_send_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)sa_len); goto bail_out; } SET_ISAKMP_SA_DOI (sa_buf, IPSEC_DOI_IPSEC); @@ -895,7 +900,8 @@ initiator_send_HASH_SA_NONCE (struct message *msg) id = calloc (sz, sizeof (char)); if (!id) { - log_error ("initiator_send_HASH_SA_NONCE: malloc(%d) failed", sz); + log_error ("initiator_send_HASH_SA_NONCE: malloc(%lu) failed", + (unsigned long)sz); return -1; } @@ -1078,8 +1084,8 @@ initiator_recv_HASH_SA_NONCE (struct message *msg) ie->id_ci = malloc (ie->id_ci_sz); if (!ie->id_ci) { - log_error ("initiator_recv_HASH_SA_NONCE: malloc (%d) failed", - ie->id_ci_sz); + log_error ("initiator_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)ie->id_ci_sz); return -1; } memcpy (ie->id_ci, idp->p, ie->id_ci_sz); @@ -1094,8 +1100,8 @@ initiator_recv_HASH_SA_NONCE (struct message *msg) ie->id_cr = malloc (ie->id_cr_sz); if (!ie->id_cr) { - log_error ("initiator_recv_HASH_SA_NONCE: malloc (%d) failed", - ie->id_cr_sz); + log_error ("initiator_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)ie->id_cr_sz); return -1; } memcpy (ie->id_cr, idp->p, ie->id_cr_sz); @@ -1131,8 +1137,8 @@ initiator_recv_HASH_SA_NONCE (struct message *msg) if (!ie->id_ci || !ie->id_cr) { - log_error ("initiator_recv_HASH_SA_NONCE: malloc (%d) failed", - ie->id_cr_sz); + log_error ("initiator_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)ie->id_cr_sz); if (ie->id_ci) free (ie->id_ci); if (ie->id_cr) @@ -1246,8 +1252,8 @@ initiator_send_HASH (struct message *msg) buf = malloc (ISAKMP_HASH_SZ + hashsize); if (!buf) { - log_error ("initiator_send_HASH: malloc (%d) failed", - ISAKMP_HASH_SZ + hashsize); + log_error ("initiator_send_HASH: malloc (%lu) failed", + ISAKMP_HASH_SZ + (unsigned long)hashsize); return -1; } if (message_add_payload (msg, ISAKMP_PAYLOAD_HASH, buf, @@ -1337,8 +1343,8 @@ post_quick_mode (struct message *msg) / prf->blocksize) * prf->blocksize); if (!iproto->keymat[i]) { - log_error ("post_quick_mode: malloc (%d) failed", - ((ie->keymat_len + prf->blocksize - 1) + log_error ("post_quick_mode: malloc (%lu) failed", + (((unsigned long)ie->keymat_len + prf->blocksize - 1) / prf->blocksize) * prf->blocksize); /* XXX What more to do? */ free (prf); @@ -1434,8 +1440,8 @@ responder_recv_HASH_SA_NONCE (struct message *msg) my_hash = malloc (hash_len - ISAKMP_GEN_SZ); if (!my_hash) { - log_error ("responder_recv_HASH_SA_NONCE: malloc (%d) failed", - hash_len - ISAKMP_GEN_SZ); + log_error ("responder_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)hash_len - ISAKMP_GEN_SZ); goto cleanup; } @@ -1492,8 +1498,8 @@ responder_recv_HASH_SA_NONCE (struct message *msg) ie->id_ci = malloc (ie->id_ci_sz); if (!ie->id_ci) { - log_error ("responder_recv_HASH_SA_NONCE: malloc (%d) failed", - ie->id_ci_sz); + log_error ("responder_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)ie->id_ci_sz); goto cleanup; } memcpy (ie->id_ci, idp->p, ie->id_ci_sz); @@ -1508,8 +1514,8 @@ responder_recv_HASH_SA_NONCE (struct message *msg) ie->id_cr = malloc (ie->id_cr_sz); if (!ie->id_cr) { - log_error ("responder_recv_HASH_SA_NONCE: malloc (%d) failed", - ie->id_cr_sz); + log_error ("responder_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)ie->id_cr_sz); goto cleanup; } memcpy (ie->id_cr, idp->p, ie->id_cr_sz); @@ -1545,8 +1551,8 @@ responder_recv_HASH_SA_NONCE (struct message *msg) if (!ie->id_ci || !ie->id_cr) { - log_error ("responder_recv_HASH_SA_NONCE: malloc (%d) failed", - ie->id_ci_sz); + log_error ("responder_recv_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)ie->id_ci_sz); goto cleanup; } @@ -1740,8 +1746,8 @@ responder_send_HASH_SA_NONCE (struct message *msg) buf = malloc (ISAKMP_HASH_SZ + hashsize); if (!buf) { - log_error ("responder_send_HASH_SA_NONCE: malloc (%d) failed", - ISAKMP_HASH_SZ + hashsize); + log_error ("responder_send_HASH_SA_NONCE: malloc (%lu) failed", + ISAKMP_HASH_SZ + (unsigned long)hashsize); return -1; } if (message_add_payload (msg, ISAKMP_PAYLOAD_HASH, buf, @@ -1770,7 +1776,8 @@ responder_send_HASH_SA_NONCE (struct message *msg) id = malloc (sz); if (!id) { - log_error ("responder_send_HASH_SA_NONCE: malloc (%d) failed", sz); + log_error ("responder_send_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)sz); return -1; } memcpy (id, ie->id_ci, sz); @@ -1786,7 +1793,8 @@ responder_send_HASH_SA_NONCE (struct message *msg) id = malloc (sz); if (!id) { - log_error ("responder_send_HASH_SA_NONCE: malloc (%d) failed", sz); + log_error ("responder_send_HASH_SA_NONCE: malloc (%lu) failed", + (unsigned long)sz); return -1; } memcpy (id, ie->id_cr, sz); @@ -1850,7 +1858,7 @@ gen_g_xy (struct message *msg) ie->g_xy = malloc (ie->g_x_len); if (!ie->g_xy) { - log_error ("gen_g_xy: malloc (%d) failed", ie->g_x_len); + log_error ("gen_g_xy: malloc (%lu) failed", (unsigned long)ie->g_x_len); return; } if (dh_create_shared (ie->group, ie->g_xy, @@ -1881,8 +1889,8 @@ responder_recv_HASH (struct message *msg) my_hash = malloc (hash_len - ISAKMP_GEN_SZ); if (!my_hash) { - log_error ("responder_recv_HASH: malloc (%d) failed", - hash_len - ISAKMP_GEN_SZ); + log_error ("responder_recv_HASH: malloc (%lu) failed", + (unsigned long)hash_len - ISAKMP_GEN_SZ); goto cleanup; } diff --git a/sbin/isakmpd/ipsec.c b/sbin/isakmpd/ipsec.c index c647a079bba..13cc462b22f 100644 --- a/sbin/isakmpd/ipsec.c +++ b/sbin/isakmpd/ipsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec.c,v 1.64 2002/02/21 20:09:18 angelos Exp $ */ +/* $OpenBSD: ipsec.c,v 1.65 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */ /* @@ -676,7 +676,8 @@ ipsec_get_keystate (struct message *msg) ks = malloc (sizeof *ks); if (!ks) { - log_error ("ipsec_get_keystate: malloc (%d) failed", sizeof *ks); + log_error ("ipsec_get_keystate: malloc (%lu) failed", + (unsigned long)sizeof *ks); return 0; } memcpy (ks, msg->exchange->keystate, sizeof *ks); @@ -1482,7 +1483,7 @@ ipsec_g_x (struct message *msg, int peer, u_int8_t *buf) *g_x = malloc (ie->g_x_len); if (!*g_x) { - log_error ("ipsec_g_x: malloc (%d) failed", ie->g_x_len); + log_error ("ipsec_g_x: malloc (%lu) failed", (unsigned long)ie->g_x_len); return -1; } memcpy (*g_x, buf, ie->g_x_len); @@ -1502,8 +1503,8 @@ ipsec_gen_g_x (struct message *msg) buf = malloc (ISAKMP_KE_SZ + ie->g_x_len); if (!buf) { - log_error ("ipsec_gen_g_x: malloc (%d) failed", - ISAKMP_KE_SZ + ie->g_x_len); + log_error ("ipsec_gen_g_x: malloc (%lu) failed", + ISAKMP_KE_SZ + (unsigned long)ie->g_x_len); return -1; } @@ -1996,7 +1997,7 @@ ipsec_build_id (char *section, size_t *sz) p = malloc (*sz); if (!p) { - log_print ("ipsec_build_id: malloc(%d) failed", *sz); + log_print ("ipsec_build_id: malloc(%lu) failed", (unsigned long)*sz); return 0; } @@ -2035,7 +2036,7 @@ ipsec_clone_id (u_int8_t **did, size_t *did_len, u_int8_t *id, size_t id_len) if (!*did) { *did_len = 0; - log_error ("ipsec_clone_id: malloc(%d) failed", id_len); + log_error ("ipsec_clone_id: malloc(%lu) failed", (unsigned long)id_len); return -1; } @@ -2128,8 +2129,8 @@ ipsec_add_contact (struct message *msg) new_contacts = realloc (contacts, cnt * sizeof contacts[0]); if (!new_contacts) { - log_error ("ipsec_add_contact: realloc (%p, %d) failed", contacts, - cnt * sizeof contacts[0]); + log_error ("ipsec_add_contact: realloc (%p, %lu) failed", contacts, + cnt * (unsigned long)sizeof contacts[0]); return -1; } contact_limit = cnt; @@ -2177,8 +2178,8 @@ ipsec_add_hash_payload (struct message *msg, size_t hashsize) buf = malloc (ISAKMP_HASH_SZ + hashsize); if (!buf) { - log_error ("ipsec_add_hash_payload: malloc (%d) failed", - ISAKMP_HASH_SZ + hashsize); + log_error ("ipsec_add_hash_payload: malloc (%lu) failed", + ISAKMP_HASH_SZ + (unsigned long)hashsize); return 0; } diff --git a/sbin/isakmpd/isakmp_cfg.c b/sbin/isakmpd/isakmp_cfg.c index b71f493f608..177ec3f8e32 100644 --- a/sbin/isakmpd/isakmp_cfg.c +++ b/sbin/isakmpd/isakmp_cfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isakmp_cfg.c,v 1.7 2001/10/26 12:03:07 ho Exp $ */ +/* $OpenBSD: isakmp_cfg.c,v 1.8 2002/06/01 07:44:21 deraadt Exp $ */ /* * Copyright (c) 2001 Niklas Hallqvist. All rights reserved. @@ -101,8 +101,8 @@ initiator_send_ATTR (struct message *msg) hashp = malloc (ISAKMP_HASH_SZ + hashsize); if (!hashp) { - log_error ("responder_send_ATTR: malloc (%d) failed", - ISAKMP_HASH_SZ + hashsize); + log_error ("responder_send_ATTR: malloc (%lu) failed", + ISAKMP_HASH_SZ + (unsigned long)hashsize); return -1; } if (message_add_payload (msg, ISAKMP_PAYLOAD_HASH, hashp, @@ -191,8 +191,8 @@ responder_recv_ATTR (struct message *msg) comp_hash = malloc (hash_len - ISAKMP_GEN_SZ); if (!comp_hash) { - log_error ("responder_recv_ATTR: malloc (%d) failed", - hash_len - ISAKMP_GEN_SZ); + log_error ("responder_recv_ATTR: malloc (%lu) failed", + (unsigned long)hash_len - ISAKMP_GEN_SZ); return -1; } @@ -285,8 +285,8 @@ responder_send_ATTR (struct message *msg) hashp = malloc (ISAKMP_HASH_SZ + hashsize); if (!hashp) { - log_error ("responder_send_ATTR: malloc (%d) failed", - ISAKMP_HASH_SZ + hashsize); + log_error ("responder_send_ATTR: malloc (%lu) failed", + ISAKMP_HASH_SZ + (unsigned long)hashsize); goto fail; } if (message_add_payload (msg, ISAKMP_PAYLOAD_HASH, hashp, @@ -347,7 +347,8 @@ responder_send_ATTR (struct message *msg) attrp = calloc (1, attrlen); if (!attrp) { - log_error ("responder_send_ATTR: calloc (1, %d) failed", attrlen); + log_error ("responder_send_ATTR: calloc (1, %lu) failed", + (unsigned long)attrlen); goto fail; } @@ -517,7 +518,8 @@ decode_attribute (u_int16_t type, u_int8_t *value, u_int16_t len, void *vie) attr = calloc (1, sizeof *attr); if (!attr) { - log_error ("decode_attribute: calloc (1, %d) failed", sizeof *attr); + log_error ("decode_attribute: calloc (1, %lu) failed", + (unsigned long)sizeof *attr); return -1; } attr->type = type; diff --git a/sbin/isakmpd/isakmpd.c b/sbin/isakmpd/isakmpd.c index 13c26121018..8f78fab5c97 100644 --- a/sbin/isakmpd/isakmpd.c +++ b/sbin/isakmpd/isakmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isakmpd.c,v 1.40 2002/05/26 09:24:35 deraadt Exp $ */ +/* $OpenBSD: isakmpd.c,v 1.41 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: isakmpd.c,v 1.54 2000/10/05 09:28:22 niklas Exp $ */ /* @@ -383,10 +383,10 @@ main (int argc, char *argv[]) mask_size = howmany (n, NFDBITS) * sizeof (fd_mask); rfds = (fd_set *)malloc (mask_size); if (!rfds) - log_fatal ("main: malloc (%d) failed", mask_size); + log_fatal ("main: malloc (%lu) failed", (unsigned long)mask_size); wfds = (fd_set *)malloc (mask_size); if (!wfds) - log_fatal ("main: malloc (%d) failed", mask_size); + log_fatal ("main: malloc (%lu) failed", (unsigned long)mask_size); while (1) { diff --git a/sbin/isakmpd/key.c b/sbin/isakmpd/key.c index b542b13a7fb..3e00f2142d1 100644 --- a/sbin/isakmpd/key.c +++ b/sbin/isakmpd/key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key.c,v 1.9 2002/03/06 13:55:12 ho Exp $ */ +/* $OpenBSD: key.c,v 1.10 2002/06/01 07:44:21 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -69,7 +69,8 @@ key_serialize (int type, int private, void *key, u_int8_t **data, size_t *datale *data = p = malloc (*datalen); if (!p) { - log_error("key_serialize: malloc (%d) failed", *datalen); + log_error("key_serialize: malloc (%lu) failed", + (unsigned long)*datalen); return; } *datalen = LC (i2d_RSAPublicKey, ((RSA *)key, &p)); @@ -80,7 +81,8 @@ key_serialize (int type, int private, void *key, u_int8_t **data, size_t *datale *data = p = malloc (*datalen); if (!p) { - log_error("key_serialize: malloc (%d) failed", *datalen); + log_error("key_serialize: malloc (%lu) failed", + (unsigned long)*datalen); return; } *datalen = LC (i2d_RSAPrivateKey, ((RSA *)key, &p)); diff --git a/sbin/isakmpd/math_group.c b/sbin/isakmpd/math_group.c index 9c71b3534a3..03e0c2440d8 100644 --- a/sbin/isakmpd/math_group.c +++ b/sbin/isakmpd/math_group.c @@ -1,4 +1,4 @@ -/* $OpenBSD: math_group.c,v 1.13 2001/04/09 22:09:52 ho Exp $ */ +/* $OpenBSD: math_group.c,v 1.14 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: math_group.c,v 1.25 2000/04/07 19:53:26 niklas Exp $ */ /* @@ -237,7 +237,7 @@ group_get (int id) new = malloc (sizeof *new); if (!new) { - log_error ("group_get: malloc (%d) failed", sizeof *new); + log_error ("group_get: malloc (%lu) failed", (unsigned long)sizeof *new); return 0; } @@ -289,7 +289,7 @@ modp_clone (struct group *new, struct group *clone) new_grp = malloc (sizeof *new_grp); if (!new_grp) { - log_print ("modp_clone: malloc (%d) failed", sizeof *new_grp); + log_print ("modp_clone: malloc (%lu) failed", (unsigned long)sizeof *new_grp); free (new); return 0; } @@ -351,7 +351,7 @@ modp_init (struct group *group) grp = malloc (sizeof *grp); if (!grp) - log_fatal ("modp_init: malloc (%d) failed", sizeof *grp); + log_fatal ("modp_init: malloc (%lu) failed", (unsigned long)sizeof *grp); group->bits = dscr->bits; @@ -390,7 +390,7 @@ ec2n_clone (struct group *new, struct group *clone) new_grp = malloc (sizeof *new_grp); if (!new_grp) { - log_error ("ec2n_clone: malloc (%d) failed", sizeof *new_grp); + log_error ("ec2n_clone: malloc (%lu) failed", (unsigned long)sizeof *new_grp); free (new); return 0; } @@ -450,7 +450,7 @@ ec2n_init (struct group *group) grp = malloc (sizeof *grp); if (!grp) - log_fatal ("ec2n_init: malloc (%d) failed", sizeof *grp); + log_fatal ("ec2n_init: malloc (%lu) failed", (unsigned long)sizeof *grp); group->bits = dscr->bits; diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c index 8c8883b5137..d9432522209 100644 --- a/sbin/isakmpd/message.c +++ b/sbin/isakmpd/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.50 2002/05/28 10:09:46 ho Exp $ */ +/* $OpenBSD: message.c,v 1.51 2002/06/01 07:44:21 deraadt Exp $ */ /* $EOM: message.c,v 1.156 2000/10/10 12:36:39 provos Exp $ */ /* @@ -248,7 +248,7 @@ message_parse_payloads (struct message *msg, struct payload *p, u_int8_t next, do { LOG_DBG ((LOG_MESSAGE, 50, - "message_parse_payloads: offset 0x%x payload %s", + "message_parse_payloads: offset %p payload %s", buf - (u_int8_t *)msg->iov[0].iov_base, constant_name (isakmp_payload_cst, next))); @@ -1289,16 +1289,16 @@ message_add_payload (struct message *msg, u_int8_t payload, u_int8_t *buf, payload_node = malloc (sizeof *payload_node); if (!payload_node) { - log_error ("message_add_payload: malloc (%d) failed", - sizeof *payload_node); + log_error ("message_add_payload: malloc (%lu) failed", + (unsigned long)sizeof *payload_node); return -1; } new_iov = (struct iovec *)realloc (msg->iov, (msg->iovlen + 1) * sizeof *msg->iov); if (!new_iov) { - log_error ("message_add_payload: realloc (%p, %d) failed", msg->iov, - (msg->iovlen + 1) * sizeof *msg->iov); + log_error ("message_add_payload: realloc (%p, %lu) failed", msg->iov, + (msg->iovlen + 1) * (unsigned long)sizeof *msg->iov); free (payload_node); return -1; } @@ -1428,7 +1428,7 @@ message_send_info (struct message *msg) buf = calloc (1, sz); if (!buf) { - log_error ("message_send_info: calloc (1, %d) failed", sz); + log_error ("message_send_info: calloc (1, %lu) failed", (unsigned long)sz); message_free (msg); return -1; } @@ -1609,8 +1609,8 @@ message_encrypt (struct message *msg) buf = realloc (msg->iov[1].iov_base, sz); if (!buf) { - log_error ("message_encrypt: realloc (%p, %d) failed", - msg->iov[1].iov_base, sz); + log_error ("message_encrypt: realloc (%p, %lu) failed", + msg->iov[1].iov_base, (unsigned long)sz); return -1; } msg->iov[1].iov_base = buf; @@ -1922,7 +1922,8 @@ message_add_sa_payload (struct message *msg) sa_buf = malloc (sa_len); if (!sa_buf) { - log_error ("message_add_sa_payload: malloc (%d) failed", sa_len); + log_error ("message_add_sa_payload: malloc (%lu) failed", + (unsigned long)sa_len); goto cleanup; } @@ -1939,32 +1940,32 @@ message_add_sa_payload (struct message *msg) transforms = calloc (nprotos, sizeof *transforms); if (!transforms) { - log_error ("message_add_sa_payload: calloc (%d, %d) failed", nprotos, - sizeof *transforms); + log_error ("message_add_sa_payload: calloc (%d, %lu) failed", nprotos, + (unsigned long)sizeof *transforms); goto cleanup; } transform_lens = calloc (nprotos, sizeof *transform_lens); if (!transform_lens) { - log_error ("message_add_sa_payload: calloc (%d, %d) failed", nprotos, - sizeof *transform_lens); + log_error ("message_add_sa_payload: calloc (%d, %lu) failed", nprotos, + (unsigned long)sizeof *transform_lens); goto cleanup; } proposals = calloc (nprotos, sizeof *proposals); if (!proposals) { - log_error ("message_add_sa_payload: calloc (%d, %d) failed", nprotos, - sizeof *proposals); + log_error ("message_add_sa_payload: calloc (%d, %lu) failed", nprotos, + (unsigned long)sizeof *proposals); goto cleanup; } proposal_lens = calloc (nprotos, sizeof *proposal_lens); if (!proposal_lens) { - log_error ("message_add_sa_payload: calloc (%d, %d) failed", nprotos, - sizeof *proposal_lens); + log_error ("message_add_sa_payload: calloc (%d, %lu) failed", nprotos, + (unsigned long)sizeof *proposal_lens); goto cleanup; } @@ -1976,8 +1977,8 @@ message_add_sa_payload (struct message *msg) transforms[i] = malloc (transform_lens[i]); if (!transforms[i]) { - log_error ("message_add_sa_payload: malloc (%d) failed", - transform_lens[i]); + log_error ("message_add_sa_payload: malloc (%lu) failed", + (unsigned long)transform_lens[i]); goto cleanup; } @@ -2000,8 +2001,8 @@ message_add_sa_payload (struct message *msg) proposals[i] = malloc (proposal_lens[i]); if (!proposals[i]) { - log_error ("message_add_sa_payload: malloc (%d) failed", - proposal_lens[i]); + log_error ("message_add_sa_payload: malloc (%lu) failed", + (unsigned long)proposal_lens[i]); goto cleanup; } diff --git a/sbin/isakmpd/pf_key_v2.c b/sbin/isakmpd/pf_key_v2.c index a9e4149a0ba..d5df1a8c790 100644 --- a/sbin/isakmpd/pf_key_v2.c +++ b/sbin/isakmpd/pf_key_v2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_key_v2.c,v 1.101 2002/05/31 02:16:55 angelos Exp $ */ +/* $OpenBSD: pf_key_v2.c,v 1.102 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: pf_key_v2.c,v 1.79 2000/12/12 00:33:19 niklas Exp $ */ /* @@ -301,9 +301,9 @@ pf_key_v2_read (u_int32_t seq) sizeof (fd_mask)); if (!fds) { - log_error ("pf_key_v2_read: calloc (%d, %d) failed", - howmany (pf_key_v2_socket + 1, NFDBITS), - sizeof (fd_mask)); + log_error ("pf_key_v2_read: calloc (%lu, %lu) failed", + (unsigned long)howmany (pf_key_v2_socket + 1, NFDBITS), + (unsigned long)sizeof (fd_mask)); goto cleanup; } FD_SET (pf_key_v2_socket, fds); @@ -333,7 +333,7 @@ pf_key_v2_read (u_int32_t seq) if (n != sizeof hdr) { log_error ("pf_key_v2_read: recv (%d, ...) returned short packet " - "(%d bytes)", + "(%lu bytes)", pf_key_v2_socket, n); goto cleanup; } @@ -342,7 +342,7 @@ pf_key_v2_read (u_int32_t seq) buf = malloc (n); if (!buf) { - log_error ("pf_key_v2_read: malloc (%d) failed", n); + log_error ("pf_key_v2_read: malloc (%lu) failed", (unsigned long)n); goto cleanup; } @@ -357,8 +357,8 @@ pf_key_v2_read (u_int32_t seq) if ((size_t)n != hdr.sadb_msg_len * PF_KEY_V2_CHUNK) { log_print ("pf_key_v2_read: read (%d, ...) returned short packet " - "(%d bytes)", - pf_key_v2_socket, n); + "(%lu bytes)", + pf_key_v2_socket, (unsigned long)n); goto cleanup; } @@ -434,7 +434,8 @@ pf_key_v2_write (struct pf_key_v2_msg *pmsg) iov = (struct iovec *)malloc (cnt * sizeof *iov); if (!iov) { - log_error ("pf_key_v2_write: malloc (%d) failed", cnt * sizeof *iov); + log_error ("pf_key_v2_write: malloc (%lu) failed", + cnt * (unsigned long)sizeof *iov); return 0; } @@ -478,8 +479,8 @@ pf_key_v2_write (struct pf_key_v2_msg *pmsg) } if ((size_t)n != len) { - log_error ("pf_key_v2_write: writev (%d, ...) returned prematurely (%d)", - pf_key_v2_socket, n); + log_error ("pf_key_v2_write: writev (%d, ...) returned prematurely (%lu)", + pf_key_v2_socket, (unsigned long)n); goto cleanup; } free (iov); @@ -3793,8 +3794,8 @@ pf_key_v2_acquire (struct pf_key_v2_msg *pmsg) authm = malloc (sauth->sadb_x_cred_len - sizeof *sauth + 1); if (!authm) { - log_error ("pf_key_v2_set_spi: malloc (%d) failed", - sauth->sadb_x_cred_len - sizeof *sauth + 1); + log_error ("pf_key_v2_set_spi: malloc (%lu) failed", + sauth->sadb_x_cred_len - (unsigned long)sizeof *sauth + 1); conf_end (af, 0); goto fail; } @@ -3835,8 +3836,8 @@ pf_key_v2_acquire (struct pf_key_v2_msg *pmsg) if (!authm) { log_print ("pf_key_v2_set_spi: failed to convert " - "private key to printable format (size %d)", - sauth->sadb_x_cred_len - sizeof *sauth); + "private key to printable format (size %lu)", + sauth->sadb_x_cred_len - (unsigned long)sizeof *sauth); conf_end (af, 0); goto fail; } diff --git a/sbin/isakmpd/policy.c b/sbin/isakmpd/policy.c index dc44c146707..9126f77bc0e 100644 --- a/sbin/isakmpd/policy.c +++ b/sbin/isakmpd/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.51 2002/05/28 11:23:20 ho Exp $ */ +/* $OpenBSD: policy.c,v 1.52 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: policy.c,v 1.49 2000/10/24 13:33:39 niklas Exp $ */ /* @@ -717,8 +717,8 @@ policy_callback (char *name) remote_id = calloc (len, sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -743,8 +743,8 @@ policy_callback (char *name) remote_id = calloc (len, sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -784,8 +784,8 @@ policy_callback (char *name) remote_id = calloc (len, sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -821,8 +821,8 @@ policy_callback (char *name) remote_id = calloc (len, sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -838,9 +838,9 @@ policy_callback (char *name) sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", - id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1, - sizeof (char)); + log_error ("policy_callback: calloc (%lu, %lu) failed", + (unsigned long)id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1, + (unsigned long)sizeof (char)); goto bad; } memcpy (remote_id, id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ, @@ -853,9 +853,9 @@ policy_callback (char *name) sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", - id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1, - sizeof (char)); + log_error ("policy_callback: calloc (%lu, %lu) failed", + (unsigned long)id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ + 1, + (unsigned long)sizeof (char)); goto bad; } memcpy (remote_id, id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ, @@ -887,9 +887,9 @@ policy_callback (char *name) sizeof (char)); if (!remote_id) { - log_error ("policy_callback: calloc (%d, %d) failed", - 2 * (id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ) + 1, - sizeof (char)); + log_error ("policy_callback: calloc (%lu, %lu) failed", + 2 * ((unsigned long)id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ) + 1, + (unsigned long)sizeof (char)); goto bad; } /* Does it contain any non-printable characters ? */ @@ -995,8 +995,8 @@ policy_callback (char *name) remote_filter = calloc (len, sizeof (char)); if (!remote_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -1021,8 +1021,8 @@ policy_callback (char *name) remote_filter = calloc (len, sizeof (char)); if (!remote_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } strlcpy (remote_filter, remote_filter_addr_lower, len); @@ -1062,8 +1062,8 @@ policy_callback (char *name) remote_filter = calloc (len, sizeof (char)); if (!remote_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -1098,8 +1098,8 @@ policy_callback (char *name) remote_filter = calloc (len, sizeof (char)); if (!remote_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -1114,8 +1114,8 @@ policy_callback (char *name) remote_filter = malloc (idremotesz - ISAKMP_ID_DATA_OFF + 1); if (!remote_filter) { - log_error ("policy_callback: malloc (%d) failed", - idremotesz - ISAKMP_ID_DATA_OFF + 1); + log_error ("policy_callback: malloc (%lu) failed", + (unsigned long)idremotesz - ISAKMP_ID_DATA_OFF + 1); goto bad; } memcpy (remote_filter, idremote + ISAKMP_ID_DATA_OFF, @@ -1128,8 +1128,8 @@ policy_callback (char *name) remote_filter = malloc (idremotesz - ISAKMP_ID_DATA_OFF + 1); if (!remote_filter) { - log_error ("policy_callback: malloc (%d) failed", - idremotesz - ISAKMP_ID_DATA_OFF + 1); + log_error ("policy_callback: malloc (%lu) failed", + (unsigned long)idremotesz - ISAKMP_ID_DATA_OFF + 1); goto bad; } memcpy (remote_filter, idremote + ISAKMP_ID_DATA_OFF, @@ -1161,9 +1161,9 @@ policy_callback (char *name) sizeof (char)); if (!remote_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", - 2 * (idremotesz - ISAKMP_ID_DATA_OFF) + 1, - sizeof (char)); + log_error ("policy_callback: calloc (%lu, %lu) failed", + 2 * ((unsigned long)idremotesz - ISAKMP_ID_DATA_OFF) + 1, + (unsigned long)sizeof (char)); goto bad; } /* Does it contain any non-printable characters ? */ @@ -1288,8 +1288,8 @@ policy_callback (char *name) local_filter = calloc (len, sizeof (char)); if (!local_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } strlcpy (local_filter, local_filter_addr_lower, len); @@ -1313,8 +1313,8 @@ policy_callback (char *name) local_filter = calloc (len, sizeof (char)); if (!local_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } strlcpy (local_filter, local_filter_addr_lower, len); @@ -1354,8 +1354,8 @@ policy_callback (char *name) local_filter = calloc (len, sizeof (char)); if (!local_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -1390,8 +1390,8 @@ policy_callback (char *name) local_filter = calloc (len, sizeof (char)); if (!local_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", len, - sizeof (char)); + log_error ("policy_callback: calloc (%d, %lu) failed", len, + (unsigned long)sizeof (char)); goto bad; } @@ -1406,8 +1406,8 @@ policy_callback (char *name) local_filter = malloc (idlocalsz - ISAKMP_ID_DATA_OFF + 1); if (!local_filter) { - log_error ("policy_callback: malloc (%d) failed", - idlocalsz - ISAKMP_ID_DATA_OFF + 1); + log_error ("policy_callback: malloc (%lu) failed", + (unsigned long)idlocalsz - ISAKMP_ID_DATA_OFF + 1); goto bad; } memcpy (local_filter, idlocal + ISAKMP_ID_DATA_OFF, @@ -1420,8 +1420,8 @@ policy_callback (char *name) local_filter = malloc (idlocalsz - ISAKMP_ID_DATA_OFF + 1); if (!local_filter) { - log_error ("policy_callback: malloc (%d) failed", - idlocalsz - ISAKMP_ID_DATA_OFF + 1); + log_error ("policy_callback: malloc (%lu) failed", + (unsigned long)idlocalsz - ISAKMP_ID_DATA_OFF + 1); goto bad; } memcpy (local_filter, idlocal + ISAKMP_ID_DATA_OFF, @@ -1453,9 +1453,9 @@ policy_callback (char *name) sizeof (char)); if (!local_filter) { - log_error ("policy_callback: calloc (%d, %d) failed", - 2 * (idlocalsz - ISAKMP_ID_DATA_OFF) + 1, - sizeof (char)); + log_error ("policy_callback: calloc (%lu, %lu) failed", + 2 * ((unsigned long)idlocalsz - ISAKMP_ID_DATA_OFF) + 1, + (unsigned long)sizeof (char)); goto bad; } /* Does it contain any non-printable characters ? */ @@ -1833,16 +1833,16 @@ policy_init (void) /* Allocate memory to keep policies. */ ptr = calloc (sz + 1, sizeof (char)); if (!ptr) - log_fatal ("policy_init: calloc (%d, %d) failed", sz + 1, - sizeof (char)); + log_fatal ("policy_init: calloc (%lu, %lu) failed", (unsigned long)sz + 1, + (unsigned long)sizeof (char)); /* Just in case there are short reads... */ for (len = 0; len < sz; len += i) { i = read (fd, ptr + len, sz - len); if (i == -1) - log_fatal ("policy_init: read (%d, %p, %d) failed", fd, ptr + len, - sz - len); + log_fatal ("policy_init: read (%d, %p, %lu) failed", fd, ptr + len, + (unsigned long)(sz - len)); } /* We're done with this. */ @@ -1967,8 +1967,8 @@ keynote_certreq_validate (u_int8_t *data, u_int32_t len) dat = calloc (len + 1, sizeof (char)); if (!dat) { - log_error ("keynote_certreq_validate: calloc (%d, %d) failed", len + 1, - sizeof (char)); + log_error ("keynote_certreq_validate: calloc (%d, %lu) failed", len + 1, + (unsigned long)sizeof (char)); return 0; } @@ -2040,8 +2040,8 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert, file = calloc (len + strlen (addr_str), sizeof (char)); if (file == NULL) { - log_error ("keynote_cert_obtain: failed to allocate %d bytes", - len + strlen (addr_str)); + log_error ("keynote_cert_obtain: failed to allocate %lu bytes", + (unsigned long)len + strlen (addr_str)); free (addr_str); return 0; } @@ -2057,8 +2057,8 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert, file = calloc (len + id_len, sizeof (char)); if (file == NULL) { - log_error ("keynote_cert_obtain: failed to allocate %d bytes", - len + id_len); + log_error ("keynote_cert_obtain: failed to allocate %lu bytes", + (unsigned long)len + id_len); return 0; } @@ -2085,8 +2085,8 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert, *cert = calloc (size + 1, sizeof (char)); if (*cert == NULL) { - log_error ("keynote_cert_obtain: failed to allocate %d bytes", - size); + log_error ("keynote_cert_obtain: failed to allocate %lu bytes", + (unsigned long)size); free (file); return 0; } @@ -2102,8 +2102,8 @@ keynote_cert_obtain (u_int8_t *id, size_t id_len, void *data, u_int8_t **cert, if (read (fd, *cert, size) != size) { - LOG_DBG ((LOG_POLICY, 30, "keynote_cert_obtain: failed to read %d " - "bytes from \"%s\"", size, file)); + LOG_DBG ((LOG_POLICY, 30, "keynote_cert_obtain: failed to read %lu " + "bytes from \"%s\"", (unsigned long)size, file)); free (file); close (fd); return 0; diff --git a/sbin/isakmpd/prf.c b/sbin/isakmpd/prf.c index 51551e22bf4..2586cc3087a 100644 --- a/sbin/isakmpd/prf.c +++ b/sbin/isakmpd/prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prf.c,v 1.7 1999/05/02 19:16:41 niklas Exp $ */ +/* $OpenBSD: prf.c,v 1.8 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: prf.c,v 1.7 1999/05/02 12:50:29 niklas Exp $ */ /* @@ -100,7 +100,7 @@ prf_alloc (enum prfs type, int subtype, char *shared, int sharedsize) prf = malloc (sizeof *prf); if (!prf) { - log_error ("prf_alloc: malloc (%d) failed", sizeof *prf); + log_error ("prf_alloc: malloc (%lu) failed", (unsigned long)sizeof *prf); return 0; } @@ -110,7 +110,7 @@ prf_alloc (enum prfs type, int subtype, char *shared, int sharedsize) prfctx = malloc (sizeof *prfctx); if (!prfctx) { - log_error ("prf_alloc: malloc (%d) failed", sizeof *prfctx); + log_error ("prf_alloc: malloc (%lu) failed", (unsigned long)sizeof *prfctx); goto cleanprf; } prf->prfctx = prfctx; diff --git a/sbin/isakmpd/sa.c b/sbin/isakmpd/sa.c index 1dabcac75bb..b3b73214a5a 100644 --- a/sbin/isakmpd/sa.c +++ b/sbin/isakmpd/sa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sa.c,v 1.56 2002/05/28 10:09:46 ho Exp $ */ +/* $OpenBSD: sa.c,v 1.57 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: sa.c,v 1.112 2000/12/12 00:22:52 niklas Exp $ */ /* @@ -92,8 +92,8 @@ sa_init (void) bucket_mask = (1 << INITIAL_BUCKET_BITS) - 1; sa_tab = malloc ((bucket_mask + 1) * sizeof (struct sa_list)); if (!sa_tab) - log_fatal ("sa_init: malloc (%d) failed", - (bucket_mask + 1) * sizeof (struct sa_list)); + log_fatal ("sa_init: malloc (%lu) failed", + (bucket_mask + 1) * (unsigned long)sizeof (struct sa_list)); for (i = 0; i <= bucket_mask; i++) { LIST_INIT (&sa_tab[i]); @@ -367,7 +367,7 @@ sa_create (struct exchange *exchange, struct transport *t) sa = calloc (1, sizeof *sa); if (!sa) { - log_error ("sa_create: calloc (1, %d) failed", sizeof *sa); + log_error ("sa_create: calloc (1, %lu) failed", (unsigned long)sizeof *sa); return -1; } sa->transport = t; @@ -385,7 +385,8 @@ sa_create (struct exchange *exchange, struct transport *t) sa->data = calloc (1, sa->doi->sa_size); if (!sa->data) { - log_error ("sa_create: calloc (1, %d) failed", sa->doi->sa_size); + log_error ("sa_create: calloc (1, %lu) failed", + (unsigned long)sa->doi->sa_size); free (sa); return -1; } @@ -825,7 +826,8 @@ sa_add_transform (struct sa *sa, struct payload *xf, int initiator, { proto = calloc (1, sizeof *proto); if (!proto) - log_error ("sa_add_transform: calloc (1, %d) failed", sizeof *proto); + log_error ("sa_add_transform: calloc (1, %lu) failed", + (unsigned long)sizeof *proto); } else /* Find the protection suite that were chosen. */ @@ -843,8 +845,8 @@ sa_add_transform (struct sa *sa, struct payload *xf, int initiator, proto->data = calloc (1, sa->doi->proto_size); if (!proto->data) { - log_error ("sa_add_transform: calloc (1, %d) failed", - sa->doi->proto_size); + log_error ("sa_add_transform: calloc (1, %lu) failed", + (unsigned long)sa->doi->proto_size); goto cleanup; } } diff --git a/sbin/isakmpd/udp.c b/sbin/isakmpd/udp.c index 5d9b7871f6c..56ca6b131d4 100644 --- a/sbin/isakmpd/udp.c +++ b/sbin/isakmpd/udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp.c,v 1.54 2002/01/03 16:27:41 ho Exp $ */ +/* $OpenBSD: udp.c,v 1.55 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: udp.c,v 1.57 2001/01/26 10:09:57 niklas Exp $ */ /* @@ -141,7 +141,7 @@ udp_make (struct sockaddr *laddr) t = calloc (1, sizeof *t); if (!t) { - log_print ("udp_make: malloc (%d) failed", sizeof *t); + log_print ("udp_make: malloc (%lu) failed", (unsigned long)sizeof *t); return 0; } @@ -181,9 +181,9 @@ udp_make (struct sockaddr *laddr) wildcardaddress ? SO_REUSEPORT : SO_REUSEADDR, (void *)&on, sizeof on) == -1) { - log_error ("udp_make: setsockopt (%d, %d, %d, %p, %d)", s, SOL_SOCKET, + log_error ("udp_make: setsockopt (%d, %d, %d, %p, %lu)", s, SOL_SOCKET, wildcardaddress ? SO_REUSEPORT : SO_REUSEADDR, - &on, sizeof on); + &on, (unsigned long)sizeof on); goto err; } @@ -193,10 +193,12 @@ udp_make (struct sockaddr *laddr) { char *tstr; if (sockaddr2text (t->src, &tstr, 0)) - log_error ("udp_make: bind (%d, %p, %d)", s, &t->src, sizeof t->src); + log_error ("udp_make: bind (%d, %p, %lu)", s, &t->src, + (unsigned long)sizeof t->src); else { - log_error ("udp_make: bind (%d, %s, %d)", s, tstr, sizeof t->src); + log_error ("udp_make: bind (%d, %s, %lu)", s, tstr, + (unsigned long)sizeof t->src); free (tstr); } goto err; @@ -230,7 +232,7 @@ udp_clone (struct udp_transport *u, struct sockaddr *raddr) t = malloc (sizeof *u); if (!t) { - log_error ("udp_clone: malloc (%d) failed", sizeof *u); + log_error ("udp_clone: malloc (%lu) failed", (unsigned long)sizeof *u); return 0; } u2 = (struct udp_transport *)t; diff --git a/sbin/isakmpd/ui.c b/sbin/isakmpd/ui.c index 555da56f938..1f3f370859e 100644 --- a/sbin/isakmpd/ui.c +++ b/sbin/isakmpd/ui.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ui.c,v 1.28 2002/03/19 04:00:59 angelos Exp $ */ +/* $OpenBSD: ui.c,v 1.29 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: ui.c,v 1.43 2000/10/05 09:25:12 niklas Exp $ */ /* @@ -409,7 +409,7 @@ ui_handler (void) buf = malloc (sz); if (!buf) { - log_print ("ui_handler: malloc (%d) failed", sz); + log_print ("ui_handler: malloc (%lu) failed", (unsigned long)sz); return; } p = buf; @@ -422,7 +422,8 @@ ui_handler (void) new_buf = realloc (buf, sz * 2); if (!new_buf) { - log_print ("ui_handler: realloc (%p, %d) failed", buf, sz * 2); + log_print ("ui_handler: realloc (%p, %lu) failed", buf, + (unsigned long)sz * 2); free (buf); buf = 0; return; @@ -436,7 +437,8 @@ ui_handler (void) n = read (ui_socket, p, resid); if (n == -1) { - log_error ("ui_handler: read (%d, %p, %d)", ui_socket, p, resid); + log_error ("ui_handler: read (%d, %p, %lu)", ui_socket, p, + (unsigned long)resid); return; } diff --git a/sbin/isakmpd/x509.c b/sbin/isakmpd/x509.c index 41a40d335b6..70551287ae5 100644 --- a/sbin/isakmpd/x509.c +++ b/sbin/isakmpd/x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.c,v 1.69 2002/03/06 10:02:32 ho Exp $ */ +/* $OpenBSD: x509.c,v 1.70 2002/06/01 07:44:22 deraadt Exp $ */ /* $EOM: x509.c,v 1.54 2001/01/16 18:42:16 ho Exp $ */ /* @@ -570,8 +570,8 @@ x509_hash_init (void) x509_tab = malloc ((bucket_mask + 1) * sizeof (struct x509_list)); if (!x509_tab) - log_fatal ("x509_hash_init: malloc (%d) failed", - (bucket_mask + 1) * sizeof (struct x509_list)); + log_fatal ("x509_hash_init: malloc (%lu) failed", + (bucket_mask + 1) * (unsigned long)sizeof (struct x509_list)); for (i = 0; i <= bucket_mask; i++) { LIST_INIT (&x509_tab[i]); @@ -640,7 +640,8 @@ x509_hash_enter (X509 *cert) if (!certh) { cert_free_subjects (n, id, len); - log_error ("x509_hash_enter: calloc (1, %d) failed", sizeof *certh); + log_error ("x509_hash_enter: calloc (1, %lu) failed", + (unsigned long)sizeof *certh); return 0; } @@ -1008,8 +1009,8 @@ x509_certreq_decode (u_int8_t *asn, u_int32_t len) memcpy (ret, &naca, sizeof (struct x509_aca)); else { - log_error ("x509_certreq_decode: malloc (%d) failed", - sizeof (struct x509_aca)); + log_error ("x509_certreq_decode: malloc (%lu) failed", + (unsigned long)sizeof (struct x509_aca)); x509_free_aca (&aca); } @@ -1169,16 +1170,16 @@ x509_cert_get_subjects (void *scert, int *cnt, u_int8_t ***id, *id = calloc (*cnt, sizeof **id); if (!*id) { - log_print ("x509_cert_get_subject: malloc (%d) failed", - *cnt * sizeof **id); + log_print ("x509_cert_get_subject: malloc (%lu) failed", + *cnt * (unsigned long)sizeof **id); goto fail; } *id_len = malloc (*cnt * sizeof **id_len); if (!*id_len) { - log_print ("x509_cert_get_subject: malloc (%d) failed", - *cnt * sizeof **id_len); + log_print ("x509_cert_get_subject: malloc (%lu) failed", + *cnt * (unsigned long)sizeof **id_len); goto fail; } |