Email Publisher with LDAP and Multiple Domains

22 views
Skip to first unread message

Lewis Green

unread,
Mar 16, 2013, 6:53:44 PM3/16/13
to ccnet...@googlegroups.com
Hi,

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)
{         
if(username.Contains("\\"))
{
//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)
                    {
                        break;
                    }
                }

                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.

Thanks

Ruben Willems

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

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 :
http://www.cruisecontrolnet.org/projects/ccnet/issues


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 ccnet-devel...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages