From: Wietse Z Venema Date: Sat, 16 May 2026 05:00:00 +0000 (-0500) Subject: postfix-3.12-20260516 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=57747e9c1db9b3e955902b6b8d010d55c337b2a2;p=thirdparty%2Fpostfix.git postfix-3.12-20260516 --- diff --git a/postfix/.indent.pro b/postfix/.indent.pro index 9ece20998..81780bfb5 100644 --- a/postfix/.indent.pro +++ b/postfix/.indent.pro @@ -2,7 +2,7 @@ -TADDR_MATCH_LIST -TADDR_PATTERN -TALIAS_TOKEN --TALLOWED_PARENT +-TALLOWED_PREFIX -TANVIL_CLNT -TANVIL_LOCAL -TANVIL_MAX @@ -242,6 +242,7 @@ -TMOCK_APPL_STATUS -TMOCK_EXPECT -TMOCK_OPEN_AS_REQ +-TMOCK_SERVER -TMOCK_SPAWN_CMD_REQ -TMOCK_STAT_REQ -TMOCK_UNIX_SERVER @@ -469,7 +470,6 @@ -Tssize_t -Tssl_cipher_stack_t -Tssl_comp_stack_t --Tstat -Ttime_t -Ttlsa_filter -Tuint16_t diff --git a/postfix/HISTORY b/postfix/HISTORY index c934825e9..4a30c1525 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -31161,6 +31161,17 @@ Apologies for any names omitted. anvil/anvil.c, global/anvil_clnt.[hc], proto/postconf.proto, mantools/postlink. +20260516 + + Cleanup: moved a "mask &= ~TLS_LOG_TRACE" statement whose effect + was never used. File:tls/tls_misc.c. + + Safety: future-proofing (posttls-finger.c) and fail-closed + (tls_misc.c). + + Re-indented the source code after deleting 'stat' and adding + missing types to .indent.pro. + TODO Reorganize PTEST_LIB, PMOCK_LIB, TESTLIB, TESTLIBS, etc. diff --git a/postfix/proto/stop.double-history b/postfix/proto/stop.double-history index c463b4d8f..2a32e3bee 100644 --- a/postfix/proto/stop.double-history +++ b/postfix/proto/stop.double-history @@ -259,3 +259,5 @@ proto proto stop proto stop double cc smtpd smtpd c tls tls h tls tls_client c tls tls_misc c smtp smtp c smtp smtp_params c smtp smtp_proto c tlsproxy tlsproxy c tlsproxy tlsproxy_client c + postscreen postscreen c postscreen postscreen_tls_conf c + anvil anvil c global anvil_clnt hc proto postconf proto diff --git a/postfix/proto/stop.spell-history b/postfix/proto/stop.spell-history index e30c9f947..f1f938112 100644 --- a/postfix/proto/stop.spell-history +++ b/postfix/proto/stop.spell-history @@ -139,3 +139,4 @@ gmock sunos WebPKI rf +musl diff --git a/postfix/src/bounce/bounce_notify_util_tester.c b/postfix/src/bounce/bounce_notify_util_tester.c index 2d6c12303..6f3289db5 100644 --- a/postfix/src/bounce/bounce_notify_util_tester.c +++ b/postfix/src/bounce/bounce_notify_util_tester.c @@ -157,11 +157,11 @@ int main(int argc, char **argv) }; test_server_main(argc, argv, test_driver, - CA_TEST_MAIN_INT_TABLE(int_table), - CA_TEST_MAIN_STR_TABLE(str_table), - CA_TEST_MAIN_TIME_TABLE(time_table), - CA_TEST_MAIN_NBOOL_TABLE(nbool_table), - 0); + CA_TEST_MAIN_INT_TABLE(int_table), + CA_TEST_MAIN_STR_TABLE(str_table), + CA_TEST_MAIN_TIME_TABLE(time_table), + CA_TEST_MAIN_NBOOL_TABLE(nbool_table), + 0); exit(0); } diff --git a/postfix/src/global/allowed_prefix.c b/postfix/src/global/allowed_prefix.c index 178f250a6..a226f178f 100644 --- a/postfix/src/global/allowed_prefix.c +++ b/postfix/src/global/allowed_prefix.c @@ -81,7 +81,7 @@ ALLOWED_PREFIX *allowed_prefix_create(const char *prefixes) tp = argv_alloc(5); while ((prefix = mystrtok(&bp, CHARS_COMMA_SP)) != 0) { if (*prefix != '/') { - (void) decline_request_with("relative pathname",prefix); + (void) decline_request_with("relative pathname", prefix); continue; } /* Trim trailing '/'. */ diff --git a/postfix/src/global/allowed_prefix.h b/postfix/src/global/allowed_prefix.h index 0ca75c378..bdb83fcdb 100644 --- a/postfix/src/global/allowed_prefix.h +++ b/postfix/src/global/allowed_prefix.h @@ -1,5 +1,5 @@ -#ifndef _ALLOWED_PARENT_H_INCLUDED_ -#define _ALLOWED_PARENT_H_INCLUDED_ +#ifndef _ALLOWED_PREFIX_H_INCLUDED_ +#define _ALLOWED_PREFIX_H_INCLUDED_ /*++ /* NAME diff --git a/postfix/src/global/anvil_clnt.c b/postfix/src/global/anvil_clnt.c index e536c52d0..800a62530 100644 --- a/postfix/src/global/anvil_clnt.c +++ b/postfix/src/global/anvil_clnt.c @@ -223,8 +223,8 @@ void anvil_clnt_free(ANVIL_CLNT *anvil_clnt) int anvil_clnt_lookup(ANVIL_CLNT *anvil_clnt, const char *service, const char *addr, int *count, int *rate, - int *msgs, int *rcpts, int *newtls, - int *auths, int *tlstrs) + int *msgs, int *rcpts, int *newtls, + int *auths, int *tlstrs) { char *ident = ANVIL_IDENT(service, addr); int status; diff --git a/postfix/src/global/dict_sqlite_test.c b/postfix/src/global/dict_sqlite_test.c index 0eae17cd9..f0c1a1972 100644 --- a/postfix/src/global/dict_sqlite_test.c +++ b/postfix/src/global/dict_sqlite_test.c @@ -159,7 +159,7 @@ static void test_flag_non_recommended_query(PTEST_CTX *t, const PTEST_CASE *tp) if (unlink(cfpath) < 0) ptest_error(t, "unlink %s: %m", cfpath); #else - ptest_skip(t); + ptest_skip(t); #endif } diff --git a/postfix/src/global/haproxy_srvr.h b/postfix/src/global/haproxy_srvr.h index 9467b058e..e007ef59d 100644 --- a/postfix/src/global/haproxy_srvr.h +++ b/postfix/src/global/haproxy_srvr.h @@ -204,7 +204,7 @@ struct proxy_hdr_v2 { /* * End protocol v2 definitions from haproxy/include/types/connection.h. */ -#endif /* HAPROXY_SRVR_INTERNAL */ +#endif /* HAPROXY_SRVR_INTERNAL */ /* LICENSE /* .ad diff --git a/postfix/src/global/hfrom_format_test.c b/postfix/src/global/hfrom_format_test.c index f5d1a3903..eb2dd62e7 100644 --- a/postfix/src/global/hfrom_format_test.c +++ b/postfix/src/global/hfrom_format_test.c @@ -73,8 +73,8 @@ static void test_hfrom_format_parse(PTEST_CTX *t, const PTEST_CASE *tp) if (*np->want_log == 0) { if (got_code != np->want_code) { ptest_error(t, "got code \"%d\", want \"%d\"(%s)", - got_code, np->want_code, - str_hfrom_format_code(np->want_code)); + got_code, np->want_code, + str_hfrom_format_code(np->want_code)); } } }); @@ -121,7 +121,7 @@ static void test_str_hfrom_format_code(PTEST_CTX *t, const PTEST_CASE *tp) if (*cp->want_log == 0) { if (strcmp(got_name, cp->want_name) != 0) { ptest_error(t, "got name: \"%s\", want: \"%s\"", - got_name, cp->want_name); + got_name, cp->want_name); } } }); diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index a53144448..047d98af7 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20260514" +#define MAIL_RELEASE_DATE "20260516" #define MAIL_VERSION_NUMBER "3.12" #ifdef SNAPSHOT diff --git a/postfix/src/global/map_search_test.c b/postfix/src/global/map_search_test.c index 8eb6b91b7..0e037eac9 100644 --- a/postfix/src/global/map_search_test.c +++ b/postfix/src/global/map_search_test.c @@ -223,7 +223,7 @@ static void test_map_search(PTEST_CTX *t, const struct PTEST_CASE *unused) escape_order(got_escaped, string_or_null(map_search_from_create->search_order)), escape_order(want_escaped, - string_or_null(tp->want_search_order))); + string_or_null(tp->want_search_order))); } }); } diff --git a/postfix/src/global/nbdb_redirect.c b/postfix/src/global/nbdb_redirect.c index 5de5e4a50..9ae67430c 100644 --- a/postfix/src/global/nbdb_redirect.c +++ b/postfix/src/global/nbdb_redirect.c @@ -185,7 +185,7 @@ static DICT *nbdb_dict_open(const char *leg_type, const char *name, "known pathname suffix", non_leg_type)); } non_leg_index_path = concatenate(name, non_leg_suffix, (char *) 0); - stat_res = stat (non_leg_index_path, &st); + stat_res = stat(non_leg_index_path, &st); saved_errno = errno; myfree(non_leg_index_path); diff --git a/postfix/src/global/nbdb_redirect_test.c b/postfix/src/global/nbdb_redirect_test.c index 728b5d707..ec698678b 100644 --- a/postfix/src/global/nbdb_redirect_test.c +++ b/postfix/src/global/nbdb_redirect_test.c @@ -169,7 +169,7 @@ static int redirects_dict_open_btree_to_def_cache_db_type(const TEST_CASE *tp) setup_common_mock_open_info(); var_cache_db_type = "lmdb"; capture = msg_capt_create(100); - var_nbdb_log_redirect = want_logging != 0; + var_nbdb_log_redirect = want_logging != 0; /* * Verify that 'btree' redirects to $default_cache_db_type ('lmdb'). diff --git a/postfix/src/global/rfc2047_code.c b/postfix/src/global/rfc2047_code.c index 3c8b7b201..40b786683 100644 --- a/postfix/src/global/rfc2047_code.c +++ b/postfix/src/global/rfc2047_code.c @@ -102,8 +102,8 @@ /* * What ASCII characters are allowed in the 'charset' or 'encoding' tokens - * of an encoded-word. 202604 Claude: in the macro expansion replace - * several instances of 'ch' with 'c'. + * of an encoded-word. 202604 Claude: in the macro expansion replace several + * instances of 'ch' with 'c'. */ #define RFC2047_ESPECIALS_STR "()<>@,;:\\\"/[]?.=" #define RFC2047_ALLOWED_TOKEN_CHAR(c) \ @@ -659,7 +659,7 @@ static const TEST_CASE test_cases[] = { "encoder called with empty charset name\n" }, {"validates_charset_length", test_rfc2047_encode, - RFC2047_HEADER_CONTEXT_COMMENT, /* charset= */ + RFC2047_HEADER_CONTEXT_COMMENT, /* charset= */ "1234567890123456789012345678901234567890", "testme", 0, " ", NO_OUTPUT, "rfc2047_code: warning: rfc2047_encode: " "unreasonable charset name: " diff --git a/postfix/src/nbdb_reindexd/nbdb_process.c b/postfix/src/nbdb_reindexd/nbdb_process.c index 0ad6ef109..2ddcd4bf9 100644 --- a/postfix/src/nbdb_reindexd/nbdb_process.c +++ b/postfix/src/nbdb_reindexd/nbdb_process.c @@ -129,7 +129,7 @@ int nbdb_process(const char *leg_type, const char *source_path, * the client may have connected to this service before the file was * indexed. */ - if (stat (STR(new_idx_path), &new_idx_st) == 0 && new_idx_st.st_size > 0) { + if (stat(STR(new_idx_path), &new_idx_st) == 0 && new_idx_st.st_size > 0) { msg_info("target file '%s' already exists, skipping this request", STR(new_idx_path)); return (NBDB_STAT_OK); @@ -140,7 +140,7 @@ int nbdb_process(const char *leg_type, const char *source_path, * the owner's (uid, gid) to run the postmap or postalias command with. */ vstring_sprintf(leg_idx_path, "%s%s", source_path, NBDB_LEGACY_SUFFIX); - if (stat (STR(leg_idx_path), &leg_idx_st) < 0) { + if (stat(STR(leg_idx_path), &leg_idx_st) < 0) { vstring_sprintf(why, "look up status for legacy indexed file '%s': %m", STR(leg_idx_path)); return (NBDB_STAT_ERROR); @@ -151,7 +151,7 @@ int nbdb_process(const char *leg_type, const char *source_path, * and will reject the request if the source has unsafe permissions for * the uid that we would run postmap or postalias with. */ - if (stat (source_path, &source_st) < 0) { + if (stat(source_path, &source_st) < 0) { vstring_sprintf(why, "look up status for source file '%s': %m", source_path); return (NBDB_STAT_ERROR); @@ -164,7 +164,7 @@ int nbdb_process(const char *leg_type, const char *source_path, */ vstring_strcpy(parent_dir_buf, source_path); parent_dir = dirname(STR(parent_dir_buf)); - if (stat (parent_dir, &parent_dir_st) < 0) { + if (stat(parent_dir, &parent_dir_st) < 0) { vstring_sprintf(why, "look up status for parent directory '%s': %m", parent_dir); return (NBDB_STAT_ERROR); diff --git a/postfix/src/nbdb_reindexd/nbdb_safe.c b/postfix/src/nbdb_reindexd/nbdb_safe.c index 621f5e692..cf73e1742 100644 --- a/postfix/src/nbdb_reindexd/nbdb_safe.c +++ b/postfix/src/nbdb_reindexd/nbdb_safe.c @@ -76,7 +76,7 @@ /* nbdb_safe_for_uid - owned by the user or root, not group or other writable */ -bool nbdb_safe_for_uid(uid_t uid, const struct stat *st) +bool nbdb_safe_for_uid(uid_t uid, const struct stat * st) { /* @@ -93,9 +93,9 @@ bool nbdb_safe_for_uid(uid_t uid, const struct stat *st) /* nbdb_safe_to_index_as_legacy_index_owner - OK to run postmap/postalias */ bool nbdb_safe_to_index_as_legacy_index_owner( - const char *source_path, const struct stat *source_st, - const char *leg_idx_path, const struct stat *leg_idx_st, - const char *parent_dir, const struct stat *parent_dir_st, + const char *source_path, const struct stat * source_st, + const char *leg_idx_path, const struct stat * leg_idx_st, + const char *parent_dir, const struct stat * parent_dir_st, VSTRING *why) { uid_t runas_uid; diff --git a/postfix/src/postscreen/postscreen_dnsbl_test.c b/postfix/src/postscreen/postscreen_dnsbl_test.c index 8e3a0fcf6..ef7ccada3 100644 --- a/postfix/src/postscreen/postscreen_dnsbl_test.c +++ b/postfix/src/postscreen/postscreen_dnsbl_test.c @@ -343,7 +343,7 @@ struct multi_dnsbl_data { const char *dnsbl_sites; /* postscreen_dnsbl_sites */ const char *req_addr; /* in dnsblog request */ struct dnsbl_data dnsbl_data[MAX_DNSBL_SITES]; - int want_ttl; /* effective TTL */ + int want_ttl; /* effective TTL */ int want_score; /* sum of weights */ }; @@ -500,7 +500,7 @@ static void test_multi_dnsbl(PTEST_CTX *t, const PTEST_CASE *tp) dp[n].res_ttl), ATTR_TYPE_END); mock_server_interact(mp[n], serialized_req, - serialized_resp); + serialized_resp); vstring_free(serialized_req); vstring_free(serialized_resp); } diff --git a/postfix/src/postscreen/postscreen_smtpd.c b/postfix/src/postscreen/postscreen_smtpd.c index 89fcdac31..6449a9abf 100644 --- a/postfix/src/postscreen/postscreen_smtpd.c +++ b/postfix/src/postscreen/postscreen_smtpd.c @@ -1243,14 +1243,15 @@ void psc_smtpd_init(void) psc_smtpd_helo_reply = mystrdup(STR(psc_temp)); /* - * STARTTLS support. This affects the EHLO greeting. */ + * STARTTLS support. This affects the EHLO greeting. + */ psc_tls_pre_jail(); /* * Initialize the EHLO reply. Once for plaintext sessions, and once for * TLS sessions. */ - psc_smtpd_format_ehlo_reply(psc_temp, psc_ehlo_discard_mask + psc_smtpd_format_ehlo_reply(psc_temp, psc_ehlo_discard_mask | (psc_tls_ready ? 0 : EHLO_MASK_STARTTLS)); psc_smtpd_ehlo_reply_plain = mystrdup(STR(psc_temp)); diff --git a/postfix/src/postscreen/postscreen_tls_conf.c b/postfix/src/postscreen/postscreen_tls_conf.c index 3ba6d0908..44c54d0d4 100644 --- a/postfix/src/postscreen/postscreen_tls_conf.c +++ b/postfix/src/postscreen/postscreen_tls_conf.c @@ -91,6 +91,7 @@ bool psc_tls_ready; #ifdef USE_TLS TLS_SERVER_PARAMS psc_tls_params; TLS_SERVER_INIT_PROPS psc_init_props; + #endif /* @@ -311,7 +312,7 @@ bool psc_tls_pre_start(const PSC_STATE *state, cipher_grade = cipher_grade, cipher_exclusions = STR(cipher_exclusions), mdalg = var_psc_tls_fpt_dgst, - trace_size_limit = var_psc_tls_trace_size_limit, + trace_size_limit = var_psc_tls_trace_size_limit, trace_peer = state->smtp_client_addr); return (true); } diff --git a/postfix/src/posttls-finger/posttls-finger.c b/postfix/src/posttls-finger/posttls-finger.c index 690aedb40..5c943632d 100644 --- a/postfix/src/posttls-finger/posttls-finger.c +++ b/postfix/src/posttls-finger/posttls-finger.c @@ -533,6 +533,7 @@ static DNS_RR *host_addr(STATE *, const char *); #if defined(USE_TLS) && defined(HAVE_SSL_TRACE) static BIO *posttls_trace_open(void *, const char *); + #endif #define HNAME(addr) (addr->qname) @@ -1933,6 +1934,8 @@ static BIO *posttls_trace_open(void *arg, const char *trace_peer) if (state->trace_file == 0) { VSTRING *path = vstring_alloc(64); + /* Cheap defense against future change to reuse the path buffer. */ + VSTRING_RESET(path); bio = tls_trace_create_file(path, trace_peer); state->trace_file = vstring_export(path); if (bio == 0) { @@ -2047,7 +2050,7 @@ static void parse_options(STATE *state, int argc, char *argv[]) state->level = TLS_LEV_DANE; state->mxinsec_level = TLS_LEV_DANE; state->tlsproxy_mode = 0; - state->trace_file = 0; /* lazily constructed at trace_open */ + state->trace_file = 0; /* lazily constructed */ #else #define TLSOPTS "" state->level = TLS_LEV_NONE; diff --git a/postfix/src/ptest/msg_jmp.c b/postfix/src/ptest/msg_jmp.c index 0535ea561..87a91c4c2 100644 --- a/postfix/src/ptest/msg_jmp.c +++ b/postfix/src/ptest/msg_jmp.c @@ -60,8 +60,8 @@ #include /* - * Private state. But it has to be caller-visible -because msg_setjmp() cannot be a function. + * Private state. But it has to be caller-visible because msg_setjmp() + * cannot be a function. */ MSG_JMP_BUF *msg_jmp_bufp; diff --git a/postfix/src/ptest/ptest_log_test.c b/postfix/src/ptest/ptest_log_test.c index fb72b92d6..796a5cae7 100644 --- a/postfix/src/ptest/ptest_log_test.c +++ b/postfix/src/ptest/ptest_log_test.c @@ -43,7 +43,7 @@ static void ptest_log_flags_missing_message(PTEST_CTX *t, const PTEST_CASE *unus expect_ptest_log_event(t, "this is a forced 'Missing log event' error"); } -static void ptest_nested_logging(PTEST_CTX * t, const PTEST_CASE * unused) +static void ptest_nested_logging(PTEST_CTX *t, const PTEST_CASE *unused) { expect_ptest_log_event(t, "top-level"); msg_warn("this is a top-level event"); diff --git a/postfix/src/smtp/smtp_connect.c b/postfix/src/smtp/smtp_connect.c index 62ff23ca2..5b2eb1d52 100644 --- a/postfix/src/smtp/smtp_connect.c +++ b/postfix/src/smtp/smtp_connect.c @@ -552,7 +552,7 @@ static int smtp_get_effective_tls_level(DSN_BUF *why, SMTP_STATE *state) STR(iter->host)); return (0); } - break; + break; case SMTP_REQTLS_POLICY_ACT_OPP_TLS: if (tls->level == TLS_LEV_NONE) { if (state->tls_stats) diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index 1e7a7521e..6de6ad56e 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -1098,7 +1098,7 @@ static int smtp_start_tls(SMTP_STATE *state) #endif ffail_type = 0, dane = state->tls->dane, - trace_size_limit = var_smtp_tls_trace_size_limit, + trace_size_limit = var_smtp_tls_trace_size_limit, trace_peer = STR(iter->addr)); /* @@ -1231,7 +1231,7 @@ static int smtp_start_tls(SMTP_STATE *state) #endif ffail_type = state->tls->ext_policy_failure, dane = state->tls->dane, - trace_size_limit = var_smtp_tls_trace_size_limit, + trace_size_limit = var_smtp_tls_trace_size_limit, trace_open = 0, trace_arg = 0, trace_peer = STR(iter->addr)); diff --git a/postfix/src/smtp/smtp_reqtls_policy_test.c b/postfix/src/smtp/smtp_reqtls_policy_test.c index eb445eb9d..f13e593a0 100644 --- a/postfix/src/smtp/smtp_reqtls_policy_test.c +++ b/postfix/src/smtp/smtp_reqtls_policy_test.c @@ -260,12 +260,12 @@ static int converts_good_u_label_query(const TEST_CASE *tp) { const char *ext_policy = "inline:{{foo.xn--1xa.example = opportunistic}} enforce"; const struct QUERY_REPLY qr[] = { - {"foo.xn--1xa.example", SMTP_REQTLS_POLICY_ACT_OPPORTUNISTIC}, - {"foo.\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_OPPORTUNISTIC}, - {"x.foo.xn--1xa.example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, - {"x.foo.\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, - {"example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, - {0}, + {"foo.xn--1xa.example", SMTP_REQTLS_POLICY_ACT_OPPORTUNISTIC}, + {"foo.\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_OPPORTUNISTIC}, + {"x.foo.xn--1xa.example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, + {"x.foo.\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, + {"example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, + {0}, }; SMTP_REQTLS_POLICY *int_policy; const struct QUERY_REPLY *qp; @@ -275,11 +275,11 @@ static int converts_good_u_label_query(const TEST_CASE *tp) int_policy = smtp_reqtls_policy_parse(test_origin, ext_policy); for (qp = qr; qp->query; qp++) { - got = smtp_reqtls_policy_eval(int_policy, qp->query); - if (got != qp->reply) { - msg_warn("got result '%d', want: '%d'", got, qp->reply); - errors++; - } + got = smtp_reqtls_policy_eval(int_policy, qp->query); + if (got != qp->reply) { + msg_warn("got result '%d', want: '%d'", got, qp->reply); + errors++; + } } smtp_reqtls_policy_free(int_policy); return (errors == 0); @@ -289,10 +289,10 @@ static int fails_bad_u_label_query(const TEST_CASE *tp) { const char *ext_policy = "inline:{{foo.xn--1xa.example = opportunistic}} disable"; const struct QUERY_REPLY qr[] = { - {"foo.\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_OPPORTUNISTIC}, - {"foo.-\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, - {"example", SMTP_REQTLS_POLICY_ACT_DISABLE}, - {0}, + {"foo.\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_OPPORTUNISTIC}, + {"foo.-\xcf\x80.example", SMTP_REQTLS_POLICY_ACT_ENFORCE}, + {"example", SMTP_REQTLS_POLICY_ACT_DISABLE}, + {0}, }; SMTP_REQTLS_POLICY *int_policy; const struct QUERY_REPLY *qp; @@ -302,11 +302,11 @@ static int fails_bad_u_label_query(const TEST_CASE *tp) int_policy = smtp_reqtls_policy_parse(test_origin, ext_policy); for (qp = qr; qp->query; qp++) { - got = smtp_reqtls_policy_eval(int_policy, qp->query); - if (got != qp->reply) { - msg_warn("got result '%d', want: '%d'", got, qp->reply); - errors++; - } + got = smtp_reqtls_policy_eval(int_policy, qp->query); + if (got != qp->reply) { + msg_warn("got result '%d', want: '%d'", got, qp->reply); + errors++; + } } smtp_reqtls_policy_free(int_policy); return (errors == 0); diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 091f0f549..8e0bc714f 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -5352,7 +5352,7 @@ static void smtpd_start_tls(SMTPD_STATE *state) cipher_grade = cipher_grade, cipher_exclusions = STR(cipher_exclusions), mdalg = var_smtpd_tls_fpt_dgst, - trace_size_limit = var_smtpd_tls_trace_size_limit, + trace_size_limit = var_smtpd_tls_trace_size_limit, trace_peer = state->addr); /* diff --git a/postfix/src/testing/make_attr.c b/postfix/src/testing/make_attr.c index dd332092f..5c628a529 100644 --- a/postfix/src/testing/make_attr.c +++ b/postfix/src/testing/make_attr.c @@ -44,7 +44,7 @@ /* make_attr - serialize attribute list */ -VSTRING *make_attr(ATTR_VPRINT_COMMON_FN vprint_fn, int flags, ...) +VSTRING *make_attr(ATTR_VPRINT_COMMON_FN vprint_fn, int flags,...) { static const char myname[] = "make_attr"; VSTRING *res = vstring_alloc(100); diff --git a/postfix/src/testing/match_basic.c b/postfix/src/testing/match_basic.c index ee401dff3..892f10385 100644 --- a/postfix/src/testing/match_basic.c +++ b/postfix/src/testing/match_basic.c @@ -187,13 +187,13 @@ int _eq_str(const char *file, int line, PTEST_CTX *t, const char *what, const char *got, const char *want) { if (got == 0 && want == 0) { - return (1); + return (1); } else if (got == 0 || want == 0) { - if (t) - ptest_error(t, "%s:%d: %s: got '%s', want '%s'", - file, line, what, STR_OR_NULL(got), - STR_OR_NULL(want)); - return (0); + if (t) + ptest_error(t, "%s:%d: %s: got '%s', want '%s'", + file, line, what, STR_OR_NULL(got), + STR_OR_NULL(want)); + return (0); } if (strcmp(got, want) != 0) { if (t) diff --git a/postfix/src/testing/match_basic_test.c b/postfix/src/testing/match_basic_test.c index 042b8806c..0c88529c5 100644 --- a/postfix/src/testing/match_basic_test.c +++ b/postfix/src/testing/match_basic_test.c @@ -23,7 +23,7 @@ #include typedef struct PTEST_CASE { - const char *testname; /* Human-readable description */ + const char *testname; /* Human-readable description */ void (*action) (PTEST_CTX *t, const struct PTEST_CASE *); } PTEST_CASE; @@ -68,8 +68,8 @@ static const char *flags_to_string(VSTRING *buf, int flags) static void test_eq_flags(PTEST_CTX *t, const PTEST_CASE *unused) { -int got = FLAG_ONE; -int want = FLAG_ONE | FLAG_TWO; + int got = FLAG_ONE; + int want = FLAG_ONE | FLAG_TWO; expect_ptest_error(t, "got 'one', want 'one|two'"); if (eq_flags(t, "flags", got, want, flags_to_string) diff --git a/postfix/src/testing/mock_dns_lookup.c b/postfix/src/testing/mock_dns_lookup.c index 286d3cab7..d70e74898 100644 --- a/postfix/src/testing/mock_dns_lookup.c +++ b/postfix/src/testing/mock_dns_lookup.c @@ -189,7 +189,7 @@ static DNS_RR *full_copy_dns_rrlist(DNS_RR *list) DNS_RR *make_dns_rr(const char *qname, const char *rname, unsigned type, unsigned class, unsigned ttl, unsigned dnssec_valid, unsigned pref, - unsigned weight, unsigned port, + unsigned weight, unsigned port, void *data, size_t data_len) { DNS_RR *rr; diff --git a/postfix/src/testing/mock_myaddrinfo_test.c b/postfix/src/testing/mock_myaddrinfo_test.c index 216fa0be3..9d0173286 100644 --- a/postfix/src/testing/mock_myaddrinfo_test.c +++ b/postfix/src/testing/mock_myaddrinfo_test.c @@ -75,7 +75,7 @@ static void test_hostname_to_sockaddr_failure(PTEST_CTX *t, * The missing expectation is intentional. Do not count this as an error. */ expect_ptest_error(t, "unexpected call: " - "hostname_to_sockaddr_pf(\"notexist\", 0, \"smtp\", "); + "hostname_to_sockaddr_pf(\"notexist\", 0, \"smtp\", "); /* * Invoke the mock and verify results. diff --git a/postfix/src/testing/mock_servent.h b/postfix/src/testing/mock_servent.h index 4860c6d28..f9b0767bf 100644 --- a/postfix/src/testing/mock_servent.h +++ b/postfix/src/testing/mock_servent.h @@ -48,7 +48,7 @@ extern void _expect_endservent(const char *, int, int); */ #define eq_servent(...) _eq_servent(__FILE__, __LINE__, __VA_ARGS__) -extern int _eq_servent(const char *, int,PTEST_CTX *, +extern int _eq_servent(const char *, int, PTEST_CTX *, const char *, struct servent *, struct servent *); diff --git a/postfix/src/testing/mock_server.c b/postfix/src/testing/mock_server.c index 458674498..04475cfef 100644 --- a/postfix/src/testing/mock_server.c +++ b/postfix/src/testing/mock_server.c @@ -251,8 +251,8 @@ static void mock_server_read_event(int event, void *context) /* mock_server_interact - set up request and/or response */ void mock_server_interact(MOCK_SERVER *mp, - const VSTRING *req, - const VSTRING *resp) + const VSTRING *req, + const VSTRING *resp) { const char myname[] = "mock_server_interact"; diff --git a/postfix/src/testing/mock_server.h b/postfix/src/testing/mock_server.h index c97d63449..8f0463891 100644 --- a/postfix/src/testing/mock_server.h +++ b/postfix/src/testing/mock_server.h @@ -27,15 +27,15 @@ typedef struct MOCK_SERVER { VSTRING *want_req; /* serialized request, may be null */ VSTRING *resp; /* serialized response, may be null */ VSTRING *iobuf; /* I/O buffer */ - struct MOCK_SERVER *next; /* chain of unconnected servers */ - struct MOCK_SERVER *prev; /* chain of unconnected servers */ + struct MOCK_SERVER *next; /* chain of unconnected servers */ + struct MOCK_SERVER *prev; /* chain of unconnected servers */ } MOCK_SERVER; #define MOCK_SERVER_FLAG_CONNECTED (1<<0) extern MOCK_SERVER *mock_unix_server_create(const char *); extern void mock_server_interact(MOCK_SERVER *, const VSTRING *, - const VSTRING *); + const VSTRING *); extern void mock_server_free(MOCK_SERVER *); extern void mock_server_free_void_ptr(void *); diff --git a/postfix/src/testing/mock_server_test.c b/postfix/src/testing/mock_server_test.c index 2f22ec43b..82d5c0198 100644 --- a/postfix/src/testing/mock_server_test.c +++ b/postfix/src/testing/mock_server_test.c @@ -226,17 +226,17 @@ static void test_request_mismatch(PTEST_CTX *t, const PTEST_CASE *tp) REQUEST_READ_EVENT(session_state.fd, read_event, &session_state, 1); event_loop(1); if (session_state.error != 0) { - /* already reported */ + /* already reported */ } else if (VSTRING_LEN(session_state.resp_buf) != strlen(REQUEST_VAL)) { - ptest_error(t, "got resp_buf length %ld, want %ld", - (long) VSTRING_LEN(session_state.resp_buf), - (long) strlen(REQUEST_VAL)); + ptest_error(t, "got resp_buf length %ld, want %ld", + (long) VSTRING_LEN(session_state.resp_buf), + (long) strlen(REQUEST_VAL)); } else if (session_state.resp_len != strlen(REQUEST_VAL)) { - ptest_error(t, "got resp_len %d, want %ld", - session_state.resp_len, (long) strlen(REQUEST_VAL)); + ptest_error(t, "got resp_len %d, want %ld", + session_state.resp_len, (long) strlen(REQUEST_VAL)); } else if (strcmp(vstring_str(session_state.resp_buf), REQUEST_VAL) != 0) { - ptest_error(t, "got resp_buf '%s', want '%s'", - vstring_str(session_state.resp_buf), REQUEST_VAL); + ptest_error(t, "got resp_buf '%s', want '%s'", + vstring_str(session_state.resp_buf), REQUEST_VAL); } /* @@ -318,17 +318,17 @@ static void test_server_speaks_only(PTEST_CTX *t, const PTEST_CASE *tp) REQUEST_READ_EVENT(session_state.fd, read_event, &session_state, 1); event_loop(1); if (session_state.error != 0) { - /* already reported */ + /* already reported */ } else if (VSTRING_LEN(session_state.resp_buf) != strlen(REQUEST_VAL)) { - ptest_error(t, "got resp_buf length %ld, want %ld", - (long) VSTRING_LEN(session_state.resp_buf), - (long) strlen(REQUEST_VAL)); + ptest_error(t, "got resp_buf length %ld, want %ld", + (long) VSTRING_LEN(session_state.resp_buf), + (long) strlen(REQUEST_VAL)); } else if (session_state.resp_len != strlen(REQUEST_VAL)) { - ptest_error(t, "got resp_len %d, want %ld", - session_state.resp_len, (long) strlen(REQUEST_VAL)); + ptest_error(t, "got resp_len %d, want %ld", + session_state.resp_len, (long) strlen(REQUEST_VAL)); } else if (strcmp(vstring_str(session_state.resp_buf), REQUEST_VAL) != 0) { - ptest_error(t, "got resp_buf '%s', wamt '%s'", - vstring_str(session_state.resp_buf), REQUEST_VAL); + ptest_error(t, "got resp_buf '%s', wamt '%s'", + vstring_str(session_state.resp_buf), REQUEST_VAL); } /* diff --git a/postfix/src/testing/mock_stat.c b/postfix/src/testing/mock_stat.c index 8690d2195..4296d9cf2 100644 --- a/postfix/src/testing/mock_stat.c +++ b/postfix/src/testing/mock_stat.c @@ -97,7 +97,8 @@ void teardown_mock_stat(void) /* stat - mock stat() implementation */ -int stat(const char *path, struct stat *st) { +int stat(const char *path, struct stat * st) +{ MOCK_STAT_REQ *mock_info; if ((mock_info = (MOCK_STAT_REQ *) htable_find(mock_stat_table, path)) == 0) diff --git a/postfix/src/tls/tls.h b/postfix/src/tls/tls.h index 80f4bc57e..60c9cc53f 100644 --- a/postfix/src/tls/tls.h +++ b/postfix/src/tls/tls.h @@ -609,7 +609,7 @@ typedef struct { const char *cipher_exclusions; const char *mdalg; /* default message digest algorithm */ int trace_size_limit; /* TLS protocol trace size limit */ - BIO *(*trace_open) (void *, const char *); /* override dest */ + BIO *(*trace_open) (void *, const char *); /* override dest */ void *trace_arg; /* opaque trace_open argument */ char *trace_peer; /* Printable peer IP address */ } TLS_SERVER_START_PROPS; diff --git a/postfix/src/tls/tls_misc.c b/postfix/src/tls/tls_misc.c index 1c5a5a6aa..7ee92bedd 100644 --- a/postfix/src/tls/tls_misc.c +++ b/postfix/src/tls/tls_misc.c @@ -616,8 +616,8 @@ int tls_log_mask(const char *log_param, const char *log_level) msg_warn("%s: ignoring \"trace\" log level: " "SSL_trace() is not available in this build", log_param); - mask &= ~TLS_LOG_TRACE; } + mask &= ~TLS_LOG_TRACE; /* Never used */ } #endif return (mask); @@ -635,8 +635,8 @@ void tls_msg_callback(int write_p, int version, int content_type, BIO *bio = TLScontext->trace_bio; /* - * trace_size_limit <= 0 means either tracing is off (never started) - * or we already crossed the budget and emitted the truncation marker. + * trace_size_limit <= 0 means either tracing is off (never started) or + * we already crossed the budget and emitted the truncation marker. * Either way, do not write further. */ if (bio == 0 || TLScontext->trace_size_limit <= 0) @@ -666,14 +666,14 @@ bool tls_trace_rate_ok(int tls_trace_rate_limit) if (anvil_clnt_tlstr(client, "any", "any", &rate) == ANVIL_STAT_OK) { ret = rate <= tls_trace_rate_limit; } else { - ret = true; + ret = false; } anvil_clnt_free(client); } else { ret = true; } return (ret); -} +} /* tls_trace_create_qfile - default trace destination for daemons */ @@ -700,7 +700,7 @@ BIO *tls_trace_create_qfile(const char *trace_peer) /* tls_trace_create_file - trace destination for CLI or daemon */ -BIO *tls_trace_create_file(VSTRING *path, const char *trace_peer) +BIO *tls_trace_create_file(VSTRING *path, const char *trace_peer) { struct timeval tv; struct tm *lt; @@ -1557,22 +1557,21 @@ void tls_free_context(TLS_SESS_STATE *TLScontext) /* * Release the protocol trace, if one was opened. Order matters: - * SSL_free() above can still drive the message callback during - * teardown (close-notify processing in particular), so trace_bio - * must stay valid until after SSL_free() returns. Closing it - * first would let tls_msg_callback() write through a freed BIO. - * + * SSL_free() above can still drive the message callback during teardown + * (close-notify processing in particular), so trace_bio must stay valid + * until after SSL_free() returns. Closing it first would let + * tls_msg_callback() write through a freed BIO. + * * Always BIO_flush() before close, so any stdio buffering inside * BIO_new_fp() lands on disk before the FILE * is fclose()d. An - * application override may release the BIO; otherwise BIO_free_all - * walks the chain and (with BIO_CLOSE) closes the underlying file. + * application override may release the BIO; otherwise BIO_free_all walks + * the chain and (with BIO_CLOSE) closes the underlying file. */ if (TLScontext->trace_bio != 0) { (void) BIO_flush(TLScontext->trace_bio); BIO_free_all(TLScontext->trace_bio); TLScontext->trace_bio = 0; } - if (TLScontext->namaddr) myfree(TLScontext->namaddr); if (TLScontext->serverid) diff --git a/postfix/src/tls/tls_proxy_client_init_proto_test.c b/postfix/src/tls/tls_proxy_client_init_proto_test.c index 1fbd6438d..dcab45603 100644 --- a/postfix/src/tls/tls_proxy_client_init_proto_test.c +++ b/postfix/src/tls/tls_proxy_client_init_proto_test.c @@ -175,7 +175,7 @@ static void test_tls_proxy_client_init_serialize(PTEST_CTX *t, (void) eq_attr(t, "tls_proxy_client_init_serialize", got_serialized_init_props, ref_serialized_init_props); #else - ptest_skip(t); + ptest_skip(t); #endif } @@ -212,7 +212,7 @@ static void test_tls_proxy_client_init_from_string(PTEST_CTX *t, vstring_free(ref_serialized_init_props); vstring_free(got_serialized_init_props); #else - ptest_skip(t); + ptest_skip(t); #endif } diff --git a/postfix/src/tls/tls_proxy_client_param_proto_test.c b/postfix/src/tls/tls_proxy_client_param_proto_test.c index 190800b1a..5ec6caa02 100644 --- a/postfix/src/tls/tls_proxy_client_param_proto_test.c +++ b/postfix/src/tls/tls_proxy_client_param_proto_test.c @@ -158,13 +158,13 @@ static VSTRING *setup_reference_serialized_params(TLS_CLIENT_PARAMS *params) SEND_ATTR_INT(VAR_TLS_DAEMON_RAND_BYTES, params->tls_daemon_rand_bytes), SEND_ATTR_INT(VAR_TLS_APPEND_DEF_CA, - params->tls_append_def_CA), + params->tls_append_def_CA), SEND_ATTR_INT(VAR_TLS_PREEMPT_CLIST, - params->tls_preempt_clist), + params->tls_preempt_clist), SEND_ATTR_INT(VAR_TLS_MULTI_WILDCARD, - params->tls_multi_wildcard), + params->tls_multi_wildcard), SEND_ATTR_INT(VAR_TLS_FAST_SHUTDOWN, - params->tls_fast_shutdown), + params->tls_fast_shutdown), ATTR_TYPE_END)); } @@ -194,7 +194,7 @@ static void test_tls_proxy_client_param_serialize(PTEST_CTX *t, (void) eq_attr(t, "tls_proxy_client_param_serialize", got_serialized_params, ref_serialized_params); #else - ptest_skip(t); + ptest_skip(t); #endif } @@ -233,7 +233,7 @@ static void test_tls_proxy_client_param_from_config(PTEST_CTX *t, vstring_free(want_client_params_serialized); vstring_free(got_client_params_serialized); #else - ptest_skip(t); + ptest_skip(t); #endif } @@ -270,7 +270,7 @@ static void test_tls_proxy_client_param_from_string(PTEST_CTX *t, vstring_free(ref_serialized_params); vstring_free(got_serialized_params); #else - ptest_skip(t); + ptest_skip(t); #endif } diff --git a/postfix/src/tls/tls_proxy_server_init_proto.c b/postfix/src/tls/tls_proxy_server_init_proto.c index f4cb7caa2..219ea3912 100644 --- a/postfix/src/tls/tls_proxy_server_init_proto.c +++ b/postfix/src/tls/tls_proxy_server_init_proto.c @@ -125,20 +125,20 @@ char *tls_proxy_server_init_serialize(ATTR_PRINT_COMMON_FN print_fn, /* tls_proxy_server_init_from_string - deserialize TLS_SERVER_INIT_PROPS */ TLS_SERVER_INIT_PROPS *tls_proxy_server_init_from_string( - ATTR_SCAN_COMMON_FN scan_fn, - VSTRING *buf) + ATTR_SCAN_COMMON_FN scan_fn, + VSTRING *buf) { const char myname[] = "tls_proxy_server_init_from_string"; TLS_SERVER_INIT_PROPS *props = 0; VSTREAM *mp; if ((mp = vstream_memopen(buf, O_RDONLY)) == 0 - || scan_fn(mp, ATTR_FLAG_NONE, - RECV_ATTR_FUNC(tls_proxy_server_init_scan, - (void *) &props), - ATTR_TYPE_END) != 1 - || vstream_fclose(mp) != 0) - msg_fatal("%s: can't deserialize properties: %m", myname); + || scan_fn(mp, ATTR_FLAG_NONE, + RECV_ATTR_FUNC(tls_proxy_server_init_scan, + (void *) &props), + ATTR_TYPE_END) != 1 + || vstream_fclose(mp) != 0) + msg_fatal("%s: can't deserialize properties: %m", myname); return (props); } diff --git a/postfix/src/tls/tls_proxy_server_init_proto_test.c b/postfix/src/tls/tls_proxy_server_init_proto_test.c index 84363ca62..519619d1e 100644 --- a/postfix/src/tls/tls_proxy_server_init_proto_test.c +++ b/postfix/src/tls/tls_proxy_server_init_proto_test.c @@ -61,7 +61,7 @@ typedef struct PTEST_CASE { char *var_smtpd_tls_loglevel; int var_smtpd_tls_ccert_vd; static char *cache_type; -bool var_smtpd_tls_set_sessid; +bool var_smtpd_tls_set_sessid; char *var_smtpd_tls_chain_files; char *var_smtpd_tls_cert_file; char *var_smtpd_tls_key_file; @@ -98,7 +98,7 @@ static void init_global_params(void) var_smtpd_tls_eecdh = DEF_SMTPD_TLS_EECDH; var_smtpd_tls_proto = DEF_SMTPD_TLS_PROTO; ask_ccert = 1, - var_smtpd_tls_fpt_dgst = DEF_SMTPD_TLS_FPT_DGST; + var_smtpd_tls_fpt_dgst = DEF_SMTPD_TLS_FPT_DGST; } static void setup_reference_unserialized_init_props(TLS_SERVER_INIT_PROPS *props) @@ -205,7 +205,7 @@ static void test_tls_proxy_server_init_serialize(PTEST_CTX *t, (void) eq_attr(t, "tls_proxy_server_init_serialize", got_serialized_init_props, ref_serialized_init_props); #else - ptest_skip(t); + ptest_skip(t); #endif } @@ -242,7 +242,7 @@ static void test_tls_proxy_server_init_from_string(PTEST_CTX *t, vstring_free(ref_serialized_init_props); vstring_free(got_serialized_init_props); #else - ptest_skip(t); + ptest_skip(t); #endif } diff --git a/postfix/src/tls/tls_proxy_server_param_proto_test.c b/postfix/src/tls/tls_proxy_server_param_proto_test.c index c68be0ef4..1423442f8 100644 --- a/postfix/src/tls/tls_proxy_server_param_proto_test.c +++ b/postfix/src/tls/tls_proxy_server_param_proto_test.c @@ -198,7 +198,7 @@ static void test_tls_proxy_server_param_serialize(PTEST_CTX *t, (void) eq_attr(t, "tls_proxy_server_param_serialize", got_serialized_params, ref_serialized_params); #else - ptest_skip(t); + ptest_skip(t); #endif } @@ -237,7 +237,7 @@ static void test_tls_proxy_server_param_from_config(PTEST_CTX *t, vstring_free(want_server_params_serialized); vstring_free(got_server_params_serialized); #else - ptest_skip(t); + ptest_skip(t); #endif } @@ -274,7 +274,7 @@ static void test_tls_proxy_server_param_from_string(PTEST_CTX *t, vstring_free(ref_serialized_params); vstring_free(got_serialized_params); #else - ptest_skip(t); + ptest_skip(t); #endif } diff --git a/postfix/src/tls/tls_verify.c b/postfix/src/tls/tls_verify.c index e6ff29ff1..089acb993 100644 --- a/postfix/src/tls/tls_verify.c +++ b/postfix/src/tls/tls_verify.c @@ -121,7 +121,7 @@ /* update_error_state - safely stash away error state */ static void update_error_state(X509_STORE_CTX *ctx, TLS_SESS_STATE *TLScontext, - int depth, const X509 *errorcert, int errorcode) + int depth, const X509 *errorcert, int errorcode) { /* @@ -150,7 +150,7 @@ static void update_error_state(X509_STORE_CTX *ctx, TLS_SESS_STATE *TLScontext, if (TLScontext->errorcert != 0) X509_free((X509 *) TLScontext->errorcert); if (errorcert != 0) - X509_up_ref((X509 *) errorcert); + X509_up_ref((X509 *) errorcert); TLScontext->errorcert = errorcert; TLScontext->errorcode = errorcode; TLScontext->errordepth = depth; diff --git a/postfix/src/tlsproxy/tlsproxy_diff.c b/postfix/src/tlsproxy/tlsproxy_diff.c index a9d057713..6f1db0d6f 100644 --- a/postfix/src/tlsproxy/tlsproxy_diff.c +++ b/postfix/src/tlsproxy/tlsproxy_diff.c @@ -28,12 +28,12 @@ /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA -/* +/* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA -/* +/* /* Wietse Venema /* porcupine.org /*--*/ diff --git a/postfix/src/util/argv.c b/postfix/src/util/argv.c index 8bc412f18..406e0d495 100644 --- a/postfix/src/util/argv.c +++ b/postfix/src/util/argv.c @@ -417,7 +417,7 @@ void argv_delete(ARGV *argvp, ssize_t first, ssize_t how_many) /* * Sanity check. 202604 Claude: avoid expression 'first + how_many'. */ - if (first < 0 || how_many < 0 || first > argvp->argc + if (first < 0 || how_many < 0 || first > argvp->argc || how_many > argvp->argc - first) msg_panic("argv_delete bad range: (start=%ld count=%ld)", (long) first, (long) how_many); diff --git a/postfix/src/util/argv.h b/postfix/src/util/argv.h index 0de769daf..0b7fe46f2 100644 --- a/postfix/src/util/argv.h +++ b/postfix/src/util/argv.h @@ -27,8 +27,10 @@ extern ARGV *argv_sort(ARGV *); /* backwards compatibility */ extern ARGV *argv_qsort(ARGV *, ARGV_COMPAR_FN); extern ARGV *argv_uniq(ARGV *, ARGV_COMPAR_FN); extern void argv_add(ARGV *,...); + #if 0 extern void argv_addn(ARGV *,...); + #endif extern ARGV *argv_addv(ARGV *, const char *const *); extern void argv_terminate(ARGV *); diff --git a/postfix/src/util/dict.h b/postfix/src/util/dict.h index 1ca8b7f62..4a39170c5 100644 --- a/postfix/src/util/dict.h +++ b/postfix/src/util/dict.h @@ -314,7 +314,7 @@ extern const char *dict_file_lookup(DICT *dict, const char *); * dict_stream(3) */ extern VSTREAM *dict_stream_open(const char *dict_type, const char *mapname, - int open_flags, int dict_flags, struct stat *st, VSTRING **why); + int open_flags, int dict_flags, struct stat * st, VSTRING **why); /* LICENSE /* .ad diff --git a/postfix/src/util/dict_open.c b/postfix/src/util/dict_open.c index 80b621780..8771a17a7 100644 --- a/postfix/src/util/dict_open.c +++ b/postfix/src/util/dict_open.c @@ -485,7 +485,7 @@ DICT *dict_open(const char *dict_spec, int open_flags, int dict_flags) char *dict_name; DICT *dict; - if ((dict_name = split_at(saved_dict_spec, ':')) == 0 + if ((dict_name = split_at(saved_dict_spec, ':')) == 0 || *saved_dict_spec == 0 || *dict_name == 0) { dict = dict_surrogate(dict_spec, "", open_flags, dict_flags, "open dictionary: expecting \"type:name\" form instead of \"%s\"", @@ -695,8 +695,8 @@ static void init_dynamic_maps(void) if (dict_load_file_xt(TEST_DICT, TEST_CONF_PATH) == 0) msg_fatal("open %s: %m", TEST_CONF_PATH); if ((meta_dir = dict_lookup(TEST_DICT, META_DIR_KEY)) == 0 - || (shlib_dir = dict_lookup(TEST_DICT, SHLIB_DIR_KEY)) == 0) - msg_fatal("unusable file: %s", TEST_CONF_PATH); + || (shlib_dir = dict_lookup(TEST_DICT, SHLIB_DIR_KEY)) == 0) + msg_fatal("unusable file: %s", TEST_CONF_PATH); path = concatenate(meta_dir, "/", "dynamicmaps.cf", #ifdef SHLIB_VERSION ".", SHLIB_VERSION, diff --git a/postfix/src/util/dynamicmaps.c b/postfix/src/util/dynamicmaps.c index 9aa7779d6..f1b794ac5 100644 --- a/postfix/src/util/dynamicmaps.c +++ b/postfix/src/util/dynamicmaps.c @@ -149,7 +149,7 @@ static const DICT_OPEN_INFO *dymap_dict_lookup(const char *dict_type) dict_type, dict_type); return (0); } - if (stat (dp->soname, &st) < 0) { + if (stat(dp->soname, &st) < 0) { msg_warn("unsupported dictionary type: %s (%s: %m)", dict_type, dp->soname); return (0); diff --git a/postfix/src/util/inet_connect.c b/postfix/src/util/inet_connect.c index 0f5542e94..02a3962ad 100644 --- a/postfix/src/util/inet_connect.c +++ b/postfix/src/util/inet_connect.c @@ -143,7 +143,7 @@ int inet_connect(const char *addr, int block_mode, int timeout) /* inet_connect_one - try to connect to one address */ -static int inet_connect_one(struct addrinfo * res, int block_mode, int timeout) +static int inet_connect_one(struct addrinfo *res, int block_mode, int timeout) { int sock; diff --git a/postfix/src/util/myaddrinfo.c b/postfix/src/util/myaddrinfo.c index 3ba09c3e3..a6f382428 100644 --- a/postfix/src/util/myaddrinfo.c +++ b/postfix/src/util/myaddrinfo.c @@ -301,7 +301,7 @@ static int find_service(const char *service, int socktype) int hostname_to_sockaddr_pf(const char *hostname, int pf, const char *service, int socktype, - struct addrinfo ** res) + struct addrinfo **res) { #ifdef EMULATE_IPV4_ADDRINFO @@ -475,7 +475,7 @@ int hostname_to_sockaddr_pf(const char *hostname, int pf, /* hostaddr_to_sockaddr - printable address to binary address form */ int hostaddr_to_sockaddr(const char *hostaddr, const char *service, - int socktype, struct addrinfo ** res) + int socktype, struct addrinfo **res) { #ifdef EMULATE_IPV4_ADDRINFO @@ -757,7 +757,7 @@ void myaddrinfo_control(int name,...) /* freeaddrinfo - release storage */ -void freeaddrinfo(struct addrinfo * ai) +void freeaddrinfo(struct addrinfo *ai) { struct addrinfo *ap; struct addrinfo *next; diff --git a/postfix/src/util/mystrtok_test.c b/postfix/src/util/mystrtok_test.c index 0aaf7fa0a..93a5a53de 100644 --- a/postfix/src/util/mystrtok_test.c +++ b/postfix/src/util/mystrtok_test.c @@ -62,7 +62,7 @@ static void test_mystrtok(PTEST_CTX *t, const PTEST_CASE *unused) char *cp = saved_input; int n; - for (n = 0; /* See below */; n++) { + for (n = 0; /* See below */ ; n++) { got = mystrtok(&cp, CHARS_SPACE); if (!match_one(t, got, tp->want[n]) || got == 0) break; @@ -94,7 +94,7 @@ static void test_mystrtokq(PTEST_CTX *t, const PTEST_CASE *unused) char *cp = saved_input; int n; - for (n = 0; /* See below */; n++) { + for (n = 0; /* See below */ ; n++) { got = mystrtokq(&cp, CHARS_SPACE, CHARS_BRACE); if (!match_one(t, got, tp->want[n]) || got == 0) break; @@ -126,7 +126,7 @@ static void test_mystrtokdq(PTEST_CTX *t, const PTEST_CASE *unused) char *cp = saved_input; int n; - for (n = 0; /* See below */; n++) { + for (n = 0; /* See below */ ; n++) { got = mystrtokdq(&cp, CHARS_SPACE); if (!match_one(t, got, tp->want[n]) || got == 0) break; @@ -157,7 +157,7 @@ static void test_mystrtok_cw(PTEST_CTX *t, const PTEST_CASE *unused) expect_ptest_log_event(t, "#comment after other text is not allowed"); - for (n = 0; /* See below */; n++) { + for (n = 0; /* See below */ ; n++) { got = mystrtok_cw(&cp, CHARS_SPACE, "test"); if (!match_one(t, got, tp->want[n]) || got == 0) break; @@ -188,7 +188,7 @@ static void test_mystrtokq_cw(PTEST_CTX *t, const PTEST_CASE *unused) expect_ptest_log_event(t, "#comment after other text is not allowed"); - for (n = 0; /* See below */; n++) { + for (n = 0; /* See below */ ; n++) { got = mystrtokq_cw(&cp, CHARS_SPACE, CHARS_BRACE, "test"); if (!match_one(t, got, tp->want[n]) || got == 0) break; @@ -219,7 +219,7 @@ static void test_mystrtokdq_cw(PTEST_CTX *t, const PTEST_CASE *unused) expect_ptest_log_event(t, "#comment after other text is not allowed"); - for (n = 0; /* See below */; n++) { + for (n = 0; /* See below */ ; n++) { got = mystrtokdq_cw(&cp, CHARS_SPACE, "test"); if (!match_one(t, got, tp->want[n]) || got == 0) break; diff --git a/postfix/src/util/sunos5_stream_test.c b/postfix/src/util/sunos5_stream_test.c index 5c8f82fa4..3a6540742 100644 --- a/postfix/src/util/sunos5_stream_test.c +++ b/postfix/src/util/sunos5_stream_test.c @@ -103,9 +103,11 @@ int main(int argc, char **argv) msg_fatal("close server fd"); return (0); } + #else int main(int argc, char **argv) { return (0); } + #endif diff --git a/postfix/src/util/wrap_netdb.h b/postfix/src/util/wrap_netdb.h index 3e49e7a0d..250345ec9 100644 --- a/postfix/src/util/wrap_netdb.h +++ b/postfix/src/util/wrap_netdb.h @@ -22,11 +22,11 @@ */ #ifndef NO_MOCK_WRAPPERS extern int wrap_getaddrinfo(const char *, const char *, - const struct addrinfo *, - struct addrinfo **); + const struct addrinfo *, + struct addrinfo **); extern void wrap_freeaddrinfo(struct addrinfo *); extern int wrap_getnameinfo(const struct sockaddr *, socklen_t, char *, - size_t, char *, size_t, int); + size_t, char *, size_t, int); #define getaddrinfo wrap_getaddrinfo #define freeaddrinfo wrap_freeaddrinfo diff --git a/postfix/src/util/wrap_stat.c b/postfix/src/util/wrap_stat.c index 321913a05..340178f1f 100644 --- a/postfix/src/util/wrap_stat.c +++ b/postfix/src/util/wrap_stat.c @@ -44,15 +44,15 @@ /* wrap_stat - mockable wrapper */ -int wrap_stat(const char *path, struct stat *st) +int wrap_stat(const char *path, struct stat * st) { #undef stat - return (stat (path, st)); + return (stat(path, st)); } /* wrap_lstat - mockable wrapper */ -int wrap_lstat(const char *path, struct stat *st) +int wrap_lstat(const char *path, struct stat * st) { #undef lstat return (lstat(path, st));