~ubuntu-branches/ubuntu/lucid/exim4/lucid-updates

« back to all changes in this revision

Viewing changes to .pc/50_localscan_dlopen.dpatch/src/local_scan.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-08 11:31:29 UTC
  • Revision ID: james.westby@ubuntu.com-20110208113129-ri8y5c2s6hurn80t
Tags: 4.71-3ubuntu1.1
* SECURITY UPDATE: local privilege escalation via alternate config file
  (LP: #697934)
  - debian/patches/80_CVE-2010-4345.patch: backport massive behaviour-
    altering changes from upstream git to fix issue.
  - debian/patches/81_CVE-2010-4345-docs.patch: backport documentation
    changes.
  - debian/patches/67_unnecessaryCopt.dpatch: Do not use exim's -C option
    in utility scripts. This would not work with ALT_CONFIG_PREFIX.
    Patch obtained from Debian's 4.69-9+lenny2.
  - Build with WHITELIST_D_MACROS=OUTGOING. After this security update,
    exim will not regain root privileges (usually necessary for local
    delivery) if the -D option was used. Macro identifiers listed in
    WHITELIST_D_MACROS are exempted from this restriction. mailscanner
    (4.79.11-2.2) uses -DOUTGOING.
  - Build with TRUSTED_CONFIG_LIST=/etc/exim4/trusted_configs. After this
    security update, exim will not re-gain root privileges (usually
    necessary for local delivery) if the -C option was used. This makes
    it impossible to start a fully functional damon with an alternate
    configuration file. /etc/exim4/trusted_configs (can) contain a list
    of filenames (one per line, full path given) to which this
    restriction does not apply.
  - debian/exim4-daemon-*.NEWS: Add description of changes. Thanks to
    Debian and Andreas Metzler for the text.
  - CVE-2010-4345
* SECURITY UPDATE: arbitrary file append via symlink attack (LP: #708023)
  - debian/patches/82_CVE-2011-0017.patch: check setuid and setgid return
    codes in src/exim.c, src/log.c.
  - CVE-2011-0017
* SECURITY UPDATE: denial of service and possible arbitrary code
  execution via hard link to another user's file (LP: #609620)
  - debian/patches/CVE-2010-2023.patch: check for links in
    src/transports/appendfile.c.
  - CVE-2010-2023
* SECURITY UPDATE: denial of service and possible arbitrary code
  execution via symlink on a lock file (LP: #609620)
  - debian/patches/CVE-2010-2024.patch: improve lock file handling in
    src/exim_lock.c, src/transports/appendfile.c.
  - CVE-2010-2024
* debian/rules: disable debconf-updatepo so the security update doesn't
  alter translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Cambridge: exim/exim-src/src/local_scan.h,v 1.13 2009/11/16 19:50:37 nm4 Exp $ */
 
2
 
 
3
/*************************************************
 
4
*     Exim - an Internet mail transport agent    *
 
5
*************************************************/
 
6
 
 
7
/* Copyright (c) University of Cambridge 1995 - 2009 */
 
8
/* See the file NOTICE for conditions of use and distribution. */
 
9
 
 
10
/* This file is the header that is the only Exim header to be included in the
 
11
source for the local_scan.c() function. It contains definitions that are made
 
12
available for use in that function, and which are documented.
 
13
 
 
14
This API is also used for functions called by the ${dlfunc expansion item. */
 
15
 
 
16
 
 
17
/* Some basic types that make some things easier, the Exim configuration
 
18
settings, and the store functions. */
 
19
 
 
20
#include <stdarg.h>
 
21
#include <sys/types.h>
 
22
#include "config.h"
 
23
#include "mytypes.h"
 
24
#include "store.h"
 
25
 
 
26
 
 
27
/* The function and its return codes. */
 
28
 
 
29
extern int local_scan(int, uschar **);
 
30
 
 
31
enum {
 
32
  LOCAL_SCAN_ACCEPT,              /* Accept */
 
33
  LOCAL_SCAN_ACCEPT_FREEZE,       /* Accept, but freeze */
 
34
  LOCAL_SCAN_ACCEPT_QUEUE,        /* Accept, but no immediate delivery */
 
35
  LOCAL_SCAN_REJECT,              /* Permanent rejection */
 
36
  LOCAL_SCAN_REJECT_NOLOGHDR,     /* Permanent rejection, no log header */
 
37
  LOCAL_SCAN_TEMPREJECT,          /* Temporary rejection */
 
38
  LOCAL_SCAN_TEMPREJECT_NOLOGHDR  /* Temporary rejection, no log header */
 
39
};
 
40
 
 
41
 
 
42
/* Functions called by ${dlfunc{file}{func}{arg}...} return one of the five
 
43
status codes defined immediately below. The function's first argument is either
 
44
the result of expansion, or the error message in case of failure. The second
 
45
and third arguments are standard argument count and vector, comprising the
 
46
{arg} values specified in the expansion item. */
 
47
 
 
48
typedef int exim_dlfunc_t(uschar **yield, int argc, uschar *argv[]);
 
49
 
 
50
 
 
51
/* Return codes from the support functions lss_match_xxx(). These are also the
 
52
codes that dynamically-loaded ${dlfunc functions must return. */
 
53
 
 
54
#define  OK            0          /* Successful match */
 
55
#define  DEFER         1          /* Defer - some problem */
 
56
#define  FAIL          2          /* Matching failed */
 
57
#define  ERROR         3          /* Internal or config error */
 
58
 
 
59
/* Extra return code for ${dlfunc functions */
 
60
 
 
61
#define  FAIL_FORCED   4          /* "Forced" failure */
 
62
 
 
63
 
 
64
/* Available logging destinations */
 
65
 
 
66
#define LOG_MAIN        1    /* Write to the main log */
 
67
#define LOG_PANIC       2    /* Write to the panic log */
 
68
#define LOG_REJECT     16    /* Write to the reject log, with headers */
 
69
 
 
70
 
 
71
/* Accessible debugging bits */
 
72
 
 
73
#define D_v                          0x00000001
 
74
#define D_local_scan                 0x00000002
 
75
 
 
76
 
 
77
/* Option types that can be used for local_scan_options. The boolean ones
 
78
MUST be last so that they are contiguous with the internal boolean specials. */
 
79
 
 
80
enum { opt_stringptr, opt_int, opt_octint, opt_mkint, opt_Kint, opt_fixed,
 
81
  opt_time, opt_bool };
 
82
 
 
83
 
 
84
/* The length of message identification strings. This is the id used internally
 
85
by exim. The external version for use in Received: strings has a leading 'E'
 
86
added to ensure it starts with a letter. */
 
87
 
 
88
#define MESSAGE_ID_LENGTH 16
 
89
 
 
90
/* The offset to the start of the data in the data file - this allows for
 
91
the name of the data file to be present in the first line. */
 
92
 
 
93
#define SPOOL_DATA_START_OFFSET (MESSAGE_ID_LENGTH+3)
 
94
 
 
95
/* Some people (Marc Merlin et al) are maintaining a patch that allows for
 
96
dynamic local_scan() libraries. This code is not yet in Exim proper, but it
 
97
helps the maintainers if we keep their ABI version numbers here. This may
 
98
mutate into more general support later. The major number is increased when the
 
99
ABI is changed in a non backward compatible way. The minor number is increased
 
100
each time a new feature is added (in a way that doesn't break backward
 
101
compatibility). */
 
102
 
 
103
#define LOCAL_SCAN_ABI_VERSION_MAJOR 1
 
104
#define LOCAL_SCAN_ABI_VERSION_MINOR 1
 
105
#define LOCAL_SCAN_ABI_VERSION \
 
106
  LOCAL_SCAN_ABI_VERSION_MAJOR.LOCAL_SCAN_ABI_VERSION_MINOR
 
107
 
 
108
/* Structure definitions that are documented as visible in the function. */
 
109
 
 
110
typedef struct header_line {
 
111
  struct header_line *next;
 
112
  int    type;
 
113
  int    slen;
 
114
  uschar *text;
 
115
} header_line;
 
116
 
 
117
/* Entries in lists options are in this form. */
 
118
 
 
119
typedef struct {
 
120
  char   *name;
 
121
  int     type;
 
122
  void   *value;
 
123
} optionlist;
 
124
 
 
125
/*Structure for holding information about an envelope address. The errors_to
 
126
field is always NULL except for one_time aliases that had errors_to on the
 
127
routers that generated them. */
 
128
 
 
129
typedef struct recipient_item {
 
130
  uschar *address;              /* the recipient address */
 
131
  int     pno;                  /* parent number for "one_time" alias, or -1 */
 
132
  uschar *errors_to;            /* the errors_to address or NULL */
 
133
#ifdef EXPERIMENTAL_BRIGHTMAIL
 
134
  uschar *bmi_optin;
 
135
#endif
 
136
} recipient_item;
 
137
 
 
138
 
 
139
/* Global variables that are documented as visible in the function. */
 
140
 
 
141
extern unsigned int debug_selector;    /* Debugging bits */
 
142
 
 
143
extern int     body_linecount;         /* Line count in body */
 
144
extern int     body_zerocount;         /* Binary zero count in body */
 
145
extern uschar *expand_string_message;  /* Error info for failing expansion */
 
146
extern uschar *headers_charset;        /* Charset for RFC 2047 decoding */
 
147
extern header_line *header_last;       /* Final header */
 
148
extern header_line *header_list;       /* First header */
 
149
extern BOOL    host_checking;          /* Set when checking a host */
 
150
extern uschar *interface_address;      /* Interface for incoming call */
 
151
extern int     interface_port;         /* Port number for incoming call */
 
152
extern uschar *message_id;             /* Internal id of message being handled */
 
153
extern uschar *received_protocol;      /* Name of incoming protocol */
 
154
extern int     recipients_count;       /* Number of recipients */
 
155
extern recipient_item *recipients_list;/* List of recipient addresses */
 
156
extern unsigned char *sender_address;  /* Sender address */
 
157
extern uschar *sender_host_address;    /* IP address of sender, as chars */
 
158
extern uschar *sender_host_authenticated; /* Name of authentication mechanism */
 
159
extern uschar *sender_host_name;       /* Host name from lookup */
 
160
extern int     sender_host_port;       /* Port number of sender */
 
161
extern BOOL    smtp_batched_input;     /* TRUE if SMTP batch (no interaction) */
 
162
extern BOOL    smtp_input;             /* TRUE if input is via SMTP */
 
163
 
 
164
 
 
165
/* Functions that are documented as visible in local_scan(). */
 
166
 
 
167
extern int     child_close(pid_t, int);
 
168
extern pid_t   child_open(uschar **, uschar **, int, int *, int *, BOOL);
 
169
extern pid_t   child_open_exim(int *);
 
170
extern pid_t   child_open_exim2(int *, uschar *, uschar *);
 
171
extern void    debug_printf(char *, ...) PRINTF_FUNCTION(1,2);
 
172
extern uschar *expand_string(uschar *);
 
173
extern void    header_add(int, char *, ...);
 
174
extern void    header_add_at_position(BOOL, uschar *, BOOL, int, char *, ...);
 
175
extern void    header_remove(int, uschar *);
 
176
extern BOOL    header_testname(header_line *, uschar *, int, BOOL);
 
177
extern BOOL    header_testname_incomplete(header_line *, uschar *, int, BOOL);
 
178
extern void    log_write(unsigned int, int, char *format, ...);
 
179
extern int     lss_b64decode(uschar *, uschar **);
 
180
extern uschar *lss_b64encode(uschar *, int);
 
181
extern int     lss_match_domain(uschar *, uschar *);
 
182
extern int     lss_match_local_part(uschar *, uschar *, BOOL);
 
183
extern int     lss_match_address(uschar *, uschar *, BOOL);
 
184
extern int     lss_match_host(uschar *, uschar *, uschar *);
 
185
extern void    receive_add_recipient(uschar *, int);
 
186
extern BOOL    receive_remove_recipient(uschar *);
 
187
extern uschar *rfc2047_decode(uschar *, BOOL, uschar *, int, int *, uschar **);
 
188
extern int     smtp_fflush(void);
 
189
extern void    smtp_printf(char *, ...) PRINTF_FUNCTION(1,2);
 
190
extern void    smtp_vprintf(char *, va_list);
 
191
extern uschar *string_copy(uschar *);
 
192
extern uschar *string_copyn(uschar *, int);
 
193
extern uschar *string_sprintf(char *, ...);
 
194
 
 
195
/* End of local_scan.h */