[jcifs] Authentication caching

Jammy_Pate at NAI.com Jammy_Pate at NAI.com
Sat Feb 8 07:59:48 EST 2003


Can anyone help me with these problem?

 

I'm trying to authenticate a user.  It authenticates fine but if you try to
authenticate again within 15 seconds it will always be successful even with
a bad password.

 

I've included my source that I'm using to do this.  The first method is
pretty much a straight copy from the example on jcis site.

Except that I've added the jcifs config set property.  I did this to try to
see if the soTimeout was causing this condition.

 

 

Any suggestions would be most appreciated.

 

Thanks Jammy

 

 

private boolean jcifsAuthenticate( String sDomain, String authUser, String
authPass, String sAddress )

{

  boolean bValid = false;

            jcifs.Config.setProperty("jcifs.smb.client.soTimeout","1");

 

  jcifs.UniAddress mydomaincontroller = null;

  jcifs.smb.NtlmPasswordAuthentication mycreds = null;

  try {

  mydomaincontroller = jcifs.UniAddress.getByName( sAddress );

  mycreds = new jcifs.smb.NtlmPasswordAuthentication(sDomain, authUser,
authPass );

            }

  catch( java.net.UnknownHostException sae )

  {

    return false;

  }

  try {

    jcifs.smb.SmbSession.logon( mydomaincontroller, mycreds );

    // SUCCESS

                        bValid = true;

     }

  catch( jcifs.smb.SmbAuthException sae )

  {

    // AUTHENTICATION FAILURE

                        bValid = false;

  }

  catch( jcifs.smb.SmbException  se )

  {

    // NETWORK PROBLEMS?

    se.printStackTrace();

  }

  return bValid;

}

 

 

// my test method

public static void main(String[] args) throws Exception

  {

  NTdomainPAM ntpam = new NTdomainPAM();

  //try with good password

  boolean b = ntpam.jcifsAuthenticateOld("domain
","jpate","pass","10.20.90.202");

  System.out.println(b);

  // try with bad password is succesful

  b = ntpam.jcifsAuthenticateOld("domain
","jpate","adfadsf","10.20.90.202");

  System.out.println(b);

  }

 

 

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list