From: Jeremy Harris Date: Sat, 5 Jan 2019 18:51:19 +0000 (+0000) Subject: constification X-Git-Tag: exim-4.93-RC0~284^2~31 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e8a25e05698e39a45cf5f188476808ef3609dbdd;p=exim.git constification --- diff --git a/src/src/auths/cram_md5.c b/src/src/auths/cram_md5.c index 188ac4643..b1c5610e7 100644 --- a/src/src/auths/cram_md5.c +++ b/src/src/auths/cram_md5.c @@ -321,7 +321,7 @@ in big_buffer, but b64encode() returns its result in working store, so calling smtp_write_command(), which uses big_buffer, is OK. */ buffer[0] = 0; -if (smtp_write_command(sx, SCMD_FLUSH, "%s\r\n", b64encode(big_buffer, +if (smtp_write_command(sx, SCMD_FLUSH, "%s\r\n", b64encode(CUS big_buffer, p - big_buffer)) < 0) return FAIL_SEND; return smtp_read_response(sx, US buffer, buffsize, '2', timeout) diff --git a/src/src/auths/get_data.c b/src/src/auths/get_data.c index 7d974ab26..00ea9e5bd 100644 --- a/src/src/auths/get_data.c +++ b/src/src/auths/get_data.c @@ -26,7 +26,7 @@ Returns: OK on success */ int -auth_get_data(uschar **aptr, uschar *challenge, int challen) +auth_get_data(uschar **aptr, const uschar * challenge, int challen) { int c; int p = 0; diff --git a/src/src/base64.c b/src/src/base64.c index f3c458470..289383b66 100644 --- a/src/src/base64.c +++ b/src/src/base64.c @@ -242,7 +242,7 @@ static uschar *enc64table = US"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; uschar * -b64encode(uschar *clear, int len) +b64encode(const uschar * clear, int len) { uschar *code = store_get(4*((len+2)/3) + 1); uschar *p = code; diff --git a/src/src/expand.c b/src/src/expand.c index a7a09fa7a..d6fd8488a 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -2737,7 +2737,7 @@ switch(cond_type) if (sublen == 24) { - uschar *coded = b64encode(digest, 16); + uschar *coded = b64encode(CUS digest, 16); DEBUG(D_auth) debug_printf("crypteq: using MD5+B64 hashing\n" " subject=%s\n crypted=%s\n", coded, sub[1]+5); tempcond = (Ustrcmp(coded, sub[1]+5) == 0); @@ -2774,7 +2774,7 @@ switch(cond_type) if (sublen == 28) { - uschar *coded = b64encode(digest, 20); + uschar *coded = b64encode(CUS digest, 20); DEBUG(D_auth) debug_printf("crypteq: using SHA1+B64 hashing\n" " subject=%s\n crypted=%s\n", coded, sub[1]+6); tempcond = (Ustrcmp(coded, sub[1]+6) == 0); @@ -6843,7 +6843,7 @@ while (*s != 0) } } - enc = b64encode(sub, out - sub); + enc = b64encode(CUS sub, out - sub); yield = string_cat(yield, enc); continue; } @@ -7507,9 +7507,9 @@ while (*s != 0) #ifdef SUPPORT_TLS uschar * s = vp && *(void **)vp->value ? tls_cert_der_b64(*(void **)vp->value) - : b64encode(sub, Ustrlen(sub)); + : b64encode(CUS sub, Ustrlen(sub)); #else - uschar * s = b64encode(sub, Ustrlen(sub)); + uschar * s = b64encode(CUS sub, Ustrlen(sub)); #endif yield = string_cat(yield, s); continue; diff --git a/src/src/functions.h b/src/src/functions.h index cab7a7363..866865600 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -108,7 +108,7 @@ extern int auth_check_serv_cond(auth_instance *); extern int auth_check_some_cond(auth_instance *, uschar *, uschar *, int); -extern int auth_get_data(uschar **, uschar *, int); +extern int auth_get_data(uschar **, const uschar *, int); extern int auth_get_no64_data(uschar **, uschar *); extern void auth_show_supported(FILE *); extern uschar *auth_xtextencode(uschar *, int); @@ -128,7 +128,7 @@ extern gstring *authres_smtpauth(gstring *); extern gstring *authres_spf(gstring *); #endif -extern uschar *b64encode(uschar *, int); +extern uschar *b64encode(const uschar *, int); extern int b64decode(const uschar *, uschar **); extern int bdat_getc(unsigned); extern uschar *bdat_getbuf(unsigned *); diff --git a/src/src/lss.c b/src/src/lss.c index 59cbd7ff4..167522d2f 100644 --- a/src/src/lss.c +++ b/src/src/lss.c @@ -115,9 +115,9 @@ Returns: a pointer to the zero-terminated base 64 string, which */ uschar * -lss_b64encode(uschar *clear, int len) +lss_b64encode(uschar * clear, int len) { -return b64encode(clear, len); +return b64encode(CUS clear, len); } /* diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index d056402e1..6e154f5ef 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -445,7 +445,7 @@ b->len = dlen; uschar * pdkim_encode_base64(blob * b) { -return b64encode(b->data, b->len); +return b64encode(CUS b->data, b->len); } diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index e5a5fabcc..6d60409d7 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -475,16 +475,16 @@ tls_channelbinding_b64 = NULL; #ifdef HAVE_GNUTLS_SESSION_CHANNEL_BINDING channel.data = NULL; channel.size = 0; -rc = gnutls_session_channel_binding(state->session, GNUTLS_CB_TLS_UNIQUE, &channel); -if (rc) { - DEBUG(D_tls) debug_printf("Channel binding error: %s\n", gnutls_strerror(rc)); -} else { +if ((rc = gnutls_session_channel_binding(state->session, GNUTLS_CB_TLS_UNIQUE, &channel))) + { DEBUG(D_tls) debug_printf("Channel binding error: %s\n", gnutls_strerror(rc)); } +else + { old_pool = store_pool; store_pool = POOL_PERM; - tls_channelbinding_b64 = b64encode(channel.data, (int)channel.size); + tls_channelbinding_b64 = b64encode(CUS channel.data, (int)channel.size); store_pool = old_pool; DEBUG(D_tls) debug_printf("Have channel bindings cached for possible auth usage.\n"); -} + } #endif /* peercert is set in peer_status() */ diff --git a/src/src/tlscert-gnu.c b/src/src/tlscert-gnu.c index 572f97130..cebeae526 100644 --- a/src/src/tlscert-gnu.c +++ b/src/src/tlscert-gnu.c @@ -429,7 +429,7 @@ if ( (fail = gnutls_x509_crt_export((gnutls_x509_crt_t)cert, gnutls_strerror(fail)); return NULL; } -return b64encode(cp, (int)len); +return b64encode(CUS cp, (int)len); } diff --git a/src/src/tlscert-openssl.c b/src/src/tlscert-openssl.c index 938b0abb8..46de499cc 100644 --- a/src/src/tlscert-openssl.c +++ b/src/src/tlscert-openssl.c @@ -477,7 +477,7 @@ if (!i2d_X509_bio(bp, (X509 *)cert)) else { long len = BIO_get_mem_data(bp, &cp); - cp = b64encode(cp, (int)len); + cp = b64encode(CUS cp, (int)len); } BIO_free(bp);