1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#ifndef SIEVE_EXTPROGRAMS_COMMON_H
#define SIEVE_EXTPROGRAMS_COMMON_H
#include "sieve-common.h"
/*
* Extension configuration
*/
enum sieve_extprograms_eol {
SIEVE_EXTPROGRAMS_EOL_CRLF = 0,
SIEVE_EXTPROGRAMS_EOL_LF
};
struct sieve_extprograms_config {
const struct sieve_extension *copy_ext;
const struct sieve_extension *var_ext;
char *socket_dir;
char *bin_dir;
enum sieve_extprograms_eol default_input_eol;
unsigned int execute_timeout;
};
struct sieve_extprograms_config *sieve_extprograms_config_init
(const struct sieve_extension *ext);
void sieve_extprograms_config_deinit
(struct sieve_extprograms_config **ext_config);
/*
* Extensions
*/
extern const struct sieve_extension_def sieve_ext_vnd_pipe;
extern const struct sieve_extension_def sieve_ext_vnd_filter;
extern const struct sieve_extension_def sieve_ext_vnd_execute;
/*
* Commands
*/
extern const struct sieve_command_def sieve_cmd_pipe;
extern const struct sieve_command_def sieve_cmd_filter;
extern const struct sieve_command_def sieve_cmd_execute;
/*
* Operations
*/
extern const struct sieve_operation_def sieve_opr_pipe;
extern const struct sieve_operation_def sieve_opr_filter;
extern const struct sieve_operation_def sieve_opr_execute;
/*
* Program name and arguments
*/
bool sieve_extprogram_arg_is_valid(string_t *arg);
bool sieve_extprogram_name_is_valid(string_t *name);
/*
* Command validation
*/
bool sieve_extprogram_command_validate
(struct sieve_validator *valdtr, struct sieve_command *cmd);
/*
* Common command operands
*/
int sieve_extprogram_command_read_operands
(const struct sieve_runtime_env *renv, sieve_size_t *address,
string_t **pname_r, struct sieve_stringlist **args_list_r);
/*
* Running external programs
*/
void sieve_extprogram_exec_error
(struct sieve_error_handler *ehandler, const char *location,
const char *fmt, ...) ATTR_FORMAT(3, 4);
struct sieve_extprogram *sieve_extprogram_create
(const struct sieve_extension *ext, const struct sieve_script_env *senv,
const struct sieve_message_data *msgdata, const char *action,
const char *program_name, const char * const *args,
enum sieve_error *error_r);
void sieve_extprogram_destroy(struct sieve_extprogram **_sprog);
void sieve_extprogram_set_output
(struct sieve_extprogram *sprog, struct ostream *output);
void sieve_extprogram_set_output_seekable
(struct sieve_extprogram *sprog);
struct istream *sieve_extprogram_get_output_seekable
(struct sieve_extprogram *sprog);
void sieve_extprogram_set_input
(struct sieve_extprogram *sprog, struct istream *input);
int sieve_extprogram_set_input_mail
(struct sieve_extprogram *sprog, struct mail *mail);
int sieve_extprogram_run(struct sieve_extprogram *sprog);
#endif
|