You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Mike K <mo...@hotmail.com> on 2002/03/09 00:40:02 UTC
Re: Re: javax.mail.Session access protection
Hi Serge
I have verified the problem with a test. Please can you (or somebody else)
verify it too.
Test description and source code is below.
Thanx a lot
Bye michi
Test:
start JAMES...
... add an user called "test"
... then compile and run JAMESMailSessionHackTest
javac -classpath .;mail.jar JAMESMailSessionHackTest.java
java -classpath .;mail.jar;activation.jar JAMESMailSessionHackTest
... then open an email client application(e.g.. outlook express) and
connect to the JAMES test user account.
... then check the inbox. An email should be arrived with the
subject "JAMESMailSessionHackTest....!!!!!!!!!!!!!!!!!!!"
OS:
Windows 2000
JAMES version:
JAMES 1.2.2
JavaMail version:
JavaMail 1.2
The source:
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
/**
* This class gets the default mail session from JAMES
* and sends an email to test@localhost.
*
* @author Michael Kaegi (kam@brainware.ch)
* @version 1.0
*/
public class JAMESMailSessionHackTest {
private Session session;
public static void main(String[] args) {
JAMESMailSessionHackTest jt = new JAMESMailSessionHackTest();
jt.getMailSession();
jt.sendMail();
}
private void getMailSession() {
Properties props = new Properties();
session = Session.getDefaultInstance(props, null);
}
private void sendMail() {
try {
System.out.println("Session mail.smtp.host: " +
session.getProperty("mail.smtp.host"));
System.out.println("Session mail.user: " +
session.getProperty("mail.user"));
MimeMessage mm = new MimeMessage(session);
mm.setFrom(new
InternetAddress("JAMESMailSessionHackTest@brainware.ch"));
mm.addRecipient(Message.RecipientType.TO, new
InternetAddress("test@localhost"));
mm.setSubject("JAMESMailSessionHackTest....!!!!!!!!!!!!!!!!!!!");
mm.setText("Suprise.");
Transport.send(mm);
} catch(Exception e) {
System.out.println("Exception: ");
System.out.println(e);
e.printStackTrace();
}
}
}
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Re: javax.mail.Session access protection
Posted by Serge Knystautas <se...@lokitech.com>.
What are you testing? You've included a software that connects to the local
mail server and sends a message to "test@localhost". What are you expecting
it to do?
Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/
----- Original Message -----
From: "Mike K" <mo...@hotmail.com>
To: <ja...@jakarta.apache.org>
Sent: Friday, March 08, 2002 11:40 PM
Subject: Re: Re: javax.mail.Session access protection
> Hi Serge
>
> I have verified the problem with a test. Please can you (or somebody else)
> verify it too.
>
> Test description and source code is below.
>
> Thanx a lot.
>
> Bye michi
>
>
> Test:
>
> start JAMES...
>
> ... add an user called "test"
>
> ... then compile and run JAMESMailSessionHackTest
> javac -classpath .;mail.jar JAMESMailSessionHackTest.java
> java -classpath .;mail.jar;activation.jar JAMESMailSessionHackTest
>
> ... then open an email client application(e.g.. outlook express) and
> connect to the JAMES test user account.
>
> ... then check the inbox. An email should be arrived with the
> subject "JAMESMailSessionHackTest....!!!!!!!!!!!!!!!!!!!"
>
>
> OS:
> Windows 2000
>
> JAMES version:
> JAMES 1.2.2
>
> JavaMail version:
> JavaMail 1.2
>
>
> The source:
>
>
> import java.util.*;
>
> import javax.mail.*;
> import javax.mail.internet.*;
>
> /**
> * This class gets the default mail session from JAMES
> * and sends an email to test@localhost.
> *
> * @author Michael Kaegi (kam@brainware.ch)
> * @version 1.0
> */
> public class JAMESMailSessionHackTest {
>
> private Session session;
>
> public static void main(String[] args) {
>
> JAMESMailSessionHackTest jt = new JAMESMailSessionHackTest();
> jt.getMailSession();
> jt.sendMail();
> }
>
> private void getMailSession() {
>
> Properties props = new Properties();
> session = Session.getDefaultInstance(props, null);
> }
>
> private void sendMail() {
>
> try {
>
> System.out.println("Session mail.smtp.host: " +
> session.getProperty("mail.smtp.host"));
> System.out.println("Session mail.user: " +
> session.getProperty("mail.user"));
>
> MimeMessage mm = new MimeMessage(session);
> mm.setFrom(new
> InternetAddress("JAMESMailSessionHackTest@brainware.ch"));
> mm.addRecipient(Message.RecipientType.TO, new
> InternetAddress("test@localhost"));
>
> mm.setSubject("JAMESMailSessionHackTest....!!!!!!!!!!!!!!!!!!!");
> mm.setText("Suprise.");
> Transport.send(mm);
>
> } catch(Exception e) {
>
> System.out.println("Exception: ");
> System.out.println(e);
> e.printStackTrace();
> }
> }
> }
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>