cvs commit: qpsmtpd/lib/Qpsmtpd SMTP.pm
[email protected] (Ask Bjoern Hansen)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 03/04/15 10:38:46
Modified: . Changes README.plugins
config plugins
lib/Qpsmtpd SMTP.pm
Log:
unrecognized_command hook and a count_unrecognized_commands
plugin. (Rasjid Wilcox)
Revision Changes Path
1.38 +3 -0 qpsmtpd/Changes
Index: Changes
===================================================================
RCS file: /cvs/public/qpsmtpd/Changes,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -w -r1.37 -r1.38
--- Changes 15 Apr 2003 17:01:43 -0000 1.37
+++ Changes 15 Apr 2003 17:38:45 -0000 1.38
@@ -1,5 +1,8 @@
0.26-dev
+ unrecognized_command hook and a count_unrecognized_commands
+ plugin. (Rasjid Wilcox)
+
check_earlytalker plugin. Deny the connection if the client talks
before we show our SMTP banner. (From Devin Carraway)
1.6 +8 -0 qpsmtpd/README.plugins
Index: README.plugins
===================================================================
RCS file: /cvs/public/qpsmtpd/README.plugins,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- README.plugins 18 Mar 2003 09:45:55 -0000 1.5
+++ README.plugins 15 Apr 2003 17:38:45 -0000 1.6
@@ -125,6 +125,14 @@
DECLINED - Qpsmtpd will send the standard HELO message
+=head2 unrecognized_command
+
+Called when we get a command that isn't recognized.
+
+ DENY - Return 521 and disconnect the client
+ DONE - Qpsmtpd won't do anything; the plugin responded
+ Anything else - Return '500 Unrecognized command'
+
=head2 disconnect
Called just before we shutdown a connection.
1.8 +2 -0 qpsmtpd/config/plugins
Index: plugins
===================================================================
RCS file: /cvs/public/qpsmtpd/config/plugins,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- plugins 15 Apr 2003 17:01:43 -0000 1.7
+++ plugins 15 Apr 2003 17:38:45 -0000 1.8
@@ -9,6 +9,8 @@
quit_fortune
#check_earlytalker
+count_unrecognized_commands 4
+
require_resolvable_fromhost
rhsbl
1.11 +14 -2 qpsmtpd/lib/Qpsmtpd/SMTP.pm
Index: SMTP.pm
===================================================================
RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/SMTP.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -r1.10 -r1.11
--- SMTP.pm 15 Apr 2003 17:01:43 -0000 1.10
+++ SMTP.pm 15 Apr 2003 17:38:46 -0000 1.11
@@ -46,8 +46,20 @@
#$self->respond(553, $state{dnsbl_blocked}), return 1
# if $state{dnsbl_blocked} and ($cmd eq "rcpt");
- $self->respond(500, "Unrecognized command"), return 1
- if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1});
+ if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1}) {
+ my ($rc, $msg) = $self->run_hooks("unrecognized_command", $cmd);
+ if ($rc == DENY) {
+ $self->respond(521, $msg);
+ $self->disconnect;
+ }
+ elsif ($rc == DONE) {
+ 1;
+ }
+ else {
+ $self->respond(500, "Unrecognized command");
+ }
+ return 1
+ }
$cmd = $1;
if (1 or $self->{_commands}->{$cmd} and $self->can($cmd)) {