View Issue Details

IDProjectCategoryView StatusLast Update
0001061SOGoBackend Mailpublic2012-11-26 18:15
Reporterlpgauthier Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.3.4 
Fixed in Version2.0.3 
Summary0001061: Sieve Server from mailHost in LDAP
Description

If a mailHost is specified in config (from Ldap), allow the system administrator to configure the system to use this parameter.

Sieve is always (?) on the Imap server, we can't hardcode the parameter

SOGoSieveServer = sieve://10.10.10.10:2000/

if we have the

IMAPHostFieldName = mailHost

in the SOGoUserSources.

thanks,

TagsNo tags attached.

Activities

ludovic

ludovic

2011-02-15 21:31

administrator   ~0002112

A slight problem with this is the TCP port to which we should connect for the "ManageSieve" daemon.

Cyrus defaults to 2000 on most Linux distributions while Dovecot defaults to 4190.

lpgauthier

lpgauthier

2011-02-28 17:21

reporter   ~0002172

Debian Squeeze (6.0) change default Sieve port 2000 to 4190 .
See http://www.debian.org/releases/stable/amd64/release-notes/ch-information.en.html#sieve-port-number

ludovic

ludovic

2011-02-28 21:34

administrator   ~0002173

That re-enforces my point. Sometimes it's 2000, sometimes it's 4190 - we can't assume things.

ludovic

ludovic

2011-03-04 00:15

administrator   ~0002187

Demoted until we find a nice way to specify the Sieve port when falling back on the LDAP attribute for the IMAP server.

lpgauthier

lpgauthier

2011-03-11 20:09

reporter   ~0002255

I think you can assume that the sieve port is the same on all server in the same organization. If not, user can configure sieve port on each server to be the same.

vykupitel

vykupitel

2011-04-05 18:54

reporter   ~0002336

Why not to specify Sieve host like IMAP host with LDAP attribute? For example SIEVEHostFieldName.

SlavekB

SlavekB

2012-07-09 16:23

reporter   ~0004114

I needed to solve the same problem. As there is no ready solution, and as I prepared a patch for a similar problem with setting IMAPs together with using IMAPHostFieldName (see bug 0001866), I have prepared the same solution for the problem reported here - setting Sieve server using LDAP mailHost.

In proposed patch is used SOGoSieveServer as template in which the host name will be replaced by the value of IMAPHostFieldName.

Incidentally, when preparing patches, I noticed that while the comment states that SOGoSieveServer set to "server" or "server:port" are not supported, a few lines below is exactly in this way set the Sieve server using an IMAP server name. Proposed patch also fixes this problem.

2012-07-09 16:24

 

sieve-ldap-hostname.diff (2,255 bytes)   
Index: b/SoObjects/SOGo/SOGoSieveManager.m
===================================================================
--- a/SoObjects/SOGo/SOGoSieveManager.m	2012-07-04 18:57:44.000000000 +0200
+++ b/SoObjects/SOGo/SOGoSieveManager.m	2012-07-04 20:13:17.000000000 +0200
@@ -38,6 +38,7 @@
 #import "../Mailer/SOGoMailAccount.h"
 
 #import "SOGoSieveManager.h"
+#import "SOGoUserManager.h"
 
 typedef enum {
   UIxFilterFieldTypeAddress,
@@ -623,10 +624,12 @@
   NSMutableArray *req;
   NSMutableString *script, *header;
   NSDictionary *result, *values;
+  NSDictionary *contactInfos;
+  SOGoUserManager *um;
   SOGoUserDefaults *ud;
   SOGoDomainDefaults *dd;
   NGSieveClient *client;
-  NSString *filterScript, *v, *sieveServer;
+  NSString *filterScript, *v, *sieveScheme, *sieveServer, *sieveQuery, *ldapImapServer;
   NSURL *url;
   
   int sievePort;
@@ -749,10 +752,16 @@
   //
   // Values such as "localhost" or "localhost:2000" are NOT supported.
   //
+  sieveScheme = @"sieve";
   sieveServer = [dd sieveServer];
   sievePort = 2000;
-  url = nil;
-      
+  sieveQuery = @"";
+  url = [NSURL URLWithString: sieveServer];
+
+  if ([url scheme])
+    sieveScheme = [url scheme];
+  if ([url host])
+    sieveServer = [url host];
   if (!sieveServer)
     {
       NSString *s;
@@ -770,16 +779,23 @@
 	  else
 	    sieveServer = s;
 	}
-      else
-	sieveServer = @"localhost";
-      
-      url = [NSURL URLWithString: [NSString stringWithFormat: @"%@:%d", sieveServer, sievePort]];
-    }
-  else
-    {
-      url = [NSURL URLWithString: sieveServer];
     }
 
+  um = [SOGoUserManager sharedUserManager];
+  contactInfos = [um contactInfosForUserWithUIDorEmail: theLogin ];
+  ldapImapServer = [contactInfos objectForKey: @"c_imaphostname"];
+  if (ldapImapServer)
+    sieveServer = ldapImapServer;
+  if (!sieveServer)
+    sieveServer = @"localhost";
+  if ([url port])
+    sievePort = [[url port] intValue];
+  if ([url query])
+    sieveQuery = [NSString stringWithFormat: @"/?%@", [url query]];
+      
+  url = [NSURL URLWithString: [NSString stringWithFormat: @"%@://%@:%d%@",
+                               sieveScheme, sieveServer, sievePort, sieveQuery]];
+
   client = [[NGSieveClient alloc] initWithURL: url];
   
   if (!client) {
sieve-ldap-hostname.diff (2,255 bytes)   
ludovic

ludovic

2012-11-26 18:15

administrator   ~0004979

Bug fixed: https://github.com/inverse-inc/sogo/commit/7c250fad8fbee5c51dd655af23058c20a710db82

We can now define the SieveHostFieldName in LDAP/SQL sources.

The proposed patch was invalid, as IMAPHostFieldName doesn't necessarily contain just the server name, but it could also contain the protocol and port information.

Issue History

Date Modified Username Field Change
2010-12-23 17:39 lpgauthier New Issue
2011-02-03 18:31 francis Target Version => 1.3.6
2011-02-15 21:31 ludovic Note Added: 0002112
2011-02-28 17:21 lpgauthier Note Added: 0002172
2011-02-28 21:34 ludovic Note Added: 0002173
2011-03-04 00:15 ludovic Note Added: 0002187
2011-03-04 00:15 ludovic Target Version 1.3.6 =>
2011-03-11 20:09 lpgauthier Note Added: 0002255
2011-04-05 18:54 vykupitel Note Added: 0002336
2012-07-09 16:23 SlavekB Note Added: 0004114
2012-07-09 16:24 SlavekB File Added: sieve-ldap-hostname.diff
2012-11-26 18:15 ludovic Note Added: 0004979
2012-11-26 18:15 ludovic Status new => closed
2012-11-26 18:15 ludovic Resolution open => fixed
2012-11-26 18:15 ludovic Fixed in Version => 2.0.3