Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 6604 invoked from network); 16 Oct 2009 13:53:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Oct 2009 13:53:55 -0000 Received: (qmail 88075 invoked by uid 500); 16 Oct 2009 13:53:55 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 88005 invoked by uid 500); 16 Oct 2009 13:53:55 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 87997 invoked by uid 99); 16 Oct 2009 13:53:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Oct 2009 13:53:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Oct 2009 13:53:52 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 607FF234C1EE for ; Fri, 16 Oct 2009 06:53:31 -0700 (PDT) Message-ID: <54207489.1255701211394.JavaMail.jira@brutus> Date: Fri, 16 Oct 2009 06:53:31 -0700 (PDT) From: "Simon von Janowsky (JIRA)" To: dev@geronimo.apache.org Subject: [jira] Updated: (GERONIMO-4910) Problem in geronimo-javamail_1.4_spec In-Reply-To: <479971628.1255700971414.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/GERONIMO-4910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Simon von Janowsky updated GERONIMO-4910: ----------------------------------------- Description: When a url ist set to receive email, the username is extracted correctly using UrlName class, but when querying the imap server the system defined username is used instead. This is because the username in the connect Method in Service.java overrides the username from the url. See this code excerpt from javax.mail.Service.class in geronimo-javamail_1.4_spec-1.6.jar class: Service.java method: connect(String host, int port, String user, String password) {code:title=Service.java|borderStyle=solid} if (user == null) { // first choice is from the url, if we have if (url != null) { user = url.getUsername(); // make sure we get the password from the url, if we can. if (password == null) { password = url.getPassword(); } // user still null? We have several levels of properties to try yet if (user == null) { if (protocol != null) { user = session.getProperty("mail." + protocol + ".user"); } } } // this may still be null...get the global mail property if (user == null) { user = session.getProperty("mail.user"); } // finally, we try getting the system defined user name try { // HERE THE USER IS ALWAYS OVERWRITTEN user = System.getProperty("user.name"); } catch (SecurityException e) { // we ignore this, and just us a null username. } } {code} With kind regards, Simon von Janowsky was: When a url ist set to receive email, the username is extracted correctly using UrlName class, but when querying the imap server the system defined username is used instead. This is because the username in the connect Method in Service.java overrides the username from the url. See this code excerpt from javax.mail.Service.class in geronimo-javamail_1.4_spec-1.6.jar class: Service.java method: connect(String host, int port, String user, String password) {code:title=Service.java|borderStyle=solid} if (user == null) { // first choice is from the url, if we have if (url != null) { user = url.getUsername(); // make sure we get the password from the url, if we can. if (password == null) { password = url.getPassword(); } // user still null? We have several levels of properties to try yet if (user == null) { if (protocol != null) { user = session.getProperty("mail." + protocol + ".user"); } } } // this may still be null...get the global mail property if (user == null) { user = session.getProperty("mail.user"); } // finally, we try getting the system defined user name // HERE THE USER IS ALWAYS OVERWRITTEN // HERE THE USER IS ALWAYS OVERWRITTEN // HERE THE USER IS ALWAYS OVERWRITTEN try { user = System.getProperty("user.name"); } catch (SecurityException e) { // we ignore this, and just us a null username. } } {code} With kind regards, Simon von Janowsky > Problem in geronimo-javamail_1.4_spec > ------------------------------------- > > Key: GERONIMO-4910 > URL: https://issues.apache.org/jira/browse/GERONIMO-4910 > Project: Geronimo > Issue Type: Bug > Security Level: public(Regular issues) > Components: mail > Reporter: Simon von Janowsky > > When a url ist set to receive email, the username is extracted correctly using UrlName class, but when querying the imap server the system defined username is used instead. > This is because the username in the connect Method in Service.java overrides the username from the url. See this code excerpt from javax.mail.Service.class in geronimo-javamail_1.4_spec-1.6.jar > class: Service.java > method: connect(String host, int port, String user, String password) > {code:title=Service.java|borderStyle=solid} > if (user == null) { > // first choice is from the url, if we have > if (url != null) { > user = url.getUsername(); > // make sure we get the password from the url, if we can. > if (password == null) { > password = url.getPassword(); > } > // user still null? We have several levels of properties to try yet > if (user == null) { > if (protocol != null) { > user = session.getProperty("mail." + protocol + ".user"); > } > } > } > // this may still be null...get the global mail property > if (user == null) { > user = session.getProperty("mail.user"); > } > // finally, we try getting the system defined user name > try { > // HERE THE USER IS ALWAYS OVERWRITTEN > user = System.getProperty("user.name"); > } catch (SecurityException e) { > // we ignore this, and just us a null username. > } > } > {code} > With kind regards, > Simon von Janowsky -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.