#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
+#include <ctype.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
const u_char *cend;
const u_char *rend;
int len;
+ char *p = NULL;
/* Make our DNS query. */
//res_init();
if (txtbuf != NULL) {
snprintf(txtbuf, txtbufsize, "%s", result);
}
+ /* Remove nonprintable characters */
+ for (p=txtbuf; *p; ++p) {
+ if (!isprint(*p)) strcpy(p, p+1);
+ }
if (need_to_free_answer) free(answer);
free(result);
return(1);
/*
* Here's where our SMTP session begins its happy day.
*/
-void smtp_greeting(void)
+void smtp_greeting(int is_msa)
{
char message_to_spammer[1024];
memset(SMTP, 0, sizeof(struct citsmtp));
memset(SMTP_RECPS, 0, SIZ);
memset(SMTP_ROOMS, 0, SIZ);
+ SMTP->is_msa = is_msa;
/* If this config option is set, reject connections from problem
* addresses immediately instead of after they execute a RCPT
*/
- if (config.c_rbl_at_greeting) {
+ if ( (config.c_rbl_at_greeting) && (SMTP->is_msa == 0) ) {
if (rbl_check(message_to_spammer)) {
cprintf("550 %s\r\n", message_to_spammer);
CC->kill_me = 1;
#ifdef HAVE_OPENSSL
void smtps_greeting(void) {
CtdlStartTLS(NULL, NULL, NULL);
- smtp_greeting();
+ smtp_greeting(0);
}
#endif
* SMTP MSA port requires authentication.
*/
void smtp_msa_greeting(void) {
- smtp_greeting();
- SMTP->is_msa = 1;
+ smtp_greeting(1);
}
* LMTP is like SMTP but with some extra bonus footage added.
*/
void lmtp_greeting(void) {
- smtp_greeting();
+ smtp_greeting(0);
SMTP->is_lmtp = 1;
}
+/*
+ * Generic SMTP MTA greeting
+ */
+void smtp_mta_greeting(void) {
+ smtp_greeting(0);
+}
+
+
/*
* We also have an unfiltered LMTP socket that bypasses spam filters.
*/
void lmtp_unfiltered_greeting(void) {
- smtp_greeting();
+ smtp_greeting(0);
SMTP->is_lmtp = 1;
SMTP->is_unfiltered = 1;
}
CtdlRegisterServiceHook(config.c_smtp_port, /* SMTP MTA */
NULL,
- smtp_greeting,
+ smtp_mta_greeting,
smtp_command_loop,
NULL);