[jira] Commented: (NET-373) NNTP Listgroups not working as expected with payserver envronment

2011-03-14 Thread Bas (JIRA)

[ 
https://issues.apache.org/jira/browse/NET-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006802#comment-13006802
 ] 

Bas commented on NET-373:
-

so I do need to update my svn rep?
I will give you a different output when using no pattern at all!

As you can see I have disabled the first newsgroup listening. In that case the 
second is running proberly. However still only 31 groups are listed. My server 
has more than 1000, that I know for sure...

So what I see is that when running the 2 independand commands the server gives 
me the IO

Code:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//package examples.nntp;

import java.io.IOException;
import java.io.PrintWriter;

import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.nntp.NNTPClient;
import org.apache.commons.net.nntp.NewsgroupInfo;

import javax.net.ssl.SSLSocketFactory;

/***
 * This is a trivial example using the NNTP package to approximate the
 * Unix newsgroups command.  It merely connects to the specified news
 * server and issues fetches the list of newsgroups stored by the server.
 * On servers that store a lot of newsgroups, this command can take a very
 * long time (listing upwards of 30,000 groups).
 * 
 ***/

public final class ListNewsgroups_1
{

public final static void main(String[] args)
{
if (args.length < 1)
{
System.err.println("Usage: newsgroups newsserver [pattern]");
return;
}

NNTPClient client = new NNTPClient();
client.addProtocolCommandListener(new PrintCommandListener(new 
PrintWriter(System.out)));
//String pattern = args.length >= 2 ? args[1] : "";
String pattern = "";
//String pattern = "alt.fan.*";
try
{

if (args[4] == "SSL")
{
client.setSocketFactory(SSLSocketFactory.getDefault());
} 
else 
{
//factory = createSocket(host, port);
}

client.connect(args[0],Integer.parseInt(args[3]));

// AUTHINFO USER/AUTHINFO PASS
boolean success = client.authenticate(args[1], args[2]);
if (success) {
System.out.println("Authentication succeeded");
} else {
System.out.println("Authentication failed, error =" + 
client.getReplyString());
}
//client.iterateNewsgroupListing();

/**try
{
Thread.sleep(6); // do nothing for 1000 miliseconds (1 second)
}
catch(InterruptedException e)
{
e.printStackTrace();
}


int j = 0;
try {
for(String s : client.iterateNewsgroupListing(pattern)) {
j++;
System.out.println(s);
}
} catch (IOException e1) {
e1.printStackTrace();
}
System.out.println(j);
*/
int j = 0;
for(NewsgroupInfo n : client.iterateNewsgroups(pattern)) {
j++;
System.out.println(n.getNewsgroup());
}
System.out.println(j);
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
if (client.isConnected())
client.disconnect();
}
catch (IOException e)
{
System.err.println("Error disconnecting from server.");
e.printStackTrace();
System.exit(1);
}
}

}

}

Output (1 function):

201 reader.xsnews.nl (frontend-F05-04) Server Ready - supp...@xsnews.nl
AUTHINFO USER 
381 PASS required
AUTHINFO PASS 
281 Ok
Authentication succeeded
LIST ACTIVE 
215 Newsgroups in form "group high low flags".

!
!!!
!vaux23
"
"0.test
":
"Phyllis
"alt.binaries.boneless
"alt.binaries.multimedia
"alt.binaries.multimedia.erotica
"alt.binari

[jira] Commented: (NET-373) NNTP Listgroups not working as expected with payserver envronment

2011-03-14 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/NET-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006751#comment-13006751
 ] 

Sebb commented on NET-373:
--

Also, try the listNewsgroups(pattern) method as well, as that uses a different 
method of handling the replies.

The group names returned by the server look rather odd, as they don't start 
with alt.fan. Maybe the server is misbehaving?

The program works fine on my news server (which has over 3000 groups under 
alt.fan).

