Skip to content

Commit 1da33bb

Browse files
authored
Merge pull request trusteddomainproject#372 from thegushi/feature/verbose-version
opendmarc -V: show configure args, git hash, and clarify SPF backend
2 parents 346a8fb + 60f411b commit 1da33bb

3 files changed

Lines changed: 30 additions & 10 deletions

File tree

configure.ac

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ AC_CHECK_TYPES([ns_type], [], [], [[
6666
#include <resolv.h>
6767
]])
6868

69+
#
70+
# Version string: use git describe on dev builds for a hash suffix
71+
#
72+
AC_CHECK_PROG([GIT], [git], [git])
73+
AC_MSG_CHECKING([build version string])
74+
DMARCF_VERSION=$PACKAGE_VERSION
75+
if test -n "$GIT" && $GIT describe --tags --dirty >/dev/null 2>&1; then
76+
_git_ver=$($GIT describe --tags --dirty)
77+
_git_ver=${_git_ver#v}
78+
if test "$_git_ver" != "$PACKAGE_VERSION"; then
79+
DMARCF_VERSION=$_git_ver
80+
fi
81+
fi
82+
AC_MSG_RESULT([$DMARCF_VERSION])
83+
AC_DEFINE_UNQUOTED([DMARCF_VERSION], ["$DMARCF_VERSION"],
84+
[Version string, including git hash on development builds])
85+
6986
#
7087
# Hexadecimal version, for use in generating dmarc.h
7188
#
@@ -567,5 +584,7 @@ AC_CONFIG_FILES([ Makefile
567584
reports/opendmarc-reports
568585
reports/opendmarc-reports.8
569586
])
587+
AC_DEFINE_UNQUOTED([CONFIGURE_ARGS], ["$ac_configure_args"],
588+
[Arguments passed to configure])
570589
AC_OUTPUT()
571590
# @end1

opendmarc/opendmarc.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,7 +3482,7 @@ mlfi_eom(SMFICTX *ctx)
34823482

34833483
dmarcf_dstring_printf(dfc->mctx_afrf,
34843484
"User-Agent: %s/%s\n",
3485-
DMARCF_PRODUCTNS, VERSION);
3485+
DMARCF_PRODUCTNS, DMARCF_VERSION);
34863486

34873487
dmarcf_dstring_cat(dfc->mctx_afrf,
34883488
"Auth-Failure: dmarc\n");
@@ -3778,7 +3778,7 @@ mlfi_eom(SMFICTX *ctx)
37783778
if (conf->conf_addswhdr)
37793779
{
37803780
snprintf(header, sizeof header, "%s v%s %s %s",
3781-
DMARCF_PRODUCT, VERSION, hostname,
3781+
DMARCF_PRODUCT, DMARCF_VERSION, hostname,
37823782
dfc->mctx_jobid != NULL ? dfc->mctx_jobid
37833783
: JOBIDUNKNOWN);
37843784

@@ -4291,13 +4291,14 @@ main(int argc, char **argv)
42914291

42924292
case 'V':
42934293
printf("%s: %s v%s\n", progname, DMARCF_PRODUCT,
4294-
VERSION);
4294+
DMARCF_VERSION);
42954295
printf("\tSMFI_VERSION 0x%x\n", SMFI_VERSION);
42964296
#ifdef HAVE_SMFI_VERSION
42974297
(void) smfi_version(&mvmajor, &mvminor, &mvrelease);
42984298
printf("\tlibmilter version %d.%d.%d\n",
42994299
mvmajor, mvminor, mvrelease);
43004300
#endif /* HAVE_SMFI_VERSION */
4301+
printf("\tConfigured with: %s\n", CONFIGURE_ARGS);
43014302
dmarcf_optlist(stdout);
43024303
return EX_OK;
43034304

@@ -5196,7 +5197,7 @@ main(int argc, char **argv)
51965197
}
51975198

51985199
syslog(LOG_INFO, "%s v%s starting%s%s%s", DMARCF_PRODUCT,
5199-
VERSION,
5200+
DMARCF_VERSION,
52005201
strlen(argstr) == 0 ? "" : " (",
52015202
argstr,
52025203
strlen(argstr) == 0 ? "" : ")");
@@ -5256,7 +5257,7 @@ main(int argc, char **argv)
52565257
{
52575258
syslog(LOG_INFO,
52585259
"%s v%s terminating with status %d, errno = %d",
5259-
DMARCF_PRODUCT, VERSION, status, errno);
5260+
DMARCF_PRODUCT, DMARCF_VERSION, status, errno);
52605261
}
52615262

52625263
/* release memory */

opendmarc/util.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ static char *optlist[] =
6969
#endif /* POLL */
7070

7171
#if WITH_SPF
72-
"WITH_SPF",
72+
# if HAVE_SPF2_H
73+
"WITH_SPF (libspf2)",
74+
# else /* HAVE_SPF2_H */
75+
"WITH_SPF (internal)",
76+
# endif /* HAVE_SPF2_H */
7377
#endif /* WITH_SPF */
7478

75-
#if HAVE_SPF2_H
76-
"WITH_SPF2",
77-
#endif /* HAVE_SPF2_H */
78-
7979
NULL
8080
};
8181

0 commit comments

Comments
 (0)