From a8d97c8a1191f0f38bb7be23ae8a59d25baff5a7 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 20 Jun 2005 11:20:41 +0000 Subject: [PATCH] Add a whole pile of casts to get rid of compiler warnings in Tom's DK code. I hadn't compiled it before, but a user complained... --- src/src/dk.c | 28 ++++++++++++++-------------- src/src/expand.c | 30 +++++++++++++++--------------- src/src/transport.c | 8 ++++---- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/src/dk.c b/src/src/dk.c index 1c1b519e9..aa3c4d993 100644 --- a/src/src/dk.c +++ b/src/src/dk.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/dk.c,v 1.2 2005/03/08 16:57:28 ph10 Exp $ */ +/* $Cambridge: exim/src/src/dk.c,v 1.3 2005/06/20 11:20:41 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -38,7 +38,7 @@ int dk_receive_getc(void) { if (dk_context != NULL) { /* Send oldest byte */ if ((dkbuff[0] < 256) && (dk_internal_status == DK_STAT_OK)) { - dk_internal_status = dk_message(dk_context, (char *)&dkbuff[0], 1); + dk_internal_status = dk_message(dk_context, CUS &dkbuff[0], 1); if (dk_internal_status != DK_STAT_OK) DEBUG(D_receive) debug_printf("DK: %s\n", DK_STAT_to_string(dk_internal_status)); } @@ -133,7 +133,7 @@ void dk_exim_verify_finish(void) { /* Send remaining bytes from input which are still in the buffer. */ for (i=0;i<6;i++) if (dkbuff[i] < 256) - dk_internal_status = dk_message(dk_context, (char *)&dkbuff[i], 1); + dk_internal_status = dk_message(dk_context, CUS &dkbuff[i], 1); /* Flag end-of-message. */ dk_internal_status = dk_end(dk_context, NULL); @@ -249,7 +249,7 @@ uschar *dk_exim_sign(int dk_fd, /* Figure out what canonicalization to use. Unfortunately we must do this BEFORE knowing which domain we sign for. */ if ((dk_canon != NULL) && (Ustrcmp(dk_canon, "nofws") == 0)) dk_canon_int = DK_CANON_NOFWS; - else dk_canon = "simple"; + else dk_canon = US "simple"; /* Initialize signing context. */ dk_context = dk_sign(dk_lib, &dk_internal_status, dk_canon_int); @@ -263,7 +263,7 @@ uschar *dk_exim_sign(int dk_fd, if ((c == '.') && seen_lfdot) { /* escaped dot, write "\n.", continue */ - dk_message(dk_context, "\n.", 2); + dk_message(dk_context, CUS "\n.", 2); seen_lf = 0; seen_lfdot = 0; continue; @@ -271,7 +271,7 @@ uschar *dk_exim_sign(int dk_fd, if (seen_lfdot) { /* EOM, write "\n" and break */ - dk_message(dk_context, "\n", 1); + dk_message(dk_context, CUS "\n", 1); break; } @@ -282,7 +282,7 @@ uschar *dk_exim_sign(int dk_fd, if (seen_lf) { /* normal lf, just send it */ - dk_message(dk_context, "\n", 1); + dk_message(dk_context, CUS "\n", 1); seen_lf = 0; } @@ -292,7 +292,7 @@ uschar *dk_exim_sign(int dk_fd, } /* write the char */ - dk_message(dk_context, &c, 1); + dk_message(dk_context, CUS &c, 1); } /* Handle failed read above. */ @@ -310,13 +310,13 @@ uschar *dk_exim_sign(int dk_fd, /* Get domain to use, unless overridden. */ if (dk_domain == NULL) { - dk_domain = dk_address(dk_context); + dk_domain = US dk_address(dk_context); switch(dk_domain[0]) { case 'N': dk_domain = NULL; break; case 'F': case 'S': dk_domain++; - dk_domain = strrchr(dk_domain,'@'); + dk_domain = Ustrrchr(dk_domain,'@'); if (dk_domain != NULL) { uschar *p; dk_domain++; @@ -331,7 +331,7 @@ uschar *dk_exim_sign(int dk_fd, DomainKey-Signature header. If there is no domain to sign for, we can send the message anyway since the recipient has no policy to apply ... */ - rc = ""; + rc = US""; goto CLEANUP; } } @@ -373,7 +373,7 @@ uschar *dk_exim_sign(int dk_fd, (Ustrcmp(dk_private_key,"0") == 0) || (Ustrcmp(dk_private_key,"false") == 0) ) { /* don't sign, but no error */ - rc = ""; + rc = US""; goto CLEANUP; } @@ -381,7 +381,7 @@ uschar *dk_exim_sign(int dk_fd, int privkey_fd = 0; /* Looks like a filename, load the private key. */ memset(big_buffer,0,big_buffer_size); - privkey_fd = open(dk_private_key,O_RDONLY); + privkey_fd = open(CS dk_private_key,O_RDONLY); read(privkey_fd,big_buffer,16383); close(privkey_fd); dk_private_key = big_buffer; @@ -399,7 +399,7 @@ uschar *dk_exim_sign(int dk_fd, rc = store_get(1024); /* Build DomainKey-Signature header to return. */ - snprintf(rc, 1024, "DomainKey-Signature: a=rsa-sha1; q=dns; c=%s;\r\n" + snprintf(CS rc, 1024, "DomainKey-Signature: a=rsa-sha1; q=dns; c=%s;\r\n" "\ts=%s; d=%s;\r\n" "\tb=%s;\r\n", dk_canon, dk_selector, dk_domain, sig); diff --git a/src/src/expand.c b/src/src/expand.c index b30679d76..f2ce1f989 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.31 2005/06/20 10:28:33 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.32 2005/06/20 11:20:41 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1281,31 +1281,31 @@ while (last > first) if (Ustrcmp(var_table[middle].name, "dk_sender_source") == 0) switch(dk_verify_block->address_source) { - case DK_EXIM_ADDRESS_NONE: s = "0"; break; - case DK_EXIM_ADDRESS_FROM_FROM: s = "from"; break; - case DK_EXIM_ADDRESS_FROM_SENDER: s = "sender"; break; + case DK_EXIM_ADDRESS_NONE: s = US"0"; break; + case DK_EXIM_ADDRESS_FROM_FROM: s = US"from"; break; + case DK_EXIM_ADDRESS_FROM_SENDER: s = US"sender"; break; } if (Ustrcmp(var_table[middle].name, "dk_status") == 0) switch(dk_verify_block->result) { - case DK_EXIM_RESULT_ERR: s = "error"; break; - case DK_EXIM_RESULT_BAD_FORMAT: s = "bad format"; break; - case DK_EXIM_RESULT_NO_KEY: s = "no key"; break; - case DK_EXIM_RESULT_NO_SIGNATURE: s = "no signature"; break; - case DK_EXIM_RESULT_REVOKED: s = "revoked"; break; - case DK_EXIM_RESULT_NON_PARTICIPANT: s = "non-participant"; break; - case DK_EXIM_RESULT_GOOD: s = "good"; break; - case DK_EXIM_RESULT_BAD: s = "bad"; break; + case DK_EXIM_RESULT_ERR: s = US"error"; break; + case DK_EXIM_RESULT_BAD_FORMAT: s = US"bad format"; break; + case DK_EXIM_RESULT_NO_KEY: s = US"no key"; break; + case DK_EXIM_RESULT_NO_SIGNATURE: s = US"no signature"; break; + case DK_EXIM_RESULT_REVOKED: s = US"revoked"; break; + case DK_EXIM_RESULT_NON_PARTICIPANT: s = US"non-participant"; break; + case DK_EXIM_RESULT_GOOD: s = US"good"; break; + case DK_EXIM_RESULT_BAD: s = US"bad"; break; } if (Ustrcmp(var_table[middle].name, "dk_signsall") == 0) - s = (dk_verify_block->signsall)? "1" : "0"; + s = (dk_verify_block->signsall)? US"1" : US"0"; if (Ustrcmp(var_table[middle].name, "dk_testing") == 0) - s = (dk_verify_block->testing)? "1" : "0"; + s = (dk_verify_block->testing)? US"1" : US"0"; if (Ustrcmp(var_table[middle].name, "dk_is_signed") == 0) - s = (dk_verify_block->is_signed)? "1" : "0"; + s = (dk_verify_block->is_signed)? US"1" : US"0"; return (s == NULL)? US"" : s; #endif diff --git a/src/src/transport.c b/src/src/transport.c index a104f51b4..6630f36ee 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transport.c,v 1.9 2005/05/24 14:56:27 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transport.c,v 1.10 2005/06/20 11:20:41 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1042,8 +1042,8 @@ dk_transport_write_message(address_item *addr, int fd, int options, uschar *dk_strict_result = expand_string(dk_strict); if (dk_strict_result != NULL) { - if ( (strcmpic(dk_strict,"1") == 0) || - (strcmpic(dk_strict,"true") == 0) ) + if ( (strcmpic(dk_strict,US"1") == 0) || + (strcmpic(dk_strict,US"true") == 0) ) { save_errno = errno; rc = FALSE; @@ -1061,7 +1061,7 @@ dk_transport_write_message(address_item *addr, int fd, int options, /* write the chunk */ DK_WRITE: #ifdef SUPPORT_TLS - if (tls_active == fd) wwritten = tls_write(p, sread); else + if (tls_active == fd) wwritten = tls_write(US p, sread); else #endif wwritten = write(fd,p,sread); if (wwritten == -1) -- 2.25.1