Hi,

   +-From: <[EMAIL PROTECTED]> ----------
   |_Date: Wed, 24 Oct 2007 10:07:42 -0400 __
   |
   |For reasons of my own, I rather wait for 0.1.36 instead of patching
   |0.l.35. If you roll out 0.1.35, if it is possible, may I request that
   |the default PreferredAuthentications be set to
   |"publickey,keyboard-interactive,password" instead of
   |""gssapi-with-mic,publickey,keyboard-interactive,password"? That would
   |help remove the annoying messages in stderr.

As for that annoying messages in stderr, may I ask you to try following
patch?

diff -Naur jsch-0.1.35/src/com/jcraft/jsch/jgss/GSSContextKrb5.java 
jsch-0.1.36/src/com/jcraft/jsch/jgss/GSSContextKrb5.java
--- jsch-0.1.35/src/com/jcraft/jsch/jgss/GSSContextKrb5.java    Sat Aug 11 
12:54:14 2007
+++ jsch-0.1.36/src/com/jcraft/jsch/jgss/GSSContextKrb5.java    Tue Oct 23 
20:44:17 2007
@@ -42,6 +42,12 @@
 import org.ietf.jgss.Oid;
 
 public class GSSContextKrb5 implements com.jcraft.jsch.GSSContext{
+
+  private static final String pUseSubjectCredsOnly = 
+    "javax.security.auth.useSubjectCredsOnly";
+  private static String useSubjectCredsOnly = 
+    getSystemProperty(pUseSubjectCredsOnly);
+
   private GSSContext context=null;
   public void create(String user, String host) throws JSchException{
     try{
@@ -111,11 +117,24 @@
 
   public byte[] init(byte[] token, int s, int l) throws JSchException {
     try{
+      // Without setting "javax.security.auth.useSubjectCredsOnly" to "false",
+      // Sun's JVM for Un*x will show messages to stderr in
+      // processing context.initSecContext().
+      // This hack is not thread safe ;-<.
+      // If that property is explicitly given, this hack must not be invoked.
+      if(useSubjectCredsOnly==null){
+        setSystemProperty(pUseSubjectCredsOnly, "false");
+      }
       return context.initSecContext(token, 0, l);
     }
     catch(GSSException ex){
       throw new JSchException(ex.toString());
     }
+    finally{
+      if(useSubjectCredsOnly==null){
+        setSystemProperty(pUseSubjectCredsOnly, "true");
+      }
+    }
   }
 
   public byte[] getMIC(byte[] message, int s, int l){
@@ -135,4 +154,20 @@
     catch(GSSException ex){
     }
   }
+
+    private static String getSystemProperty(String key){
+    try{ return System.getProperty(key); }
+    catch(Exception e){ 
+      // We are not allowed to get the System properties.
+      return null; 
+    } 
+  }
+
+  // We may be not allowed to change the System properties.
+  private static void setSystemProperty(String key, String value){
+    try{ System.setProperty(key, value); }
+    catch(Exception e){ 
+      // We are not allowed to set the System properties.
+    }
+  }
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to