comparison src/masqmail.h @ 10:26e34ae9a3e3

changed indention and line wrapping to a more consistent style
author meillo@marmaro.de
date Mon, 27 Oct 2008 16:23:10 +0100
parents 08114f7dcc23
children f4719cffc48c
comparison
equal deleted inserted replaced
9:31cc8a89cb74 10:26e34ae9a3e3
43 #include "libident/ident.h" 43 #include "libident/ident.h"
44 #endif 44 #endif
45 45
46 #include "lookup.h" 46 #include "lookup.h"
47 47
48 typedef 48 typedef struct _interface {
49 struct _interface 49 gchar *address;
50 { 50 gint port;
51 gchar *address;
52 gint port;
53 } interface; 51 } interface;
54 52
55 #define ADDR_FLAG_DELIVERED 0x01 53 #define ADDR_FLAG_DELIVERED 0x01
56 #define ADDR_FLAG_DEFERED 0x02 54 #define ADDR_FLAG_DEFERED 0x02
57 #define ADDR_FLAG_FAILED 0x04 55 #define ADDR_FLAG_FAILED 0x04
58 #define ADDR_FLAG_LAST_ROUTE 0x40 56 #define ADDR_FLAG_LAST_ROUTE 0x40
59 #define ADDR_FLAG_NOEXPAND 0x80 57 #define ADDR_FLAG_NOEXPAND 0x80
60 58
61 typedef struct _address 59 typedef struct _address {
62 { 60 gchar *address;
63 gchar *address; 61 gchar *local_part;
64 gchar *local_part; 62 gchar *domain;
65 gchar *domain; 63 gint flags;
66 gint flags; 64 GList *children;
67 GList *children; 65 struct _address *parent;
68 struct _address *parent;
69 } address; 66 } address;
70 67
71 #define addr_mark_delivered(addr) { addr->flags |= ADDR_FLAG_DELIVERED; } 68 #define addr_mark_delivered(addr) { addr->flags |= ADDR_FLAG_DELIVERED; }
72 #define addr_unmark_delivered(addr) { addr->flags &= ~ADDR_FLAG_DELIVERED; } 69 #define addr_unmark_delivered(addr) { addr->flags &= ~ADDR_FLAG_DELIVERED; }
73 #define addr_is_delivered(addr) ((addr->flags & ADDR_FLAG_DELIVERED) != 0 ) 70 #define addr_is_delivered(addr) ((addr->flags & ADDR_FLAG_DELIVERED) != 0 )
78 75
79 #define addr_mark_failed(addr) { addr->flags |= ADDR_FLAG_FAILED; } 76 #define addr_mark_failed(addr) { addr->flags |= ADDR_FLAG_FAILED; }
80 #define addr_unmark_failed(addr) { addr->flags &= ~ADDR_FLAG_FAILED; } 77 #define addr_unmark_failed(addr) { addr->flags &= ~ADDR_FLAG_FAILED; }
81 #define addr_is_failed(addr) ((addr->flags & ADDR_FLAG_FAILED) != 0 ) 78 #define addr_is_failed(addr) ((addr->flags & ADDR_FLAG_FAILED) != 0 )
82 79
83 typedef 80 typedef struct _connect_route {
84 struct _connect_route 81 gchar *name;
85 { 82 gchar *filename;
86 gchar *name; 83
87 gchar *filename; 84 gchar *protocol;
88 85
89 gchar *protocol; 86 gboolean is_local_net;
90 87 gboolean last_route;
91 gboolean is_local_net; 88
92 gboolean last_route; 89 GList *allowed_return_paths;
93 90 GList *not_allowed_return_paths;
94 GList *allowed_return_paths; 91 GList *allowed_mail_locals;
95 GList *not_allowed_return_paths; 92 GList *not_allowed_mail_locals;
96 GList *allowed_mail_locals; 93 GList *allowed_rcpt_domains;
97 GList *not_allowed_mail_locals; 94 GList *not_allowed_rcpt_domains;
98 GList *allowed_rcpt_domains; 95
99 GList *not_allowed_rcpt_domains; 96 interface *mail_host;
100 97 gchar *wrapper;
101 interface *mail_host; 98 gboolean connect_error_fail;
102 gchar *wrapper; 99
103 gboolean connect_error_fail; 100 gchar *helo_name;
104 101 gboolean do_correct_helo;
105 gchar *helo_name; 102 gboolean do_pipelining;
106 gboolean do_correct_helo; 103
107 gboolean do_pipelining; 104 gchar *set_h_from_domain;
108 105 gchar *set_h_reply_to_domain;
109 gchar *set_h_from_domain; 106 gchar *set_return_path_domain;
110 gchar *set_h_reply_to_domain; 107
111 gchar *set_return_path_domain; 108 GList *map_h_from_addresses;
112 109 GList *map_h_reply_to_addresses;
113 GList *map_h_from_addresses; 110 GList *map_h_mail_followup_to_addresses;
114 GList *map_h_reply_to_addresses; 111 GList *map_return_path_addresses;
115 GList *map_h_mail_followup_to_addresses; 112
116 GList *map_return_path_addresses; 113 gboolean expand_h_sender_domain;
117 114 gboolean expand_h_sender_address;
118 gboolean expand_h_sender_domain; 115
119 gboolean expand_h_sender_address; 116 GList *resolve_list;
120 117
121 GList *resolve_list; 118 gchar *auth_name;
122 119 gchar *auth_login;
123 gchar *auth_name; 120 gchar *auth_secret;
124 gchar *auth_login; 121
125 gchar *auth_secret; 122 gchar *pop3_login;
126 123
127 gchar *pop3_login; 124 gchar *pipe;
128 125
129 gchar *pipe; 126 gboolean pipe_fromline;
130 127 gboolean pipe_fromhack;
131 gboolean pipe_fromline;
132 gboolean pipe_fromhack;
133 } connect_route; 128 } connect_route;
134 129
135 typedef struct _get_conf 130 typedef struct _get_conf {
136 { 131 gchar *protocol;
137 gchar *protocol; 132 gchar *server_name;
138 gchar *server_name; 133 guint server_port;
139 guint server_port; 134 gchar *wrapper;
140 gchar *wrapper; 135 gchar *login_user;
141 gchar *login_user; 136 gchar *login_pass;
142 gchar *login_pass; 137 address *address;
143 address *address; 138 address *return_path;
144 address *return_path; 139 gboolean do_keep;
145 gboolean do_keep; 140 gboolean do_uidl;
146 gboolean do_uidl; 141 gboolean do_uidl_dele;
147 gboolean do_uidl_dele; 142 gint max_size;
148 gint max_size; 143 gboolean max_size_delete;
149 gboolean max_size_delete; 144 gint max_count;
150 gint max_count; 145
151 146 GList *resolve_list;
152 GList *resolve_list;
153 147
154 } get_conf; 148 } get_conf;
155 149
156 typedef 150 typedef struct _masqmail_conf {
157 struct _masqmail_conf 151 gint mail_uid;
158 { 152 gint mail_gid;
159 gint mail_uid; 153
160 gint mail_gid; 154 gint orig_uid;
161 155 gint orig_gid;
162 gint orig_uid; 156
163 gint orig_gid; 157 gboolean run_as_user;
164 158
165 gboolean run_as_user; 159 gchar *mail_dir;
166 160 gchar *lock_dir;
167 gchar *mail_dir; 161 gchar *spool_dir;
168 gchar *lock_dir; 162 gchar *log_dir;
169 gchar *spool_dir; 163
170 gchar *log_dir; 164 gint debug_level;
171 165 gboolean use_syslog;
172 gint debug_level; 166 guint log_max_pri;
173 gboolean use_syslog; 167
174 guint log_max_pri; 168 gchar *host_name;
175 169 GList *local_hosts;
176 gchar *host_name; 170 GList *local_addresses;
177 GList *local_hosts; 171 GList *not_local_addresses;
178 GList *local_addresses; 172 GList *local_nets;
179 GList *not_local_addresses; 173 GList *listen_addresses;
180 GList *local_nets; 174
181 GList *listen_addresses; 175 guint remote_port;
182 176
183 guint remote_port; 177 gboolean do_save_envelope_to;
184 178
185 gboolean do_save_envelope_to; 179 gboolean defer_all;
186 180 gboolean do_relay;
187 gboolean defer_all; 181
188 gboolean do_relay; 182 GList *ident_trusted_nets;
189 183
190 GList *ident_trusted_nets; 184 gboolean do_queue;
191 185
192 gboolean do_queue; 186 gboolean do_verbose;
193 187
194 gboolean do_verbose; 188 gchar *mbox_default;
195 189 GList *mbox_users;
196 gchar *mbox_default; 190 GList *mda_users;
197 GList *mbox_users; 191 GList *maildir_users;
198 GList *mda_users; 192
199 GList *maildir_users; 193 gchar *mda;
200 194 gboolean mda_fromline;
201 gchar *mda; 195 gboolean mda_fromhack;
202 gboolean mda_fromline; 196
203 gboolean mda_fromhack; 197 gboolean pipe_fromline;
204 198 gboolean pipe_fromhack;
205 gboolean pipe_fromline; 199
206 gboolean pipe_fromhack; 200 gchar *alias_file;
207 201 int (*alias_local_cmp) (const char *, const char *);
208 gchar *alias_file; 202
209 int (*alias_local_cmp)(const char *, const char *); 203 GList *local_net_routes;
210 204 GList *connect_routes; /* list of pairs which point to lists */
211 GList *local_net_routes; 205
212 GList *connect_routes; /* list of pairs which point to lists */ 206 gchar *online_detect;
213 207 gchar *online_file;
214 gchar *online_detect; 208 gchar *online_pipe;
215 gchar *online_file; 209 interface *mserver_iface;
216 gchar *online_pipe; 210
217 interface *mserver_iface; 211 GList *get_names;
218 212 GList *online_gets; /* list of pairs which point to lists */
219 GList *get_names; 213
220 GList *online_gets; /* list of pairs which point to lists */ 214 gchar *errmsg_file;
221 215 gchar *warnmsg_file;
222 gchar *errmsg_file; 216 GList *warn_intervals;
223 gchar *warnmsg_file; 217 gint max_defer_time;
224 GList *warn_intervals; 218
225 gint max_defer_time; 219 gchar *log_user;
226
227 gchar *log_user;
228 } masqmail_conf; 220 } masqmail_conf;
229 221
230 extern masqmail_conf conf; 222 extern masqmail_conf conf;
231 223
232 typedef 224 typedef struct _table_pair {
233 struct _table_pair 225 gchar *key;
234 { 226 gpointer *value;
235 gchar *key;
236 gpointer *value;
237 } table_pair; 227 } table_pair;
238 228
239 229
240 typedef 230 typedef enum _prot_id {
241 enum _prot_id 231 PROT_LOCAL = 0,
242 { 232 PROT_BSMTP,
243 PROT_LOCAL = 0, 233 PROT_SMTP,
244 PROT_BSMTP, 234 PROT_ESMTP,
245 PROT_SMTP, 235 PROT_POP3,
246 PROT_ESMTP, 236 PROT_APOP,
247 PROT_POP3, 237 PROT_NUM
248 PROT_APOP, 238 } prot_id;
249 PROT_NUM
250 }prot_id;
251 239
252 extern gchar *prot_names[]; 240 extern gchar *prot_names[];
253 241
254 typedef 242 typedef enum _header_id {
255 enum _header_id 243 HEAD_FROM = 0,
256 { 244 HEAD_SENDER,
257 HEAD_FROM = 0, 245 HEAD_TO,
258 HEAD_SENDER, 246 HEAD_CC,
259 HEAD_TO, 247 HEAD_BCC,
260 HEAD_CC, 248 HEAD_DATE,
261 HEAD_BCC, 249 HEAD_MESSAGE_ID,
262 HEAD_DATE, 250 HEAD_REPLY_TO,
263 HEAD_MESSAGE_ID, 251 HEAD_SUBJECT,
264 HEAD_REPLY_TO, 252 HEAD_RETURN_PATH,
265 HEAD_SUBJECT, 253 HEAD_ENVELOPE_TO,
266 HEAD_RETURN_PATH, 254 HEAD_RECEIVED,
267 HEAD_ENVELOPE_TO, 255 HEAD_NUM_IDS,
268 HEAD_RECEIVED, 256 HEAD_STATUS,
269 HEAD_NUM_IDS, 257 HEAD_UNKNOWN = HEAD_NUM_IDS,
270 HEAD_STATUS, 258 HEAD_NONE = -1,
271 HEAD_UNKNOWN = HEAD_NUM_IDS, 259 } header_id;
272 HEAD_NONE = -1, 260
273 }header_id; 261 typedef struct _header_name {
274 262 gchar *header;
275 typedef 263 header_id id;
276 struct _header_name 264 } header_name;
277 { 265
278 gchar *header; 266 typedef struct _header {
279 header_id id; 267 header_id id;
280 }header_name; 268 gchar *header;
281 269 gchar *value;
282 typedef 270 } header;
283 struct _header 271
284 { 272
285 header_id id; 273 typedef struct _message {
286 gchar *header; 274 gchar *uid;
287 gchar *value; 275
288 }header; 276 gchar *received_host;
289 277 prot_id received_prot;
290 278 gchar *ident;
291 typedef 279 gint transfer_id; /* for multiple messages per transfer */
292 struct _message 280
293 { 281 address *return_path;
294 gchar *uid; 282 GList *rcpt_list;
295 283 GList *non_rcpt_list;
296 gchar *received_host; 284
297 prot_id received_prot; 285 GList *hdr_list;
298 gchar *ident; 286 GList *data_list;
299 gint transfer_id; /* for multiple messages per transfer */ 287
300 288 gint data_size;
301 address *return_path; 289 time_t received_time;
302 GList *rcpt_list; 290 time_t warned_time;
303 GList *non_rcpt_list; 291
304 292 gchar *full_sender_name;
305 GList *hdr_list; 293 } message;
306 GList *data_list; 294
307 295 typedef struct _msg_out {
308 gint data_size; 296 message *msg;
309 time_t received_time; 297
310 time_t warned_time; 298 address *return_path;
311 299 GList *rcpt_list;
312 gchar *full_sender_name; 300
313 }message; 301 GList *hdr_list;
314 302 GList *xtra_hdr_list;
315 typedef 303 } msg_out;
316 struct _msg_out 304
317 { 305 typedef struct _msgout_perhost {
318 message *msg; 306 gchar *host;
319 307 GList *msgout_list;
320 address *return_path;
321 GList *rcpt_list;
322
323 GList *hdr_list;
324 GList *xtra_hdr_list;
325 }msg_out;
326
327 typedef
328 struct _msgout_perhost
329 {
330 gchar *host;
331 GList *msgout_list;
332 } msgout_perhost; 308 } msgout_perhost;
333 309
334 /* flags for accept() */ 310 /* flags for accept() */
335 /*#define ACC_LOCAL 0x01 (we better use received_host == NULL) */ 311 /*#define ACC_LOCAL 0x01 (we better use received_host == NULL) */
336 #define ACC_HEAD_FROM_RCPT 0x01 /* create To: Header from rcpt_list (cmd line) */ 312 #define ACC_HEAD_FROM_RCPT 0x01 /* create To: Header from rcpt_list (cmd line) */
337 #define ACC_DEL_RCPTS 0x02 /* -t option, delete rcpts */ 313 #define ACC_DEL_RCPTS 0x02 /* -t option, delete rcpts */
338 #define ACC_DEL_BCC 0x04 /* -t option, delete Bcc header */ 314 #define ACC_DEL_BCC 0x04 /* -t option, delete Bcc header */
339 #define ACC_RCPT_FROM_HEAD 0x08 /* -t option, get rcpts from headers */ 315 #define ACC_RCPT_FROM_HEAD 0x08 /* -t option, get rcpts from headers */
340 #define ACC_NODOT_TERM 0x10 /* a dot on a line itself does not end 316 #define ACC_NODOT_TERM 0x10 /* a dot on a line itself does not end the message (-oi option) */
341 the message (-oi option) */ 317 #define ACC_NO_RECVD_HDR 0x20 /* do not create a Received: header */
342 #define ACC_NO_RECVD_HDR 0x20 /* do not create a Received: header */ 318 #define ACC_MAIL_FROM_HEAD 0x40 /* get return path from header */
343 #define ACC_MAIL_FROM_HEAD 0x40 /* get return path from header */ 319 #define ACC_NODOT_RELAX 0x80 /* do not be picky if message ist not terminated by a dot on a line */
344 #define ACC_NODOT_RELAX 0x80 /* do not be picky if message ist not terminated by a dot on a line */ 320 #define ACC_SAVE_ENVELOPE_TO 0x0100 /* save an existent Envelope-to header as X-Orig-Envelope-to */
345 #define ACC_SAVE_ENVELOPE_TO 0x0100 /* save an existent Envelope-to header as X-Orig-Envelope-to */
346 321
347 #define DLVR_LOCAL 0x01 322 #define DLVR_LOCAL 0x01
348 #define DLVR_LAN 0x02 323 #define DLVR_LAN 0x02
349 #define DLVR_ONLINE 0x04 324 #define DLVR_ONLINE 0x04
350 #define DLVR_ALL (DLVR_LOCAL|DLVR_LAN|DLVR_ONLINE) 325 #define DLVR_ALL (DLVR_LOCAL|DLVR_LAN|DLVR_ONLINE)
351 326
352 /* transport flags */ 327 /* transport flags */
353 #define MSGSTR_FROMLINE 0x01 328 #define MSGSTR_FROMLINE 0x01
354 #define MSGSTR_FROMHACK 0x02 329 #define MSGSTR_FROMHACK 0x02
355 330
356 typedef 331 typedef enum _accept_error {
357 enum _accept_error 332 AERR_OK = 0,
358 { 333 AERR_TIMEOUT,
359 AERR_OK = 0, 334 AERR_EOF,
360 AERR_TIMEOUT, 335 AERR_OVERFLOW,
361 AERR_EOF, 336 AERR_SYNTAX,
362 AERR_OVERFLOW, 337 AERR_NOSPOOL,
363 AERR_SYNTAX, 338 AERR_NORCPT,
364 AERR_NOSPOOL, 339 AERR_UNKNOWN
365 AERR_NORCPT, 340 } accept_error;
366 AERR_UNKNOWN
367 }accept_error;
368 341
369 #define BUF_LEN 1024 342 #define BUF_LEN 1024
370 #define MAX_ADDRESS 256 343 #define MAX_ADDRESS 256
371 #define MAX_DATALINE 4096 344 #define MAX_DATALINE 4096
372 345
373 typedef 346 typedef enum _smtp_cmd_id {
374 enum _smtp_cmd_id 347 SMTP_HELO = 0,
375 { 348 SMTP_EHLO,
376 SMTP_HELO = 0, 349 SMTP_MAIL_FROM,
377 SMTP_EHLO, 350 SMTP_RCPT_TO,
378 SMTP_MAIL_FROM, 351 SMTP_DATA,
379 SMTP_RCPT_TO, 352 SMTP_QUIT,
380 SMTP_DATA, 353 SMTP_RSET,
381 SMTP_QUIT, 354 SMTP_NOOP,
382 SMTP_RSET, 355 SMTP_HELP,
383 SMTP_NOOP, 356 SMTP_NUM_IDS,
384 SMTP_HELP, 357 SMTP_EOF = -1,
385 SMTP_NUM_IDS, 358 SMTP_ERROR = -2,
386 SMTP_EOF = -1,
387 SMTP_ERROR = -2,
388 } smtp_cmd_id; 359 } smtp_cmd_id;
389 360
390 typedef 361 typedef struct _smtp_cmd {
391 struct _smtp_cmd 362 smtp_cmd_id id;
392 { 363 gchar *cmd;
393 smtp_cmd_id id;
394 gchar *cmd;
395 } smtp_cmd; 364 } smtp_cmd;
396 365
397 typedef 366 typedef struct _smtp_connection {
398 struct _smtp_connection 367 gchar *remote_host;
399 { 368
400 gchar *remote_host; 369 prot_id prot;
401 370 gint next_id;
402 prot_id prot; 371
403 gint next_id; 372 gboolean helo_seen;
404 373 gboolean from_seen;
405 gboolean helo_seen; 374 gboolean rcpt_seen;
406 gboolean from_seen; 375
407 gboolean rcpt_seen; 376 message *msg;
408 377 } smtp_connection;
409 message *msg;
410 }smtp_connection;
411 378
412 /* alias.c*/ 379 /* alias.c*/
413 gboolean addr_is_local(address *addr); 380 gboolean addr_is_local(address * addr);
414 GList *alias_expand(GList *alias_table, GList *rcpt_list, GList *non_rcpt_list); 381 GList *alias_expand(GList * alias_table, GList * rcpt_list, GList * non_rcpt_list);
415 382
416 /* child.c */ 383 /* child.c */
417 int child(const char *command); 384 int child(const char *command);
418 385
419 /* conf.c */ 386 /* conf.c */
420 void init_conf(); 387 void init_conf();
421 gboolean read_conf(gchar *filename); 388 gboolean read_conf(gchar * filename);
422 connect_route *read_route(gchar *filename, gboolean is_local_net); 389 connect_route *read_route(gchar * filename, gboolean is_local_net);
423 GList *read_route_list(GList *rf_list, gboolean is_local_net); 390 GList *read_route_list(GList * rf_list, gboolean is_local_net);
424 void destroy_route(connect_route *r); 391 void destroy_route(connect_route * r);
425 void destroy_route_list(GList *list); 392 void destroy_route_list(GList * list);
426 get_conf *read_get_conf(gchar *filename); 393 get_conf *read_get_conf(gchar * filename);
427 void destroy_get_conf(get_conf *gc); 394 void destroy_get_conf(get_conf * gc);
428 connect_route *create_local_route(); 395 connect_route *create_local_route();
429 396
430 /* expand.c */ 397 /* expand.c */
431 GList *var_table_rcpt(GList *var_table, address *rcpt); 398 GList *var_table_rcpt(GList * var_table, address * rcpt);
432 GList *var_table_msg(GList *var_table, message *msg); 399 GList *var_table_msg(GList * var_table, message * msg);
433 GList *var_table_conf(GList *var_table); 400 GList *var_table_conf(GList * var_table);
434 gint expand(GList *var_list, gchar *format, gchar *result, gint result_len); 401 gint expand(GList * var_list, gchar * format, gchar * result, gint result_len);
435 402
436 /* message.c */ 403 /* message.c */
437 message *create_message(void); 404 message *create_message(void);
438 void destroy_message(message *msg); 405 void destroy_message(message * msg);
439 void destroy_msg_list(GList *msg_list); 406 void destroy_msg_list(GList * msg_list);
440 void msg_free_data(message *msg); 407 void msg_free_data(message * msg);
441 gint msg_calc_size(message *msg, gboolean is_smtp); 408 gint msg_calc_size(message * msg, gboolean is_smtp);
442 409
443 msg_out *create_msg_out(message *msg); 410 msg_out *create_msg_out(message * msg);
444 msg_out *clone_msg_out(msg_out *msgout_orig); 411 msg_out *clone_msg_out(msg_out * msgout_orig);
445 GList *create_msg_out_list(GList *msg_list); 412 GList *create_msg_out_list(GList * msg_list);
446 void destroy_msg_out(msg_out *msgout); 413 void destroy_msg_out(msg_out * msgout);
447 void destroy_msg_out_list(GList *msgout_list); 414 void destroy_msg_out_list(GList * msgout_list);
448 415
449 /* address.c */ 416 /* address.c */
450 address *create_address(gchar *path, gboolean is_rfc821); 417 address *create_address(gchar * path, gboolean is_rfc821);
451 address *create_address_qualified(gchar *path, gboolean is_rfc821, 418 address *create_address_qualified(gchar * path, gboolean is_rfc821, gchar * domain);
452 gchar *domain); 419 address *create_address_pipe(gchar * path);
453 address *create_address_pipe(gchar *path); 420 void destroy_address(address * addr);
454 void destroy_address(address *addr); 421 address *copy_modify_address(const address * orig, gchar * l_part, gchar * dom);
455 address *copy_modify_address(const address *orig, gchar *l_part, gchar *dom);
456 #define copy_address(addr) copy_modify_address(addr, NULL, NULL) 422 #define copy_address(addr) copy_modify_address(addr, NULL, NULL)
457 gboolean addr_isequal(address *addr1, address *addr2); 423 gboolean addr_isequal(address * addr1, address * addr2);
458 gboolean addr_isequal_parent(address *addr1, address *addr2); 424 gboolean addr_isequal_parent(address * addr1, address * addr2);
459 address *addr_find_ancestor(address *addr); 425 address *addr_find_ancestor(address * addr);
460 gboolean addr_is_delivered_children(address *addr); 426 gboolean addr_is_delivered_children(address * addr);
461 gboolean addr_is_finished_children(address *addr); 427 gboolean addr_is_finished_children(address * addr);
462 gchar *addr_string(address *addr); 428 gchar *addr_string(address * addr);
463 gint addr_match(address *addr1, address *addr2); 429 gint addr_match(address * addr1, address * addr2);
464 430
465 /* accept.c */ 431 /* accept.c */
466 accept_error accept_message(FILE *in, message *msg, 432 accept_error accept_message(FILE * in, message * msg, guint flags);
467 guint flags); 433 accept_error accept_message_prepare(message * msg, guint flags);
468 accept_error accept_message_prepare(message *msg, guint flags);
469 434
470 /* header.c */ 435 /* header.c */
471 gchar *rec_timestamp(); 436 gchar *rec_timestamp();
472 GList *find_header(GList *hdr_list, header_id id, gchar *hdr_str); 437 GList *find_header(GList * hdr_list, header_id id, gchar * hdr_str);
473 void header_unfold(header *hdr); 438 void header_unfold(header * hdr);
474 void header_fold(header *hdr); 439 void header_fold(header * hdr);
475 header *create_header(header_id id, gchar *fmt, ...); 440 header *create_header(header_id id, gchar * fmt, ...);
476 void destroy_header(header *hdr); 441 void destroy_header(header * hdr);
477 header *copy_header(header *hdr); 442 header *copy_header(header * hdr);
478 header *get_header(gchar *line); 443 header *get_header(gchar * line);
479 444
480 /* smtp_in.c */ 445 /* smtp_in.c */
481 void smtp_in(FILE *in, FILE *out, gchar *remote_host, gchar *ident); 446 void smtp_in(FILE * in, FILE * out, gchar * remote_host, gchar * ident);
482 447
483 /* listen.c */ 448 /* listen.c */
484 void listen_port(GList *addr_list, gint qival, char *argv[]); 449 void listen_port(GList * addr_list, gint qival, char *argv[]);
485 450
486 /* parse.c */ 451 /* parse.c */
487 gboolean split_address(const gchar *path, gchar **local_part, gchar **domain, 452 gboolean split_address(const gchar * path, gchar ** local_part, gchar ** domain, gboolean is_rfc821);
488 gboolean is_rfc821); 453 gboolean parse_address_rfc822(gchar * string, gchar ** local_begin, gchar ** local_end, gchar ** domain_begin, gchar ** domain_end, gchar ** address_end);
489 gboolean parse_address_rfc822(gchar *string, 454 gboolean parse_address_rfc821(gchar * string, gchar ** local_begin, gchar ** local_end, gchar ** domain_begin, gchar ** domain_end, gchar ** address_end);
490 gchar **local_begin, gchar **local_end, 455 address *_create_address(gchar * string, gchar ** end, gboolean is_rfc821);
491 gchar **domain_begin, gchar **domain_end, 456 address *create_address_rfc821(gchar * string, gchar ** end);
492 gchar **address_end); 457 address *create_address_rfc822(gchar * string, gchar ** end);
493 gboolean parse_address_rfc821(gchar *string, 458 GList *addr_list_append_rfc822(GList * addr_list, gchar * string, gchar * domain);
494 gchar **local_begin, gchar **local_end, 459 gboolean addr_isequal(address * addr1, address * addr2);
495 gchar **domain_begin, gchar **domain_end,
496 gchar **address_end);
497 address *_create_address(gchar *string, gchar **end, gboolean is_rfc821);
498 address *create_address_rfc821(gchar *string, gchar **end);
499 address *create_address_rfc822(gchar *string, gchar **end);
500 GList *addr_list_append_rfc822(GList *addr_list, gchar *string, gchar *domain);
501 gboolean addr_isequal(address *addr1, address *addr2);
502 460
503 /* connect.c */ 461 /* connect.c */
504 mxip_addr *connect_hostlist(int *psockfd, gchar *host, guint port, 462 mxip_addr *connect_hostlist(int *psockfd, gchar * host, guint port, GList * addr_list);
505 GList *addr_list); 463 mxip_addr *connect_resolvelist(int *psockfd, gchar * host, guint port, GList * res_funcs);
506 mxip_addr *connect_resolvelist(int *psockfd, gchar *host, guint port,
507 GList *res_funcs);
508 464
509 /* deliver.c */ 465 /* deliver.c */
510 void msg_rcptlist_local(GList *rcpt_list, GList **, GList **); 466 void msg_rcptlist_local(GList * rcpt_list, GList **, GList **);
511 gboolean deliver_local(msg_out *msgout); 467 gboolean deliver_local(msg_out * msgout);
512 gboolean deliver_msglist_host(connect_route *route, GList *msg_list, gchar *host, GList *res_list); 468 gboolean deliver_msglist_host(connect_route * route, GList * msg_list, gchar * host, GList * res_list);
513 gboolean deliver_route_msgout_list(connect_route *route, GList *msgout_list); 469 gboolean deliver_route_msgout_list(connect_route * route, GList * msgout_list);
514 gboolean deliver_route_msg_list(connect_route *route, GList *msgout_list); 470 gboolean deliver_route_msg_list(connect_route * route, GList * msgout_list);
515 gboolean deliver_finish(msg_out *msgout); 471 gboolean deliver_finish(msg_out * msgout);
516 gboolean deliver_finish_list(GList *msgout_list); 472 gboolean deliver_finish_list(GList * msgout_list);
517 gboolean deliver_msg_list(GList *msg_list, guint flags); 473 gboolean deliver_msg_list(GList * msg_list, guint flags);
518 gboolean deliver(message *msg); 474 gboolean deliver(message * msg);
519 475
520 /* fail_msg.c */ 476 /* fail_msg.c */
521 gboolean fail_msg(message *msg, gchar *template, 477 gboolean fail_msg(message * msg, gchar * template, GList * failed_rcpts, gchar * err_fmt, va_list args);
522 GList *failed_rcpts, gchar *err_fmt, va_list args); 478 gboolean warn_msg(message * msg, gchar * template, GList * failed_rcpts, gchar * err_fmt, va_list args);
523 gboolean warn_msg(message *msg, gchar *template,
524 GList *failed_rcpts, gchar *err_fmt, va_list args);
525 479
526 /* get.c */ 480 /* get.c */
527 gboolean get_from_file(gchar *fname); 481 gboolean get_from_file(gchar * fname);
528 gboolean get_from_name(gchar *name); 482 gboolean get_from_name(gchar * name);
529 gboolean get_all(void); 483 gboolean get_all(void);
530 void get_online(void); 484 void get_online(void);
531 void get_daemon(gint gival, char *argv[]); 485 void get_daemon(gint gival, char *argv[]);
532 gboolean pop_before_smtp(gchar *fname); 486 gboolean pop_before_smtp(gchar * fname);
533 487
534 /* interface.c */ 488 /* interface.c */
535 gboolean init_sockaddr(struct sockaddr_in *name, interface *iface); 489 gboolean init_sockaddr(struct sockaddr_in *name, interface * iface);
536 int make_server_socket(interface *iface); 490 int make_server_socket(interface * iface);
537 491
538 /* local.c */ 492 /* local.c */
539 gboolean append_file(message *msg, GList *hdr_list, gchar *user); 493 gboolean append_file(message * msg, GList * hdr_list, gchar * user);
540 gboolean maildir_out(message *msg, GList *hdr_list, gchar *user, guint flags); 494 gboolean maildir_out(message * msg, GList * hdr_list, gchar * user, guint flags);
541 gboolean pipe_out(message *msg, GList *hdr_list, address *rcpt, gchar *cmd, guint flags); 495 gboolean pipe_out(message * msg, GList * hdr_list, address * rcpt, gchar * cmd, guint flags);
542 496
543 /* log.c */ 497 /* log.c */
544 gchar *ext_strerror(int err); 498 gchar *ext_strerror(int err);
545 gboolean logopen(void); 499 gboolean logopen(void);
546 void logclose(void); 500 void logclose(void);
549 void debugf(const char *fmt, ...); 503 void debugf(const char *fmt, ...);
550 void vdebugf(const char *fmt, va_list args); 504 void vdebugf(const char *fmt, va_list args);
551 void maillog(const char *fmt, ...); 505 void maillog(const char *fmt, ...);
552 506
553 /* spool.c */ 507 /* spool.c */
554 gboolean spool_read_data(message *msg); 508 gboolean spool_read_data(message * msg);
555 gboolean spool_read_data(message *msg); 509 gboolean spool_read_data(message * msg);
556 message *msg_spool_read(gchar *uid, gboolean do_readdata); 510 message *msg_spool_read(gchar * uid, gboolean do_readdata);
557 gboolean spool_write(message *msg, gboolean do_writedata); 511 gboolean spool_write(message * msg, gboolean do_writedata);
558 gboolean spool_lock(gchar *uid); 512 gboolean spool_lock(gchar * uid);
559 gboolean spool_unlock(gchar *uid); 513 gboolean spool_unlock(gchar * uid);
560 gboolean spool_delete_all(message *msg); 514 gboolean spool_delete_all(message * msg);
561 515
562 /* queue.c */ 516 /* queue.c */
563 GList *read_queue(gboolean do_readdata); 517 GList *read_queue(gboolean do_readdata);
564 gboolean queue_run(void); 518 gboolean queue_run(void);
565 gboolean queue_run_online(void); 519 gboolean queue_run_online(void);
566 void queue_list(void); 520 void queue_list(void);
567 gboolean queue_delete(gchar *uid); 521 gboolean queue_delete(gchar * uid);
568 522
569 /* online.c */ 523 /* online.c */
570 gchar *detect_online(); 524 gchar *detect_online();
571 void set_online_name(gchar *name); 525 void set_online_name(gchar * name);
572 526
573 /* permissions.c */ 527 /* permissions.c */
574 gboolean is_ingroup(uid_t uid, gid_t gid); 528 gboolean is_ingroup(uid_t uid, gid_t gid);
575 void set_euidgid(gint uid, gint gid, uid_t *old_uid, gid_t *old_gid); 529 void set_euidgid(gint uid, gint gid, uid_t * old_uid, gid_t * old_gid);
576 void set_identity(uid_t old_uid, gchar *task_name); 530 void set_identity(uid_t old_uid, gchar * task_name);
577 531
578 /* rewrite.c */ 532 /* rewrite.c */
579 gboolean set_address_header_domain(header *hdr, gchar *domain); 533 gboolean set_address_header_domain(header * hdr, gchar * domain);
580 gboolean map_address_header(header *hdr, GList *table); 534 gboolean map_address_header(header * hdr, GList * table);
581 535
582 /* route.c */ 536 /* route.c */
583 msgout_perhost *create_msgout_perhost(gchar *host); 537 msgout_perhost *create_msgout_perhost(gchar * host);
584 void destroy_msgout_perhost(msgout_perhost *mo_ph); 538 void destroy_msgout_perhost(msgout_perhost * mo_ph);
585 void rewrite_headers(msg_out *msgout, connect_route *route); 539 void rewrite_headers(msg_out * msgout, connect_route * route);
586 void rcptlist_with_one_of_hostlist(GList *rcpt_list, GList *host_list, 540 void rcptlist_with_one_of_hostlist(GList * rcpt_list, GList * host_list, GList **, GList **);
587 GList **, GList **); 541 void rcptlist_with_addr_is_local(GList * rcpt_list, GList ** p_rcpt_list, GList ** p_non_rcpt_list);
588 void rcptlist_with_addr_is_local(GList *rcpt_list, 542 gboolean route_strip_msgout(connect_route * route, msg_out * msgout);
589 GList **p_rcpt_list, GList **p_non_rcpt_list); 543 msg_out *route_prepare_msgout(connect_route * route, msg_out * msgout);
590 gboolean route_strip_msgout(connect_route *route, msg_out *msgout); 544 GList *route_msgout_list(connect_route * route, GList * msgout_list);
591 msg_out *route_prepare_msgout(connect_route *route, msg_out *msgout); 545 gboolean route_is_allowed_return_path(connect_route * route, address * ret_path);
592 GList *route_msgout_list(connect_route *route, GList *msgout_list); 546 gboolean route_is_allowed_mail_local(connect_route * route, address * ret_path);
593 gboolean route_is_allowed_return_path(connect_route *route, address *ret_path); 547 void msg_rcptlist_route(connect_route * route, GList * rcpt_list, GList ** p_rcpt_list, GList ** p_non_rcpt_list);
594 gboolean route_is_allowed_mail_local(connect_route *route, address *ret_path);
595 void msg_rcptlist_route(connect_route *route, GList *rcpt_list,
596 GList **p_rcpt_list, GList **p_non_rcpt_list);
597 548
598 /* tables.c */ 549 /* tables.c */
599 table_pair *create_pair(gchar *key, gpointer value); 550 table_pair *create_pair(gchar * key, gpointer value);
600 table_pair *create_pair_string(gchar *key, gpointer value); 551 table_pair *create_pair_string(gchar * key, gpointer value);
601 table_pair *parse_table_pair(gchar *line, char delim); 552 table_pair *parse_table_pair(gchar * line, char delim);
602 gpointer *table_find_func(GList *table_list, gchar *key, int (*cmp_func)(const char *, const char *)); 553 gpointer *table_find_func(GList * table_list, gchar * key, int (*cmp_func) (const char *, const char *));
603 gpointer *table_find(GList *table_list, gchar *key); 554 gpointer *table_find(GList * table_list, gchar * key);
604 gpointer *table_find_case(GList *table_list, gchar *key); 555 gpointer *table_find_case(GList * table_list, gchar * key);
605 gpointer *table_find_fnmatch(GList *table_list, gchar *key); 556 gpointer *table_find_fnmatch(GList * table_list, gchar * key);
606 GList *table_read(gchar *fname, gchar delim); 557 GList *table_read(gchar * fname, gchar delim);
607 void destroy_table(GList *table); 558 void destroy_table(GList * table);
608 559
609 /* timeival.c */ 560 /* timeival.c */
610 gint time_interval(gchar *str, gint *pos); 561 gint time_interval(gchar * str, gint * pos);
611 562
612 /* permissions.c */ 563 /* permissions.c */
613 gboolean is_privileged_user(uid_t uid); 564 gboolean is_privileged_user(uid_t uid);
614 565
615 /* other things */ 566 /* other things */