cast tv_usec to long for *printf
authorop <op@openbsd.org>
Fri, 3 Nov 2023 13:38:28 +0000 (13:38 +0000)
committerop <op@openbsd.org>
Fri, 3 Nov 2023 13:38:28 +0000 (13:38 +0000)
mostly for -portable; on darwin suseconds_t is an int.

ok tb@

usr.sbin/smtpd/lka_filter.c
usr.sbin/smtpd/smtp_session.c

index c67b7ba..e53b161 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lka_filter.c,v 1.73 2023/07/07 14:52:00 op Exp $      */
+/*     $OpenBSD: lka_filter.c,v 1.74 2023/11/03 13:38:28 op Exp $      */
 
 /*
  * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -916,13 +916,13 @@ filter_protocol_query(struct filter *filter, uint64_t token, uint64_t reqid, con
                n = io_printf(lka_proc_get_io(filter->proc),
                    "filter|%s|%lld.%06ld|smtp-in|%s|%016"PRIx64"|%016"PRIx64"|%s|%s\n",
                    PROTOCOL_VERSION,
-                   (long long)tv.tv_sec, tv.tv_usec,
+                   (long long)tv.tv_sec, (long)tv.tv_usec,
                    phase, reqid, token, fs->rdns, param);
        else
                n = io_printf(lka_proc_get_io(filter->proc),
                    "filter|%s|%lld.%06ld|smtp-in|%s|%016"PRIx64"|%016"PRIx64"|%s\n",
                    PROTOCOL_VERSION,
-                   (long long)tv.tv_sec, tv.tv_usec,
+                   (long long)tv.tv_sec, (long)tv.tv_usec,
                    phase, reqid, token, param);
        if (n == -1)
                fatalx("failed to write to processor");
@@ -940,7 +940,7 @@ filter_data_query(struct filter *filter, uint64_t token, uint64_t reqid, const c
            "filter|%s|%lld.%06ld|smtp-in|data-line|"
            "%016"PRIx64"|%016"PRIx64"|%s\n",
            PROTOCOL_VERSION,
-           (long long)tv.tv_sec, tv.tv_usec,
+           (long long)tv.tv_sec, (long)tv.tv_usec,
            reqid, token, line);
        if (n == -1)
                fatalx("failed to write to processor");
@@ -1357,7 +1357,7 @@ report_smtp_broadcast(uint64_t reqid, const char *direction, struct timeval *tv,
                va_start(ap, format);
                if (io_printf(lka_proc_get_io(rp->name),
                    "report|%s|%lld.%06ld|%s|%s|%016"PRIx64"%s",
-                   PROTOCOL_VERSION, (long long)tv->tv_sec, tv->tv_usec,
+                   PROTOCOL_VERSION, (long long)tv->tv_sec, (long)tv->tv_usec,
                    direction, event, reqid,
                    format[0] != '\n' ? "|" : "") == -1 ||
                    io_vprintf(lka_proc_get_io(rp->name), format, ap) == -1)
index ca21c5b..7848ece 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: smtp_session.c,v 1.436 2023/10/09 20:55:32 millert Exp $      */
+/*     $OpenBSD: smtp_session.c,v 1.437 2023/11/03 13:38:28 op Exp $   */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -2279,7 +2279,7 @@ smtp_auth_failure_pause(struct smtp_session *s)
        tv.tv_sec = 0;
        tv.tv_usec = arc4random_uniform(1000000);
        log_trace(TRACE_SMTP, "smtp: timing-attack protection triggered, "
-           "will defer answer for %lu microseconds", tv.tv_usec);
+           "will defer answer for %lu microseconds", (long)tv.tv_usec);
        evtimer_set(&s->pause, smtp_auth_failure_resume, s);
        evtimer_add(&s->pause, &tv);
 }