[I've updated the IOException messages]

> NNTP Listgroups not working as expected with payserver envronment
> -
>
> Key: NET-373
> URL: https://issues.apache.org/jira/browse/NET-373
> Project: Commons Net
>  Issue Type: Bug
>  Components: NNTP
>Affects Versions: 3.0
> Environment: Eclipse Build id: 20110218-0911
>Reporter: Bas
>  Labels: ioexception, java, listnewsgroups, nntp, nntpclient
>
> In addition to NET-276 I tried to get all newsgroups from my server with the 
> example script. Unfortunately I got with underneath code the following error:
> As can be imagined this is a pay server so it has more than 31 groups. 
> Unfortunately I have no idea how to get those printed underneath, probably 
> also a bug!
> {noformat:title=Output| borderStyle=dashed| borderColor=#ccc| 
> titleBGColor=#F7D6C1| bgColor=#CE} 
> 201 reader.xsnews.nl (frontend-F04-05) Server Ready - supp...@xsnews.nl
> AUTHINFO USER ***
> 381 PASS required
> AUTHINFO PASS *
> 281 Ok
> Authentication succeeded
> LIST ACTIVE alt.fan.*
> 215 Newsgroups in form "group high low flags".
>  000 000 y
> ! 023 001 y
> !!! 001 001 y
> !vaux23 001 001 y
> " 001 001 y
> "0.test 001 001 y
> ": 001 001 y
> "Phyllis 001 001 y
> "alt.binaries.boneless 0001053 0001002 y
> "alt.binaries.multimedia 0002422 004 y
> "alt.binaries.multimedia.erotica 001 001 y
> "alt.binaries.multimedia.erotica.lesbians 002 001 y
> "alt.binaries.multimedia.scifi; 001 001 y
> "alt.binaries.sounds.mp3.lounge 001 001 y
> "alt.binaries.sounds.mp3.reggae 001 001 y
> "alt.binaries.tv.canadian 002 001 y
> "alt.internet 001 001 y
> "alt.politics 002 001 y
> "alt.religion.christian.east 001 001 y
> "webstump+urcm-no...@chiark.greenend.org.uk" 001 001 y
> #alt.binaries.department.pron 00022885781 001 y
> ( 007 005 y
> (analog-isl...@t-online.de 001 001 y
> (cross 001 001 y
> * 006 006 y
> *.binaries.* 001 001 y
> +a.uninarch 353 353 y
> - 002 002 y
> -- 005 001 y
> -- 004 002 y
> -adams 001 001 y
> 31
> LIST ACTIVE alt.fan.*
> 00 000 y
> java.io.IOException: 00 000 y
>   at 
> org.apache.commons.net.nntp.NNTPClient.iterateNewsgroupListing(NNTPClient.java:1043)
>   at 
> org.apache.commons.net.nntp.NNTPClient.iterateNewsgroups(NNTPClient.java:1059)
>   at ListNewsgroups_1.main(ListNewsgroups_1.java:89)
>   at Testing_NNTP.main(Testing_NNTP.java:25){panel}
> {noformat}
> Code:
> {code:title=Bar.java|borderStyle=solid}
> // Some comments here
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *  http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> //package examples.nntp;
> import java.io.IOException;
> import java.io.PrintWriter;
> import org.apache.commons.net.PrintCommandListener;
> import org.apache.commons.net.nntp.NNTPClient;
> import org.apache.commons.net.nntp.News

[jira] Commented: (NET-373) NNTP Listgroups not working as expected with payserver envronment

2011-03-14 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/NET-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006745#comment-13006745
 ] 

Sebb commented on NET-373:
--

The following sequence:

{code}
LIST ACTIVE alt.fan.*
00 000 y
java.io.IOException: 00 000 y
{code}

shows that the code thinks the server has responded with an invalid reply to 
the LIST ACTIVE command.

It should return something like:

{code}
LIST ACTIVE alt.fan.*
215 Newsgroups in form "group high low flags".
 000 000 y
{code}

For some reason the 215 response seems to be missing.

The IOException message is rather cryptic, and needs to be improved.

Does this happen every time?

> NNTP Listgroups not working as expected with payserver envronment
> -
>
> Key: NET-373
> URL: https://issues.apache.org/jira/browse/NET-373
> Project: Commons Net
>  Issue Type: Bug
>  Components: NNTP
>Affects Versions: 3.0
> Environment: Eclipse Build id: 20110218-0911
>Reporter: Bas
>  Labels: ioexception, java, listnewsgroups, nntp, nntpclient
>
> In addition to NET-276 I tried to get all newsgroups from my server with the 
> example script. Unfortunately I got with underneath code the following error:
> As can be imagined this is a pay server so it has more than 31 groups. 
> Unfortunately I have no idea how to get those printed underneath, probably 
> also a bug!
> {noformat:title=Output| borderStyle=dashed| borderColor=#ccc| 
> titleBGColor=#F7D6C1| bgColor=#CE} 
> 201 reader.xsnews.nl (frontend-F04-05) Server Ready - supp...@xsnews.nl
> AUTHINFO USER ***
> 381 PASS required
> AUTHINFO PASS *
> 281 Ok
> Authentication succeeded
> LIST ACTIVE alt.fan.*
> 215 Newsgroups in form "group high low flags".
>  000 000 y
> ! 023 001 y
> !!! 001 001 y
> !vaux23 001 001 y
> " 001 001 y
> "0.test 001 001 y
> ": 001 001 y
> "Phyllis 001 001 y
> "alt.binaries.boneless 0001053 0001002 y
> "alt.binaries.multimedia 0002422 004 y
> "alt.binaries.multimedia.erotica 001 001 y
> "alt.binaries.multimedia.erotica.lesbians 002 001 y
> "alt.binaries.multimedia.scifi; 001 001 y
> "alt.binaries.sounds.mp3.lounge 001 001 y
> "alt.binaries.sounds.mp3.reggae 001 001 y
> "alt.binaries.tv.canadian 002 001 y
> "alt.internet 001 001 y
> "alt.politics 002 001 y
> "alt.religion.christian.east 001 001 y
> "webstump+urcm-no...@chiark.greenend.org.uk" 001 001 y
> #alt.binaries.department.pron 00022885781 001 y
> ( 007 005 y
> (analog-isl...@t-online.de 001 001 y
> (cross 001 001 y
> * 006 006 y
> *.binaries.* 001 001 y
> +a.uninarch 353 353 y
> - 002 002 y
> -- 005 001 y
> -- 004 002 y
> -adams 001 001 y
> 31
> LIST ACTIVE alt.fan.*
> 00 000 y
> java.io.IOException: 00 000 y
>   at 
> org.apache.commons.net.nntp.NNTPClient.iterateNewsgroupListing(NNTPClient.java:1043)
>   at 
> org.apache.commons.net.nntp.NNTPClient.iterateNewsgroups(NNTPClient.java:1059)
>   at ListNewsgroups_1.main(ListNewsgroups_1.java:89)
>   at Testing_NNTP.main(Testing_NNTP.java:25){panel}
> {noformat}
> Code:
> {code:title=Bar.java|borderStyle=solid}
> // Some comments here
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *  http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> //package examples.nntp;
> import 

[jira] Updated: (NET-373) NNTP Listgroups not working as expected with payserver envronment

2011-03-14 Thread Sebb (JIRA)

 [ 
https://issues.apache.org/jira/browse/NET-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb updated NET-373:
-

Description: 
In addition to NET-276 I tried to get all newsgroups from my server with the 
example script. Unfortunately I got with underneath code the following error:

As can be imagined this is a pay server so it has more than 31 groups. 
Unfortunately I have no idea how to get those printed underneath, probably also 
a bug!

{noformat:title=Output| borderStyle=dashed| borderColor=#ccc| 
titleBGColor=#F7D6C1| bgColor=#CE} 
201 reader.xsnews.nl (frontend-F04-05) Server Ready - supp...@xsnews.nl
AUTHINFO USER ***
381 PASS required
AUTHINFO PASS *
281 Ok
Authentication succeeded
LIST ACTIVE alt.fan.*
215 Newsgroups in form "group high low flags".
 000 000 y
! 023 001 y
!!! 001 001 y
!vaux23 001 001 y
" 001 001 y
"0.test 001 001 y
": 001 001 y
"Phyllis 001 001 y
"alt.binaries.boneless 0001053 0001002 y
"alt.binaries.multimedia 0002422 004 y
"alt.binaries.multimedia.erotica 001 001 y
"alt.binaries.multimedia.erotica.lesbians 002 001 y
"alt.binaries.multimedia.scifi; 001 001 y
"alt.binaries.sounds.mp3.lounge 001 001 y
"alt.binaries.sounds.mp3.reggae 001 001 y
"alt.binaries.tv.canadian 002 001 y
"alt.internet 001 001 y
"alt.politics 002 001 y
"alt.religion.christian.east 001 001 y
"webstump+urcm-no...@chiark.greenend.org.uk" 001 001 y
#alt.binaries.department.pron 00022885781 001 y
( 007 005 y
(analog-isl...@t-online.de 001 001 y
(cross 001 001 y
* 006 006 y
*.binaries.* 001 001 y
+a.uninarch 353 353 y
- 002 002 y
-- 005 001 y
-- 004 002 y
-adams 001 001 y
31
LIST ACTIVE alt.fan.*
00 000 y
java.io.IOException: 00 000 y
at 
org.apache.commons.net.nntp.NNTPClient.iterateNewsgroupListing(NNTPClient.java:1043)
at 
org.apache.commons.net.nntp.NNTPClient.iterateNewsgroups(NNTPClient.java:1059)
at ListNewsgroups_1.main(ListNewsgroups_1.java:89)
at Testing_NNTP.main(Testing_NNTP.java:25){panel}
{noformat}

Code:

{code:title=Bar.java|borderStyle=solid}
// Some comments here
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//package examples.nntp;

import java.io.IOException;
import java.io.PrintWriter;

import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.nntp.NNTPClient;
import org.apache.commons.net.nntp.NewsgroupInfo;

import javax.net.ssl.SSLSocketFactory;

/***
 * This is a trivial example using the NNTP package to approximate the
 * Unix newsgroups command.  It merely connects to the specified news
 * server and issues fetches the list of newsgroups stored by the server.
 * On servers that store a lot of newsgroups, this command can take a very
 * long time (listing upwards of 30,000 groups).
 * 
 ***/

public final class ListNewsgroups_1
{

public final static void main(String[] args)
{
if (args.length < 1)
{
System.err.println("Usage: newsgroups newsserver [pattern]");
return;
}

NNTPClient client = new NNTPClient();
client.addProtocolCommandListener(new PrintCommandListener(new 
PrintWriter(System.out)));
//String pattern = args.length >= 2 ? args[1] : "";
//String pattern = "";
String pattern = "alt.fan.*";
try
{

if (args[4] == "SSL")
{
client.setSocketFactory(SSLSocketF

[jira] Created: (NET-373) NNTP Listgroups not working as expected with payserver envronment

2011-03-14 Thread Bas (JIRA)
NNTP Listgroups not working as expected with payserver envronment
-

 Key: NET-373
 URL: https://issues.apache.org/jira/browse/NET-373
 Project: Commons Net
  Issue Type: Bug
  Components: NNTP
Affects Versions: 3.0
 Environment: Eclipse Build id: 20110218-0911
Reporter: Bas


In addition to NET-276 I tried to get all newsgroups from my server with the 
example script. Unfortunately I got with underneath code the following error:

As can be imagined this is a pay server so it has more than 31 groups. 
Unfortunately I have no idea how to get those printed underneath, probably also 
a bug!

{panel:title=Output| borderStyle=dashed| borderColor=#ccc| 
titleBGColor=#F7D6C1| bgColor=#CE} 
201 reader.xsnews.nl (frontend-F04-05) Server Ready - supp...@xsnews.nl
AUTHINFO USER ***
381 PASS required
AUTHINFO PASS *
281 Ok
Authentication succeeded
LIST ACTIVE alt.fan.*
215 Newsgroups in form "group high low flags".
 000 000 y
! 023 001 y
!!! 001 001 y
!vaux23 001 001 y
" 001 001 y
"0.test 001 001 y
": 001 001 y
"Phyllis 001 001 y
"alt.binaries.boneless 0001053 0001002 y
"alt.binaries.multimedia 0002422 004 y
"alt.binaries.multimedia.erotica 001 001 y
"alt.binaries.multimedia.erotica.lesbians 002 001 y
"alt.binaries.multimedia.scifi; 001 001 y
"alt.binaries.sounds.mp3.lounge 001 001 y
"alt.binaries.sounds.mp3.reggae 001 001 y
"alt.binaries.tv.canadian 002 001 y
"alt.internet 001 001 y
"alt.politics 002 001 y
"alt.religion.christian.east 001 001 y
"webstump+urcm-no...@chiark.greenend.org.uk" 001 001 y
#alt.binaries.department.pron 00022885781 001 y
( 007 005 y
(analog-isl...@t-online.de 001 001 y
(cross 001 001 y
* 006 006 y
*.binaries.* 001 001 y
+a.uninarch 353 353 y
- 002 002 y
-- 005 001 y
-- 004 002 y
-adams 001 001 y
31
LIST ACTIVE alt.fan.*
00 000 y
java.io.IOException: 00 000 y
at 
org.apache.commons.net.nntp.NNTPClient.iterateNewsgroupListing(NNTPClient.java:1043)
at 
org.apache.commons.net.nntp.NNTPClient.iterateNewsgroups(NNTPClient.java:1059)
at ListNewsgroups_1.main(ListNewsgroups_1.java:89)
at Testing_NNTP.main(Testing_NNTP.java:25){panel}


Code:

{code:title=Bar.java|borderStyle=solid}
// Some comments here
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//package examples.nntp;

import java.io.IOException;
import java.io.PrintWriter;

import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.nntp.NNTPClient;
import org.apache.commons.net.nntp.NewsgroupInfo;

import javax.net.ssl.SSLSocketFactory;

/***
 * This is a trivial example using the NNTP package to approximate the
 * Unix newsgroups command.  It merely connects to the specified news
 * server and issues fetches the list of newsgroups stored by the server.
 * On servers that store a lot of newsgroups, this command can take a very
 * long time (listing upwards of 30,000 groups).
 * 
 ***/

public final class ListNewsgroups_1
{

public final static void main(String[] args)
{
if (args.length < 1)
{
System.err.println("Usage: newsgroups newsserver [pattern]");
return;
}

NNTPClient client = new NNTPClient();
client.addProtocolCommandListener(new PrintCommandListener(new 
PrintWriter(System.out)));
//String pattern = args.length >= 2 ? args[1]

[jira] Commented: (NET-326) A KeyManager is required when the protection level is set to 'P' with FTPSClient on active mode

2011-03-14 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/NET-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006524#comment-13006524
 ] 

Sebb commented on NET-326:
--

Oops! Good catch. Now fixed.

Not sure it makes sense to wrap the other calls.

> A KeyManager is required when the protection level is set to 'P' with 
> FTPSClient on active mode
> ---
>
> Key: NET-326
> URL: https://issues.apache.org/jira/browse/NET-326
> Project: Commons Net
>  Issue Type: Bug
>  Components: FTP
>Affects Versions: 2.0
> Environment: Windows XP profesional service pack 2, Java Java 
> 1.6.0_12-b04 
>Reporter: Terence Dudouit
> Attachments: SSLContextsFactory.java
>
>
> Using a simple FTPS client that list a directory, when execPROT("P") is set 
> and the active mode is on, the following exception is thrown :
> javax.net.ssl.SSLException: No available certificate or key corresponds to 
> the SSL cipher suites which are enabled.
>   at 
> com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.checkEnabledSuites(SSLServerSocketImpl.java:303)
>   at 
> com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:253)
>   at 
> org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:489)
>   at 
> org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:494)
>   at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1950)
>   at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1996)
>   at 
> fr.enovacom.eai.actions.dynamiques.protocole.ftp.FTPGet.testFTPS(FTPGet.java:379)
>   at 
> fr.enovacom.eai.actions.dynamiques.protocole.ftp.FTPGet.main(FTPGet.java:401)
> This doesn't occur on passive mode.
> The only way to make it work is to set a keyManager although there is no need 
> for a client authentication.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] Commented: (NET-326) A KeyManager is required when the protection level is set to 'P' with FTPSClient on active mode

2011-03-14 Thread Bogdan Drozdowski (JIRA)

[ 
https://issues.apache.org/jira/browse/NET-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006504#comment-13006504
 ] 

Bogdan Drozdowski commented on NET-326:
---

Nice one. But now I have a question: why do you cast a TrustManagerFactory 
(which implements od extends nothing) to a X509TrustManager? Are you sure that 
this will work?

I'd add just three more methods to your factory (assuming the casts are OK):
{code}
public static X509TrustManager getTrustManager(String algorithm) throws 
NoSuchAlgorithmException {
return (X509TrustManager) TrustManagerFactory.getInstance(algorithm);
}
public static X509TrustManager getTrustManager(String algorithm, Provider 
provider) throws NoSuchAlgorithmException {
return (X509TrustManager) TrustManagerFactory.getInstance(algorithm, 
provider);
}

public static X509TrustManager getTrustManager(String algorithm, String 
provider) throws NoSuchAlgorithmException {
return (X509TrustManager) TrustManagerFactory.getInstance(algorithm, 
provider);
}
{code}

so that the user could choose the algorithm the TrustManager will be used for. 
This is basically delegating the calls to the TrustManagerFactory, but we have 
everything in one place.

> A KeyManager is required when the protection level is set to 'P' with 
> FTPSClient on active mode
> ---
>
> Key: NET-326
> URL: https://issues.apache.org/jira/browse/NET-326
> Project: Commons Net
>  Issue Type: Bug
>  Components: FTP
>Affects Versions: 2.0
> Environment: Windows XP profesional service pack 2, Java Java 
> 1.6.0_12-b04 
>Reporter: Terence Dudouit
> Attachments: SSLContextsFactory.java
>
>
> Using a simple FTPS client that list a directory, when execPROT("P") is set 
> and the active mode is on, the following exception is thrown :
> javax.net.ssl.SSLException: No available certificate or key corresponds to 
> the SSL cipher suites which are enabled.
>   at 
> com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.checkEnabledSuites(SSLServerSocketImpl.java:303)
>   at 
> com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:253)
>   at 
> org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:489)
>   at 
> org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:494)
>   at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1950)
>   at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1996)
>   at 
> fr.enovacom.eai.actions.dynamiques.protocole.ftp.FTPGet.testFTPS(FTPGet.java:379)
>   at 
> fr.enovacom.eai.actions.dynamiques.protocole.ftp.FTPGet.main(FTPGet.java:401)
> This doesn't occur on passive mode.
> The only way to make it work is to set a keyManager although there is no need 
> for a client authentication.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira