Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28594

Leading underscore added to committers email address.

      When automatic e-mails to committers are triggered, the domain name with underscore is added to the mail address.

      For example:
      Domain user 'domain/user' e-mail should be 'user@mailserver.com', instead, the mail is sent to 'domain_user@mailserver.com'.

          [JENKINS-28594] Leading underscore added to committers email address.

          Alex Earl added a comment -

          Are you sure the activedirectory plugin is the one returning the addresses? The email-ext plugin uses the MailAddressResolver from Mailer to resolve addresses for users. So, this isn't a bug with email-ext.

          Alex Earl added a comment - Are you sure the activedirectory plugin is the one returning the addresses? The email-ext plugin uses the MailAddressResolver from Mailer to resolve addresses for users. So, this isn't a bug with email-ext.

          nir h added a comment -

          Not sure which plugin exactly causes this issue.

          nir h added a comment - Not sure which plugin exactly causes this issue.

          Alex Earl added a comment -

          can you enable the logger for hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl at the FINE level and see what the logs show for when the address is resolved?

          Alex Earl added a comment - can you enable the logger for hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl at the FINE level and see what the logs show for when the address is resolved?

          nir h added a comment -

          Here is it (I switched my domain and user name with [myDomain] and [myUserName]:

          May 28, 2015 4:45:15 PM FINE hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl
          Failed to look up Active Directory for e-mail address
          org.acegisecurity.userdetails.UsernameNotFoundException: No such user or group: [myDomain]_[myUserName]
          at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.getDnOfUserOrGroup(ActiveDirectoryAuthenticationProvider.java:220)
          at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.retrieveUser(ActiveDirectoryAuthenticationProvider.java:107)
          at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:53)
          at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:54)
          at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122)
          at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:560)
          at hudson.plugins.tfs.model.TfsUserLookup.find(TfsUserLookup.java:32)
          at hudson.plugins.tfs.model.Project.convertServerChangeset(Project.java:63)
          at hudson.plugins.tfs.model.Project.getVCCHistory(Project.java:110)
          at hudson.plugins.tfs.model.Project.getDetailedHistory(Project.java:130)
          at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:38)
          at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:214)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
          at hudson.model.Run.execute(Run.java:1744)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:374)

          nir h added a comment - Here is it (I switched my domain and user name with [myDomain] and [myUserName] : May 28, 2015 4:45:15 PM FINE hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl Failed to look up Active Directory for e-mail address org.acegisecurity.userdetails.UsernameNotFoundException: No such user or group: [myDomain] _ [myUserName] at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.getDnOfUserOrGroup(ActiveDirectoryAuthenticationProvider.java:220) at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.retrieveUser(ActiveDirectoryAuthenticationProvider.java:107) at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:53) at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:54) at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122) at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:560) at hudson.plugins.tfs.model.TfsUserLookup.find(TfsUserLookup.java:32) at hudson.plugins.tfs.model.Project.convertServerChangeset(Project.java:63) at hudson.plugins.tfs.model.Project.getVCCHistory(Project.java:110) at hudson.plugins.tfs.model.Project.getDetailedHistory(Project.java:130) at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:38) at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:214) at hudson.model.AbstractProject.checkout(AbstractProject.java:1276) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532) at hudson.model.Run.execute(Run.java:1744) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374)

          Alex Earl added a comment -

          How does TFS store your username? Can you add a logger for "hudson.plugins.tfs.model.TfsUserLookup" as well?

          Alex Earl added a comment - How does TFS store your username? Can you add a logger for "hudson.plugins.tfs.model.TfsUserLookup" as well?

          nir h added a comment -

          I don't know how TFS stores my username.
          Adding "hudson.plugins.tfs.model.TfsUserLookup" added the following line before the ActiveDirectoryMailAddressResolverImpl log:
          "
          May 28, 2015 6:28:37 PM FINE hudson.plugins.tfs.model.TfsUserLookup
          Looking up Jenkins user for TFS account '%s'.
          "

          nir h added a comment - I don't know how TFS stores my username. Adding "hudson.plugins.tfs.model.TfsUserLookup" added the following line before the ActiveDirectoryMailAddressResolverImpl log: " May 28, 2015 6:28:37 PM FINE hudson.plugins.tfs.model.TfsUserLookup Looking up Jenkins user for TFS account '%s'. "

          Alex Earl added a comment -

          Oh, that's fantastic...they don't have the value for the account name. What my guess is happening is that the user account name comes in as domain\username, this is passed to the MailAddressResolver, which converts the \ into a _. It doesn't find a user in the Jenkins database with that account and so it can't resolve the address correctly. Can you go to http://YOURSERVER/jenkins/asynchPeople/ and see if there are user accounts in the form of domain_user?

          Alex Earl added a comment - Oh, that's fantastic...they don't have the value for the account name. What my guess is happening is that the user account name comes in as domain\username, this is passed to the MailAddressResolver, which converts the \ into a _. It doesn't find a user in the Jenkins database with that account and so it can't resolve the address correctly. Can you go to http://YOURSERVER/jenkins/asynchPeople/ and see if there are user accounts in the form of domain_user?

          nir h added a comment -

          The user IDs are in the form of "domain_user", user accounts are in the form of "domain\user".

          nir h added a comment - The user IDs are in the form of "domain_user", user accounts are in the form of "domain\user".

          Alex Earl added a comment -

          You mean in TFS or in Jenkins? If you view one of the people, does the account have a valid email address specified? On a side note, I submitted a PR to fix the logging in the TFS plugin.

          Alex Earl added a comment - You mean in TFS or in Jenkins? If you view one of the people, does the account have a valid email address specified? On a side note, I submitted a PR to fix the logging in the TFS plugin.

          Alex Earl added a comment -

          Adding a logger for hudson.tasks.MailAddressResolver would be interesting too.

          Alex Earl added a comment - Adding a logger for hudson.tasks.MailAddressResolver would be interesting too.

          nir h added a comment -

          I mean the user IDs on link you sent me (not sure if this means Jenkins or TFS).
          If I check the configuration for specific user, it shows the email with the "domain_" prefix.

          nir h added a comment - I mean the user IDs on link you sent me (not sure if this means Jenkins or TFS). If I check the configuration for specific user, it shows the email with the "domain_" prefix.

          nir h added a comment -

          May 29, 2015 12:23:36 PM FINE hudson.tasks.MailAddressResolver
          Resolving e-mail address for "domain\user" ID=domain_user

          nir h added a comment - May 29, 2015 12:23:36 PM FINE hudson.tasks.MailAddressResolver Resolving e-mail address for "domain\user" ID=domain_user

          Alex Earl added a comment -

          If you delete the email for one of the users, it would help to see what is setting the email addresses to the domain_user@foo.com (along with adding the logger for hudson.tasks.MailAddressResolver).

          Alex Earl added a comment - If you delete the email for one of the users, it would help to see what is setting the email addresses to the domain_user@foo.com (along with adding the logger for hudson.tasks.MailAddressResolver).

          nir h added a comment -

          Deleted, all logs and behaviors remained the same.

          nir h added a comment - Deleted, all logs and behaviors remained the same.

          Alex Earl added a comment -

          Can you delete the user itself from Jenkins?

          I'm trying to get the MailAddressResolver to get to this point: https://github.com/jenkinsci/mailer-plugin/blob/master/src/main/java/hudson/tasks/MailAddressResolver.java#L120

          Which should tell which MailAddressResolver is resolving the address.

          Alex Earl added a comment - Can you delete the user itself from Jenkins? I'm trying to get the MailAddressResolver to get to this point: https://github.com/jenkinsci/mailer-plugin/blob/master/src/main/java/hudson/tasks/MailAddressResolver.java#L120 Which should tell which MailAddressResolver is resolving the address.

          nir h added a comment -

          Deleted, still the same...

          May 31, 2015 11:52:50 AM FINE hudson.plugins.tfs.model.TfsUserLookup
          Looking up Jenkins user for TFS account '%s'.
          May 31, 2015 11:52:50 AM FINE hudson.tasks.MailAddressResolver
          Resolving e-mail address for "domain_user" ID=domain_user
          May 31, 2015 11:52:50 AM FINE hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl
          Failed to look up Active Directory for e-mail address
          org.acegisecurity.userdetails.UsernameNotFoundException: No such user or group: domain_user
          at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.getDnOfUserOrGroup(ActiveDirectoryAuthenticationProvider.java:220)
          at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.retrieveUser(ActiveDirectoryAuthenticationProvider.java:107)
          at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:53)
          at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:54)
          at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122)
          at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:560)
          at hudson.plugins.tfs.model.TfsUserLookup.find(TfsUserLookup.java:32)
          at hudson.plugins.tfs.model.Project.convertServerChangeset(Project.java:63)
          at hudson.plugins.tfs.model.Project.getVCCHistory(Project.java:110)
          at hudson.plugins.tfs.model.Project.getDetailedHistory(Project.java:130)
          at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:38)
          at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:214)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
          at hudson.model.Run.execute(Run.java:1744)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:374)

          nir h added a comment - Deleted, still the same... May 31, 2015 11:52:50 AM FINE hudson.plugins.tfs.model.TfsUserLookup Looking up Jenkins user for TFS account '%s'. May 31, 2015 11:52:50 AM FINE hudson.tasks.MailAddressResolver Resolving e-mail address for "domain_user" ID=domain_user May 31, 2015 11:52:50 AM FINE hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl Failed to look up Active Directory for e-mail address org.acegisecurity.userdetails.UsernameNotFoundException: No such user or group: domain_user at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.getDnOfUserOrGroup(ActiveDirectoryAuthenticationProvider.java:220) at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.retrieveUser(ActiveDirectoryAuthenticationProvider.java:107) at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:53) at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:54) at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122) at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:560) at hudson.plugins.tfs.model.TfsUserLookup.find(TfsUserLookup.java:32) at hudson.plugins.tfs.model.Project.convertServerChangeset(Project.java:63) at hudson.plugins.tfs.model.Project.getVCCHistory(Project.java:110) at hudson.plugins.tfs.model.Project.getDetailedHistory(Project.java:130) at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:38) at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:214) at hudson.model.AbstractProject.checkout(AbstractProject.java:1276) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532) at hudson.model.Run.execute(Run.java:1744) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374)

          Alex Earl added a comment -

          If you are willing, could you try the following TFS plugin that fixes the logging to output the actual username? I'm interested in seeing where the username is getting changed to domain_username.

          https://jenkins.ci.cloudbees.com/job/plugins/job/tfs-plugin/99/org.jenkins-ci.plugins$tfs/artifact/org.jenkins-ci.plugins/tfs/3.2.1-SNAPSHOT/tfs-3.2.1-SNAPSHOT.hpi

          Alex Earl added a comment - If you are willing, could you try the following TFS plugin that fixes the logging to output the actual username? I'm interested in seeing where the username is getting changed to domain_username. https://jenkins.ci.cloudbees.com/job/plugins/job/tfs-plugin/99/org.jenkins-ci.plugins$tfs/artifact/org.jenkins-ci.plugins/tfs/3.2.1-SNAPSHOT/tfs-3.2.1-SNAPSHOT.hpi

          Alex Earl added a comment -

          Not enough information to debug the issue.

          Alex Earl added a comment - Not enough information to debug the issue.

            Unassigned Unassigned
            nir_hp nir h
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: