xref: /netbsd-src/external/ibm-public/postfix/dist/src/global/mail_version.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 /*	$NetBSD: mail_version.h,v 1.1.1.20 2014/01/18 17:04:17 tron Exp $	*/
2 
3 #ifndef _MAIL_VERSION_H_INCLUDED_
4 #define _MAIL_VERSION_H_INCLUDED_
5 
6 /*++
7 /* NAME
8 /*	mail_version 3h
9 /* SUMMARY
10 /*	globally configurable parameters
11 /* SYNOPSIS
12 /*	#include <mail_version.h>
13 /* DESCRIPTION
14 /* .nf
15 
16  /*
17   * Version of this program. Official versions are called a.b.c, and
18   * snapshots are called a.b-yyyymmdd, where a=major release number, b=minor
19   * release number, c=patchlevel, and yyyymmdd is the release date:
20   * yyyy=year, mm=month, dd=day.
21   *
22   * Patches change both the patchlevel and the release date. Snapshots have no
23   * patchlevel; they change the release date only.
24   */
25 #define MAIL_RELEASE_DATE	"20140116"
26 #define MAIL_VERSION_NUMBER	"2.10.3"
27 
28 #ifdef SNAPSHOT
29 # define MAIL_VERSION_DATE	"-" MAIL_RELEASE_DATE
30 #else
31 # define MAIL_VERSION_DATE	""
32 #endif
33 
34 #ifdef NONPROD
35 # define MAIL_VERSION_PROD	"-nonprod"
36 #else
37 # define MAIL_VERSION_PROD	""
38 #endif
39 
40 #define VAR_MAIL_VERSION	"mail_version"
41 #define DEF_MAIL_VERSION	MAIL_VERSION_NUMBER MAIL_VERSION_DATE MAIL_VERSION_PROD
42 
43 extern char *var_mail_version;
44 
45  /*
46   * Release date.
47   */
48 #define VAR_MAIL_RELEASE	"mail_release_date"
49 #define DEF_MAIL_RELEASE	MAIL_RELEASE_DATE
50 extern char *var_mail_release;
51 
52  /*
53   * The following macros stamp executable files as well as core dumps. This
54   * information helps to answer the following questions:
55   *
56   * - What Postfix versions(s) are installed on this machine?
57   *
58   * - Is this installation mixing multiple Postfix versions?
59   *
60   * - What Postfix version generated this core dump?
61   *
62   * To find out: strings -f file... | grep mail_version=
63   */
64 #include <string.h>
65 
66 #define MAIL_VERSION_STAMP_DECLARE \
67     char *mail_version_stamp
68 
69 #define MAIL_VERSION_STAMP_ALLOCATE \
70     mail_version_stamp = strdup(VAR_MAIL_VERSION "=" DEF_MAIL_VERSION)
71 
72  /*
73   * Mail version string parser, plus support to compare the compile-time
74   * version string of a Postfix program with the run-time version string of a
75   * Postfix shared library. When programs are not updated, they may fail in
76   * erratic ways when linked against a newer run-time library. Of course the
77   * right solution is so-number versioning of the Postfix run-time library.
78   */
79 typedef struct {
80     char   *program;			/* postfix */
81     int     major;			/* 2 */
82     int     minor;			/* 9 */
83     int     patch;			/* null */
84     char   *snapshot;			/* 20111209-nonprod */
85 } MAIL_VERSION;
86 
87 extern MAIL_VERSION *mail_version_parse(const char *, const char **);
88 extern void mail_version_free(MAIL_VERSION *);
89 extern const char *get_mail_version(void);
90 extern void check_mail_version(const char *);
91 
92 #define MAIL_VERSION_CHECK \
93     check_mail_version(DEF_MAIL_VERSION)
94 
95 /* LICENSE
96 /* .ad
97 /* .fi
98 /*	The Secure Mailer license must be distributed with this software.
99 /* AUTHOR(S)
100 /*	Wietse Venema
101 /*	IBM T.J. Watson Research
102 /*	P.O. Box 704
103 /*	Yorktown Heights, NY 10598, USA
104 /*--*/
105 
106 #endif
107