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