Skip to content
Permalink
Browse files

[FIXED JENKINS-24214] SECURITY-152 fix broke test email sending.

  • Loading branch information...
jglick committed Aug 18, 2014
1 parent af48332 commit afbe1ff7d12991d3b749660542aa24af9a576b70
Showing with 7 additions and 4 deletions.
  1. +6 −3 src/main/java/hudson/tasks/Mailer.java
  2. +1 −1 src/main/resources/hudson/tasks/Mailer/global.jelly
@@ -500,13 +500,16 @@ public FormValidation doCheckDefaultSuffix(@QueryParameter String value) {
*/
public FormValidation doSendTestMail(
@QueryParameter String smtpServer, @QueryParameter String adminAddress, @QueryParameter boolean useSMTPAuth,
@QueryParameter String smtpAuthUserName, @QueryParameter String smtpAuthPassword,
@QueryParameter String smtpAuthUserName, @QueryParameter Secret smtpAuthPasswordSecret,
@QueryParameter boolean useSsl, @QueryParameter String smtpPort, @QueryParameter String charset,
@QueryParameter String sendTestMailTo) throws IOException, ServletException, InterruptedException {
try {
if (!useSMTPAuth) smtpAuthUserName = smtpAuthPassword = null;
if (!useSMTPAuth) {
smtpAuthUserName = null;
smtpAuthPasswordSecret = null;
}

MimeMessage msg = new MimeMessage(createSession(smtpServer,smtpPort,useSsl,smtpAuthUserName,Secret.fromString(smtpAuthPassword)));
MimeMessage msg = new MimeMessage(createSession(smtpServer, smtpPort, useSsl, smtpAuthUserName, smtpAuthPasswordSecret));
msg.setSubject(Messages.Mailer_TestMail_Subject(++testEmailCount), charset);
msg.setText(Messages.Mailer_TestMail_Content(testEmailCount, Jenkins.getInstance().getDisplayName()), charset);
msg.setFrom(StringToAddress(adminAddress, charset));
@@ -58,7 +58,7 @@ THE SOFTWARE.
<f:entry title="${%Test e-mail recipient}">
<f:textbox name="sendTestMailTo"/>
</f:entry>
<f:validateButton method="sendTestMail" title="${%Test configuration}" with="sendTestMailTo,smtpServer,adminAddress,useSMTPAuth,smtpAuthUserName,smtpAuthPassword,useSsl,smtpPort,charset" />
<f:validateButton method="sendTestMail" title="${%Test configuration}" with="sendTestMailTo,smtpServer,adminAddress,useSMTPAuth,smtpAuthUserName,smtpAuthPasswordSecret,useSsl,smtpPort,charset" />
</f:optionalBlock>
</f:section>
</j:jelly>

0 comments on commit afbe1ff

Please sign in to comment.
You can’t perform that action at this time.