|
|
1.1 root 1: /* mailsrvr.h */
2:
3: /* Synchronet Mail (SMTP/POP3/SendMail) server */
4:
1.1.1.2 ! root 5: /* $Id: mailsrvr.h,v 1.70 2011/09/10 10:32:07 rswindell Exp $ */
1.1 root 6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
1.1.1.2 ! root 11: * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 12: * *
13: * This program is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU General Public License for more details: gpl.txt or *
18: * http://www.fsf.org/copyleft/gpl.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38: #ifndef _MAILSRVR_H_
39: #define _MAILSRVR_H_
40:
41: #include "startup.h"
42: #include "sockwrap.h" /* SOCKET */
43:
44: typedef struct {
45:
46: DWORD size; /* sizeof(mail_startup_t) */
47: WORD smtp_port;
48: WORD pop3_port;
1.1.1.2 ! root 49: WORD submission_port;
1.1 root 50: WORD max_clients;
51: WORD max_inactivity;
52: WORD max_delivery_attempts;
53: WORD rescan_frequency; /* In seconds */
54: WORD relay_port;
55: WORD lines_per_yield;
56: WORD max_recipients;
57: WORD sem_chk_freq; /* semaphore file checking frequency (in seconds) */
58: DWORD interface_addr;
59: DWORD options; /* See MAIL_OPT definitions */
1.1.1.2 ! root 60: DWORD max_msg_size; /* Max msg size in bytes (0=unlimited) */
! 61: DWORD max_msgs_waiting; /* Max msgs in user's inbox (0=unlimited) */
! 62: DWORD connect_timeout; /* in seconds, for non-blocking connect (0=blocking socket) */
1.1 root 63:
64: void* cbdata; /* Private data passed to callbacks */
65:
66: /* Callbacks (NULL if unused) */
1.1.1.2 ! root 67: int (*lputs)(void*, int level, const char* msg);
! 68: void (*errormsg)(void*, int level, const char* msg);
! 69: void (*status)(void*, const char*);
1.1 root 70: void (*started)(void*);
71: void (*recycle)(void*);
72: void (*terminated)(void*, int code);
73: void (*clients)(void*, int active);
74: void (*thread_up)(void*, BOOL up, BOOL setuid);
75: void (*socket_open)(void*, BOOL open);
76: void (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
77: BOOL (*seteuid)(BOOL user);
78: BOOL (*setuid)(BOOL force);
79:
80: /* Paths */
81: char ctrl_dir[128];
82: char temp_dir[128];
83:
84: /* Strings */
85: char dns_server[128];
86: char default_user[128];
87: char dnsbl_tag[32]; // Tag to add to blacklisted subject
88: char dnsbl_hdr[32]; // Header field to add to msg header
89: char inbound_sound[128];
90: char outbound_sound[128];
91: char pop3_sound[128];
92: char default_charset[128];
93:
94: /* Misc */
95: char host_name[128];
96: BOOL recycle_now;
97: BOOL shutdown_now;
98: int log_level;
99: uint bind_retry_count; /* Number of times to retry bind() calls */
100: uint bind_retry_delay; /* Time to wait between each bind() retry */
101:
102: /* Relay Server */
103: char relay_server[128];
104: /* Relay authentication required */
105: char relay_user[128];
106: char relay_pass[128];
107:
108: /* JavaScript operating parameters */
109: js_startup_t js;
110:
1.1.1.2 ! root 111: /* Login Attempt parameters */
! 112: ulong login_attempt_delay;
! 113: ulong login_attempt_throttle;
! 114: ulong login_attempt_hack_threshold;
! 115: ulong login_attempt_filter_threshold;
! 116: link_list_t* login_attempt_list;
! 117:
1.1 root 118: } mail_startup_t;
119:
120: /* startup options that requires re-initialization/recycle when changed */
121: #if defined(STARTUP_INIT_FIELD_TABLES)
122: static struct init_field mail_init_fields[] = {
123: OFFSET_AND_SIZE(mail_startup_t,smtp_port)
124: ,OFFSET_AND_SIZE(mail_startup_t,pop3_port)
125: ,OFFSET_AND_SIZE(mail_startup_t,interface_addr)
126: ,OFFSET_AND_SIZE(mail_startup_t,ctrl_dir)
127: ,{ 0,0 } /* terminator */
128: };
129: #endif
130:
131: #define MAIL_OPT_DEBUG_RX_HEADER (1<<0)
132: #define MAIL_OPT_DEBUG_RX_BODY (1<<1)
133: #define MAIL_OPT_ALLOW_POP3 (1<<2)
134: #define MAIL_OPT_DEBUG_TX (1<<3)
135: #define MAIL_OPT_DEBUG_RX_RSP (1<<4)
136: #define MAIL_OPT_RELAY_TX (1<<5) /* Use SMTP relay server */
137: #define MAIL_OPT_DEBUG_POP3 (1<<6)
138: #define MAIL_OPT_ALLOW_RX_BY_NUMBER (1<<7) /* Receive mail sent to user # */
139: #define MAIL_OPT_NO_NOTIFY (1<<8) /* Don't notify local recipients */
140: #define MAIL_OPT_ALLOW_SYSOP_ALIASES (1<<9) /* Receive mail sent to built-in sysop aliases (i.e. "sysop" and "postmaster") */
1.1.1.2 ! root 141: #define MAIL_OPT_USE_SUBMISSION_PORT (1<<10) /* Listen on the "MSA" service port for mail submissions */
1.1 root 142: #define MAIL_OPT_NO_HOST_LOOKUP (1<<11) /* Don't look-up hostnames */
143: #define MAIL_OPT_USE_TCP_DNS (1<<12) /* Use TCP vs UDP for DNS req */
144: #define MAIL_OPT_NO_SENDMAIL (1<<13) /* Don't run SendMail thread */
145: #define MAIL_OPT_ALLOW_RELAY (1<<14) /* Allow relays from stored user IPs */
146: #define MAIL_OPT_DNSBL_REFUSE (1<<15) /* Refuse session, return error */
147: #define MAIL_OPT_DNSBL_IGNORE (1<<16) /* Dump mail, return success */
148: #define MAIL_OPT_DNSBL_BADUSER (1<<17) /* Refuse mail (bad user name) */
149: #define MAIL_OPT_DNSBL_CHKRECVHDRS (1<<18) /* Check all Recieved: from addresses */
150: #define MAIL_OPT_DNSBL_THROTTLE (1<<19) /* Throttle receive from blacklisted servers */
1.1.1.2 ! root 151: #define MAIL_OPT_DNSBL_SPAMHASH (1<<20) /* Store hashes of ignored or tagged messages in spam.hash */
1.1 root 152: #define MAIL_OPT_SMTP_AUTH_VIA_IP (1<<21) /* Allow SMTP authentication via IP */
153: #define MAIL_OPT_SEND_INTRANSIT (1<<22) /* Send mail, even if already "in transit" */
154: #define MAIL_OPT_RELAY_AUTH_PLAIN (1<<23)
155: #define MAIL_OPT_RELAY_AUTH_LOGIN (1<<24)
156: #define MAIL_OPT_RELAY_AUTH_CRAM_MD5 (1<<25)
1.1.1.2 ! root 157: #define MAIL_OPT_NO_AUTO_EXEMPT (1<<26) /* Do not auto DNSBL-exempt recipient e-mail addresses */
1.1 root 158: #define MAIL_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
159: #define MAIL_OPT_MUTE (1<<31)
160:
161: #define MAIL_OPT_RELAY_AUTH_MASK (MAIL_OPT_RELAY_AUTH_PLAIN|MAIL_OPT_RELAY_AUTH_LOGIN|MAIL_OPT_RELAY_AUTH_CRAM_MD5)
162:
163: /* mail_startup_t.options bits that require re-init/recycle when changed */
1.1.1.2 ! root 164: #define MAIL_INIT_OPTS (MAIL_OPT_ALLOW_POP3|MAIL_OPT_NO_SENDMAIL)
1.1 root 165:
166: #if defined(STARTUP_INI_BITDESC_TABLES)
167: static ini_bitdesc_t mail_options[] = {
168:
169: { MAIL_OPT_DEBUG_RX_HEADER ,"DEBUG_RX_HEADER" },
170: { MAIL_OPT_DEBUG_RX_BODY ,"DEBUG_RX_BODY" },
171: { MAIL_OPT_ALLOW_POP3 ,"ALLOW_POP3" },
172: { MAIL_OPT_DEBUG_TX ,"DEBUG_TX" },
173: { MAIL_OPT_DEBUG_RX_RSP ,"DEBUG_RX_RSP" },
174: { MAIL_OPT_RELAY_TX ,"RELAY_TX" },
175: { MAIL_OPT_DEBUG_POP3 ,"DEBUG_POP3" },
176: { MAIL_OPT_ALLOW_RX_BY_NUMBER ,"ALLOW_RX_BY_NUMBER" },
177: { MAIL_OPT_ALLOW_SYSOP_ALIASES ,"ALLOW_SYSOP_ALIASES" },
1.1.1.2 ! root 178: { MAIL_OPT_USE_SUBMISSION_PORT ,"USE_SUBMISSION_PORT" },
1.1 root 179: { MAIL_OPT_NO_NOTIFY ,"NO_NOTIFY" },
180: { MAIL_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
181: { MAIL_OPT_USE_TCP_DNS ,"USE_TCP_DNS" },
182: { MAIL_OPT_NO_SENDMAIL ,"NO_SENDMAIL" },
183: { MAIL_OPT_ALLOW_RELAY ,"ALLOW_RELAY" },
184: { MAIL_OPT_SMTP_AUTH_VIA_IP ,"SMTP_AUTH_VIA_IP" },
185: { MAIL_OPT_DNSBL_REFUSE ,"DNSBL_REFUSE" },
186: { MAIL_OPT_DNSBL_IGNORE ,"DNSBL_IGNORE" },
187: { MAIL_OPT_DNSBL_BADUSER ,"DNSBL_BADUSER" },
188: { MAIL_OPT_DNSBL_CHKRECVHDRS ,"DNSBL_CHKRECVHDRS" },
189: { MAIL_OPT_DNSBL_THROTTLE ,"DNSBL_THROTTLE" },
1.1.1.2 ! root 190: { MAIL_OPT_DNSBL_SPAMHASH ,"DNSBL_SPAMHASH" },
1.1 root 191: { MAIL_OPT_SEND_INTRANSIT ,"SEND_INTRANSIT" },
192: { MAIL_OPT_RELAY_AUTH_PLAIN ,"RELAY_AUTH_PLAIN" },
193: { MAIL_OPT_RELAY_AUTH_LOGIN ,"RELAY_AUTH_LOGIN" },
194: { MAIL_OPT_RELAY_AUTH_CRAM_MD5 ,"RELAY_AUTH_CRAM_MD5" },
1.1.1.2 ! root 195: { MAIL_OPT_NO_AUTO_EXEMPT ,"NO_AUTO_EXEMPT" },
1.1 root 196: { MAIL_OPT_NO_RECYCLE ,"NO_RECYCLE" },
197: { MAIL_OPT_MUTE ,"MUTE" },
198: /* terminator */
199: { 0 ,NULL }
200: };
201: #endif
202:
203: #ifdef DLLEXPORT
204: #undef DLLEXPORT
205: #endif
206: #ifdef DLLCALL
207: #undef DLLCALL
208: #endif
209:
210: #ifdef _WIN32
211: #ifdef MAILSRVR_EXPORTS
212: #define DLLEXPORT __declspec(dllexport)
213: #else
214: #define DLLEXPORT __declspec(dllimport)
215: #endif
216: #ifdef __BORLANDC__
217: #define DLLCALL __stdcall
218: #else
219: #define DLLCALL
220: #endif
221: #else
222: #define DLLEXPORT
223: #define DLLCALL
224: #endif
225:
226: #ifdef __cplusplus
227: extern "C" {
228: #endif
229: /* arg is pointer to static mail_startup_t* */
230: DLLEXPORT void DLLCALL mail_server(void* arg);
231: DLLEXPORT void DLLCALL mail_terminate(void);
232: DLLEXPORT const char* DLLCALL mail_ver(void);
233: #ifdef __cplusplus
234: }
235: #endif
236:
237: int sockprintf(SOCKET sock, char *fmt, ...);
238:
239: #endif /* Don't add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.