Email Publisher with LDAP and Multiple Domains

Skip to first unread message

Lewis Green

Mar 16, 2013, 6:53:44 PM3/16/13

We have had CruiseControl in our build environment for 8 months now but we had to take a fork of the code to repair a bug that I would like to see going back into the main code stream so that we can upgrade as we are a few versions behind.

If you define multiple LDAP converters then the foreach loop iterates through each of these, which is fine, but if you get a match on the first converter and not on one of following converters then the email address is set back to null on the code. 

If your login is for a domain that is not the same domain as the CI server then the username is not "USERNAME" it is "DOMAIN\USERNAME", so in the LDAP converter this must be considered and stripped if it's on there. 

For our CI system the solution was very few lines of code:

Firstly EmailLDAPConverter.cs:

public string Convert(string username)
//then its a DOMAIN\USERNAME
var tmpUsername = username.Split(new[] {'\\'});
username = tmpUsername[1];
if(tmpUsername[0].ToLower() != domainName.ToLower())
return null;

For EmailMessage.cs:

if (user == null && emailPublisher.Converters.Length > 0)
                string email = username;
                foreach (IEmailConverter converter in emailPublisher.Converters)
                    email = converter.Convert(username);
                    if(email != null)

                if (email != null)
                    user = new EmailUser(username, group, email);

As you can see, the changes made were very simple, the LDAP converter did a string check and strip, and the EmailMessage had a break line added.

I hope someone can help us get this into the main stream.


Ruben Willems

Sep 17, 2013, 7:18:52 AM9/17/13
to ccnet-devel

can you make this as a patch?
I do not have a second domain to test with, so where to exactly put the changes is not very clear from this mail :-(

you may also make a bug report for this :

with kind regards
Ruben Willems

You received this message because you are subscribed to the Google Groups "ccnet-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Reply all
Reply to author
0 new messages