Postfix3.3.1
pipe_command.h
[詳解]
1 #ifndef _PIPE_COMMAND_H_INCLUDED_
2 #define _PIPE_COMMAND_H_INCLUDED_
3 
4 /*++
5 /* NAME
6 /* pipe_command 3h
7 /* SUMMARY
8 /* deliver message to external command
9 /* SYNOPSIS
10 /* #include <pipe_command.h>
11 /* DESCRIPTION
12 /* .nf
13 
14  /*
15  * Utility library.
16  */
17 #include <vstream.h>
18 #include <vstring.h>
19 #include <check_arg.h>
20 
21  /*
22  * Global library.
23  */
24 #include <mail_copy.h>
25 #include <dsn_buf.h>
26 
27  /*
28  * Legacy API: type-unchecked arguments, internal use.
29  */
30 #define PIPE_CMD_END 0 /* terminator */
31 #define PIPE_CMD_COMMAND 1 /* command is string */
32 #define PIPE_CMD_ARGV 2 /* command is array */
33 #define PIPE_CMD_COPY_FLAGS 3 /* mail_copy() flags */
34 #define PIPE_CMD_SENDER 4 /* mail_copy() sender */
35 #define PIPE_CMD_DELIVERED 5 /* mail_copy() recipient */
36 #define PIPE_CMD_UID 6 /* privileges */
37 #define PIPE_CMD_GID 7 /* privileges */
38 #define PIPE_CMD_TIME_LIMIT 8 /* time limit */
39 #define PIPE_CMD_ENV 9 /* extra environment */
40 #define PIPE_CMD_SHELL 10 /* alternative shell */
41 #define PIPE_CMD_EOL 11 /* record delimiter */
42 #define PIPE_CMD_EXPORT 12 /* exportable environment */
43 #define PIPE_CMD_ORIG_RCPT 13 /* mail_copy() original recipient */
44 #define PIPE_CMD_CWD 14 /* working directory */
45 #define PIPE_CMD_CHROOT 15 /* chroot() before exec() */
46 
47  /*
48  * Safer API: type-checked arguments, external use.
49  */
50 #define CA_PIPE_CMD_END PIPE_CMD_END
51 #define CA_PIPE_CMD_COMMAND(v) PIPE_CMD_COMMAND, CHECK_CPTR(PIPE_CMD, char, (v))
52 #define CA_PIPE_CMD_ARGV(v) PIPE_CMD_ARGV, CHECK_PPTR(PIPE_CMD, char, (v))
53 #define CA_PIPE_CMD_COPY_FLAGS(v) PIPE_CMD_COPY_FLAGS, CHECK_VAL(PIPE_CMD, int, (v))
54 #define CA_PIPE_CMD_SENDER(v) PIPE_CMD_SENDER, CHECK_CPTR(PIPE_CMD, char, (v))
55 #define CA_PIPE_CMD_DELIVERED(v) PIPE_CMD_DELIVERED, CHECK_CPTR(PIPE_CMD, char, (v))
56 #define CA_PIPE_CMD_UID(v) PIPE_CMD_UID, CHECK_VAL(PIPE_CMD, uid_t, (v))
57 #define CA_PIPE_CMD_GID(v) PIPE_CMD_GID, CHECK_VAL(PIPE_CMD, gid_t, (v))
58 #define CA_PIPE_CMD_TIME_LIMIT(v) PIPE_CMD_TIME_LIMIT, CHECK_VAL(PIPE_CMD, int, (v))
59 #define CA_PIPE_CMD_ENV(v) PIPE_CMD_ENV, CHECK_PPTR(PIPE_CMD, char, (v))
60 #define CA_PIPE_CMD_SHELL(v) PIPE_CMD_SHELL, CHECK_CPTR(PIPE_CMD, char, (v))
61 #define CA_PIPE_CMD_EOL(v) PIPE_CMD_EOL, CHECK_CPTR(PIPE_CMD, char, (v))
62 #define CA_PIPE_CMD_EXPORT(v) PIPE_CMD_EXPORT, CHECK_PPTR(PIPE_CMD, char, (v))
63 #define CA_PIPE_CMD_ORIG_RCPT(v) PIPE_CMD_ORIG_RCPT, CHECK_CPTR(PIPE_CMD, char, (v))
64 #define CA_PIPE_CMD_CWD(v) PIPE_CMD_CWD, CHECK_CPTR(PIPE_CMD, char, (v))
65 #define CA_PIPE_CMD_CHROOT(v) PIPE_CMD_CHROOT, CHECK_CPTR(PIPE_CMD, char, (v))
66 
67 CHECK_VAL_HELPER_DCL(PIPE_CMD, uid_t);
68 CHECK_VAL_HELPER_DCL(PIPE_CMD, int);
69 CHECK_VAL_HELPER_DCL(PIPE_CMD, gid_t);
70 CHECK_PPTR_HELPER_DCL(PIPE_CMD, char);
71 CHECK_CPTR_HELPER_DCL(PIPE_CMD, char);
72 
73  /*
74  * Command completion status.
75  */
76 #define PIPE_STAT_OK 0 /* success */
77 #define PIPE_STAT_DEFER 1 /* try again */
78 #define PIPE_STAT_BOUNCE 2 /* failed */
79 #define PIPE_STAT_CORRUPT 3 /* corrupted file */
80 
81 extern int pipe_command(VSTREAM *, DSN_BUF *,...);
82 
83 /* LICENSE
84 /* .ad
85 /* .fi
86 /* The Secure Mailer license must be distributed with this software.
87 /* AUTHOR(S)
88 /* Wietse Venema
89 /* IBM T.J. Watson Research
90 /* P.O. Box 704
91 /* Yorktown Heights, NY 10598, USA
92 /*--*/
93 
94 #endif
CHECK_VAL_HELPER_DCL(PIPE_CMD, uid_t)
CHECK_CPTR_HELPER_DCL(PIPE_CMD, char)
CHECK_PPTR_HELPER_DCL(PIPE_CMD, char)
int pipe_command(VSTREAM *, DSN_BUF *,...)
Definition: pipe_command.c:389