summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraaron <aaron@7b491191-dbf0-0310-aff6-d879d4d69008>2007-06-25 13:56:10 +0000
committeraaron <aaron@7b491191-dbf0-0310-aff6-d879d4d69008>2007-06-25 13:56:10 +0000
commit3dddb16e556075ffe4f183b32388aad475d836b2 (patch)
tree2098c7047e57b7cbe95a09cc2a4270db6dcc51cb
parenta45b40432dac8a32616bb1006aee118cd4e386e5 (diff)
* imap4.c, lmtp.c, pop3.c, timsieve.c, man/dbmail.conf.txt:
Added configurable login banner (closes bug #611) git-svn-id: https://svn.ic-s.nl/svn/dbmail/branches/dbmail_2_2_branch@2652 7b491191-dbf0-0310-aff6-d879d4d69008
-rw-r--r--ChangeLog5
-rw-r--r--imap4.c20
-rw-r--r--lmtp.c8
-rw-r--r--man/dbmail.conf.520
-rw-r--r--man/dbmail.conf.txt20
-rw-r--r--pop3.c11
-rw-r--r--timsieve.c8
7 files changed, 70 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 35c61d9d..89e6942c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-25 Aaron Stone <aaron@serendipity.cx>
+
+ * imap4.c, lmtp.c, pop3.c, timsieve.c, man/dbmail.conf.txt:
+ Added configurable login banner (closes bug #611)
+
2007-06-24 Aaron Stone <aaron@serendipity.cx>
* sort.c:
diff --git a/imap4.c b/imap4.c
index 20c8c7e8..57a965a3 100644
--- a/imap4.c
+++ b/imap4.c
@@ -92,11 +92,21 @@ int IMAPClientHandler(clientinfo_t * ci)
session->ci->userData = ud;
/* greet user */
- if (dbmail_imap_session_printf(session,
- "* OK dbmail imap (protocol version 4r1) server %s "
- "ready to run\r\n", IMAP_SERVER_VERSION) < 0) {
- dbmail_imap_session_delete(session);
- return EOF;
+ field_t banner;
+ GETCONFIGVALUE("banner", "IMAP", banner);
+ if (strlen(banner) > 0) {
+ if (dbmail_imap_session_printf(session,
+ "* OK %s\r\n", banner) < 0) {
+ dbmail_imap_session_delete(session);
+ return EOF;
+ }
+ } else {
+ if (dbmail_imap_session_printf(session,
+ "* OK dbmail imap (protocol version 4r1) server %s "
+ "ready to run\r\n", IMAP_SERVER_VERSION) < 0) {
+ dbmail_imap_session_delete(session);
+ return EOF;
+ }
}
fflush(session->ci->tx);
diff --git a/lmtp.c b/lmtp.c
index 8bc26be3..5875a7c0 100644
--- a/lmtp.c
+++ b/lmtp.c
@@ -134,7 +134,13 @@ int lmtp_handle_connection(clientinfo_t * ci)
if (ci->tx) {
/* sending greeting */
- ci_write(ci->tx, "220 %s DBMail LMTP service ready to rock\r\n", myhostname);
+ field_t banner;
+ GETCONFIGVALUE("banner", "LMTP", banner);
+ if (strlen(banner) > 0) {
+ ci_write(ci->tx, "220 %s %s\r\n", myhostname, banner);
+ } else {
+ ci_write(ci->tx, "220 %s DBMail LMTP service ready to rock\r\n", myhostname);
+ }
fflush(ci->tx);
} else {
TRACE(TRACE_MESSAGE, "TX stream is null!");
diff --git a/man/dbmail.conf.5 b/man/dbmail.conf.5
index d246b82d..e1d8990a 100644
--- a/man/dbmail.conf.5
+++ b/man/dbmail.conf.5
@@ -1,11 +1,11 @@
.\" Title: dbmail.conf
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
-.\" Date: 06/24/2007
+.\" Date: 06/25/2007
.\" Manual:
.\" Source:
.\"
-.TH "DBMAIL.CONF" "5" "06/24/2007" "" ""
+.TH "DBMAIL.CONF" "5" "06/25/2007" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
@@ -58,6 +58,8 @@ EFFECTIVE_GROUP=nogroup # are dropped down to the user/group specified here.
BINDIP=* # The IP address the services will bind to.
# Use * for all local interfaces.
# Use 127.0.0.1 for localhost only.
+ # Multiple addresses may be separated by commas.
+ # IPv6 addresses are not yet supported.
NCHILDREN=2 # Default number of child processes to start.
MAXCHILDREN=10 # Maximum number of child processes allowed.
MINSPARECHILDREN=2 # Unused children to always have availale.
@@ -84,31 +86,35 @@ library_directory=/usr/lib/dbmail # directory for locating libraries
.RS 3n
.nf
[LMTP]
-PORT=24 # Port to bind to.
+PORT=24 # Port to listen on.
+BANNER=Hello I am LMTP # Override the LMTP banner to hide your DBMail version.
.fi
.RE
.sp
.RS 3n
.nf
[POP]
-PORT=110 # Port to bind to.
+PORT=110 # Port to listen on.
POP_BEFORE_SMTP=no # If yes, allows SMTP access from the host IP connecting by POP3.
+BANNER=Hello I am POP3 # Override the POP3 banner to hide your DBMail version.
.fi
.RE
.sp
.RS 3n
.nf
[IMAP]
-PORT=143 # Port to bind to.
+PORT=143 # Port to listen on.
TIMEOUT=4000 # IMAP prefers a longer timeout than other services.
IMAP_BEFORE_SMTP=no # If yes, allows SMTP access from the host IP connecting by IMAP.
+BANNER=Hello I am IMAP # Override the IMAP banner to hide your DBMail version.
.fi
.RE
.sp
.RS 3n
.nf
[SIEVE]
-PORT=2000 # Port to bind to.
+PORT=2000 # Port to listen on.
+BANNER=Hello I am SIEVE # Override the ManageSieve banner to hide your DBMail version.
.fi
.RE
.sp
@@ -152,6 +158,7 @@ AUTO_REPLY=no # Use the auto_reply table to send away messages.
#AUTO_NOTIFY_SUBJECT # Defaults to "NEW MAIL NOTIFICATION"
#AUTO_NOTIFY_SENDER # Defaults to POSTMASTER from the DBMAIL section.
.fi
+.sp
.RE
.SH "BUGS"
If you experience inexplicable problems with DBMAil, please report the issue to the [1]\&\fIDBMail Bug Tracker\fR.
@@ -170,6 +177,7 @@ Koningsweg 4
3582 GE Utrecht
http://www.ic\-s.nl
.fi
+.sp
.RE
.SH "REFERENCES"
.TP 3
diff --git a/man/dbmail.conf.txt b/man/dbmail.conf.txt
index 916b24ce..c7e141f9 100644
--- a/man/dbmail.conf.txt
+++ b/man/dbmail.conf.txt
@@ -33,7 +33,7 @@ DESCRIPTION
default_msg_encoding=utf8 # Default for messages without a known encoding, e.g., iso8859-1, utf8
postmaster= # Postmaster's email address for use in bounce messages.
- sendmail=/usr/sbin/sendmail # Sendmail executable for forwards, replies, notifies, vacations.
+ sendmail=/usr/sbin/sendmail # Sendmail executable for forwards, replies, notifies, vacations.
# You may use pipes (|) in this command, for example:
# dos2unix|/usr/sbin/sendmail will work well with Qmail.
# You may use quotes (") for executables with unusual names.
@@ -46,6 +46,8 @@ DESCRIPTION
BINDIP=* # The IP address the services will bind to.
# Use * for all local interfaces.
# Use 127.0.0.1 for localhost only.
+ # Multiple addresses may be separated by commas.
+ # IPv6 addresses are not yet supported.
NCHILDREN=2 # Default number of child processes to start.
MAXCHILDREN=10 # Maximum number of child processes allowed.
MINSPARECHILDREN=2 # Unused children to always have availale.
@@ -54,8 +56,8 @@ DESCRIPTION
MAX_ERRORS=500 # Child process will restart after this many connection errors.
TIMEOUT=300 # Idle time allowed before a connection is shut off.
RESOLVE_IP=yes # If yes, resolves IP addresses to DNS names when logging.
- log=/var/log/dbmail.log # logfile for stdout messages
- error_log=/var/log/dbmail.err # logfile for stderr messages
+ log=/var/log/dbmail.log # logfile for stdout messages
+ error_log=/var/log/dbmail.err # logfile for stderr messages
pid_directory=/var/run # directory for storing PID files
state_directory=/var/run # directory for storing the daemon statefiles
library_directory=/usr/lib/dbmail # directory for locating libraries
@@ -64,19 +66,23 @@ DESCRIPTION
# In fact, there isn't anything here by default.
[LMTP]
- PORT=24 # Port to bind to.
+ PORT=24 # Port to listen on.
+ BANNER=Hello I am LMTP # Override the LMTP banner to hide your DBMail version.
[POP]
- PORT=110 # Port to bind to.
+ PORT=110 # Port to listen on.
POP_BEFORE_SMTP=no # If yes, allows SMTP access from the host IP connecting by POP3.
+ BANNER=Hello I am POP3 # Override the POP3 banner to hide your DBMail version.
[IMAP]
- PORT=143 # Port to bind to.
+ PORT=143 # Port to listen on.
TIMEOUT=4000 # IMAP prefers a longer timeout than other services.
IMAP_BEFORE_SMTP=no # If yes, allows SMTP access from the host IP connecting by IMAP.
+ BANNER=Hello I am IMAP # Override the IMAP banner to hide your DBMail version.
[SIEVE]
- PORT=2000 # Port to bind to.
+ PORT=2000 # Port to listen on.
+ BANNER=Hello I am SIEVE # Override the ManageSieve banner to hide your DBMail version.
[LDAP]
PORT=389
diff --git a/pop3.c b/pop3.c
index 53466c72..1b625325 100644
--- a/pop3.c
+++ b/pop3.c
@@ -97,8 +97,15 @@ int pop3_handle_connection(clientinfo_t * ci)
if (ci->tx) {
/* sending greeting */
- ci_write(ci->tx, "+OK DBMAIL pop3 server ready to rock %s\r\n",
- session.apop_stamp);
+ field_t banner;
+ GETCONFIGVALUE("banner", "POP", banner);
+ if (strlen(banner) > 0) {
+ ci_write(ci->tx, "+OK %s %s\r\n",
+ banner, session.apop_stamp);
+ } else {
+ ci_write(ci->tx, "+OK DBMAIL pop3 server ready to rock %s\r\n",
+ session.apop_stamp);
+ }
fflush(ci->tx);
} else {
TRACE(TRACE_MESSAGE, "TX stream is null!");
diff --git a/timsieve.c b/timsieve.c
index dacb76c3..c7c4b80c 100644
--- a/timsieve.c
+++ b/timsieve.c
@@ -36,7 +36,11 @@
#define MAX_IN_BUFFER 255
#define GREETING(stream) \
- ci_write(stream, "\"IMPLEMENTATION\" \"DBMail timsieved v%s\"\r\n", VERSION); \
+ GETCONFIGVALUE("banner", "SIEVE", banner); \
+ if (strlen(banner) > 0) \
+ ci_write(stream, "\"IMPLEMENTATION\" \"%s\"\r\n", banner); \
+ else \
+ ci_write(stream, "\"IMPLEMENTATION\" \"DBMail timsieved v%s\"\r\n", VERSION); \
ci_write(stream, "\"SASL\" \"PLAIN\"\r\n"); \
ci_write(stream, "\"SIEVE\" \"%s\"\r\n", sieve_extensions); \
ci_write(stream, "OK\r\n")
@@ -67,6 +71,7 @@ int tims_handle_connection(clientinfo_t * ci)
int done = 1; /* loop state */
char *buffer = NULL; /* connection buffer */
int cnt; /* counter */
+ field_t banner;
PopSession_t session; /* current connection session */
@@ -200,6 +205,7 @@ int tims(clientinfo_t *ci, char *buffer, PopSession_t * session)
char *command, *value;
int cmdtype;
int indx = 0;
+ field_t banner;
size_t tmplen = 0;
size_t tmppos = 0;