/[smeserver]/rpms/qpsmtpd/sme10/qpsmtpd-0.96-bz12450-auth_imap-perport.patch
ViewVC logotype

Contents of /rpms/qpsmtpd/sme10/qpsmtpd-0.96-bz12450-auth_imap-perport.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Mon Dec 18 17:41:50 2023 UTC (5 months ago) by jpp
Branch: MAIN
CVS Tags: qpsmtpd-0_96-22_el7_sme, HEAD
Changes since 1.1: +1 -1 lines
* Mon Dec 18 2023 Jean-Philippe Pialasse <tests@pialasse.com> 0.96-22.sme
- transpose auth_cvm behaviour to auth_imap [SME: 12450]
  ability to enable for ssmtp and not smtp

1 diff -Nur --no-dereference qpsmtpd-0.96.old/plugins/auth/auth_imap qpsmtpd-0.96/plugins/auth/auth_imap
2 --- qpsmtpd-0.96.old/plugins/auth/auth_imap 2016-02-16 17:52:02.000000000 -0500
3 +++ qpsmtpd-0.96/plugins/auth/auth_imap 2023-12-18 12:14:23.581000000 -0500
4 @@ -25,17 +25,30 @@
5 relay or a primary mail server. The principal benefit is ease of adminstration when
6 an existing IMAP service is already established.
7
8 -head1 AUTHOR Christopher Heschong
9 +=head1 AUTHOR Christopher Heschong
10
11 Edits to add SSL support and updated for latest qpsmtpd version - James Turnbull <james@lovedthanlost.net>
12
13 =head1 COPYRIGHT AND LICENSE Copyright (c) 2004 Christopher Heschong
14 This plugin is licensed under the same terms as the qpsmtpd package itself.
15 Please see the LICENSE file included with qpsmtpd for details.
16 +
17 +=head1 SYNOPSIS
18 +
19 +In config/plugins:
20 +
21 + auth/auth_imap \
22 + enable_smtp no \
23 + enable_ssmtp yes
24
25 =cut
26
27 use Net::IMAP::Simple;
28 +use Qpsmtpd::Constants;
29 +
30 +use Socket;
31 +use constant SMTP_PORT => getservbyname("smtp", "tcp") || 25;
32 +use constant SSMTP_PORT => getservbyname("ssmtp", "tcp") || 465;
33
34 sub register {
35 my ($self, $qp, @args) = @_;
36 @@ -51,16 +64,35 @@
37 if (@args > 1 and $args[1] =~ /^(\d+)$/) {
38 $self->{_imap_port} = $1;
39 }
40 + if (@args > 2 and ($args[3] eq "enable_smtp" ) ) {
41 + $self->{_enable_smtp}= $args[4] || 'no';
42 + }
43 + if (@args > 4 and ( $args[5] eq "enable_ssmtp" )) {
44 + $self->{_enable_ssmtp} = $args[6] || 'yes';
45 + }
46 $self->log(LOGWARN, "WARNING: Ignoring additional arguments.")
47 - if (@args > 2);
48 + if (@args > 6);
49 }
50 else {
51 die("No IMAP server specified in plugins file.");
52 }
53
54 # set any values that are not already
55 - $self->{_imap_server} ||= "127.0.0.1";
56 - $self->{_imap_port} ||= 143;
57 + $self->{_imap_server} ||= "127.0.0.1";
58 + $self->{_imap_port} ||= 143;
59 + $self->{_enable_smtp} ||= 'no';
60 + $self->{_enable_ssmtp} ||= 'yes';
61 +
62 + my $port = $ENV{PORT} || SMTP_PORT;
63 +
64 + if ($self->{_enable_smtp} ne 'yes' && ($port == SMTP_PORT || $port == 587)) {
65 + $self->log(LOGDEBUG, "skip: enable_smtp=no");
66 + return 0;
67 + }
68 + if ($port == SSMTP_PORT && $self->{_enable_ssmtp} ne 'yes') {
69 + $self->log(LOGDEBUG, "skip: enable_ssmtp=no");
70 + return 0;
71 + };
72
73 $self->register_hook("auth-login", "auth_imap");
74 $self->register_hook("auth-plain", "auth_imap");

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed