common/src/main/java/HTTPClient/DefaultAuthHandler.java
/*
     * Here are all the NTLM specific methods
     */
Here are all the NTLM specific methods
Here are all the NTLM specific methods
private static AuthorizationInfo ntlm_gen_auth_info(
				AuthorizationInfo challenge, NVPair answer,
				RoRequest req)
	    throws AuthSchemeNotImplException
    {
	byte[] lm_hpw = calc_lm_hpw(answer.getValue());
	byte[] nt_hpw = calc_ntcr_hpw(answer.getValue());
	String host = null;
	try
	    { host = System.getProperty("HTTPClient.defAuthHandler.NTLM.host"); }
	catch (SecurityException se)
	    { }
	if (host == null)
	    try
		{ host = InetAddress.getLocalHost().getHostName(); }
	    catch (Exception e)
		{ }
	if (host == null)
	    host = "localhost";	
	int dot = host.indexOf('.');
	if (dot != -1)
	    host = host.substring(0, dot);
	String domain = null;
	int slash;
	if ((slash = answer.getName().indexOf('\\')) != -1)
	    domain = answer.getName().substring(0, slash);
	else
	{
	    try
	    {
		domain =
		    System.getProperty("HTTPClient.defAuthHandler.NTLM.domain");
	    }
	    catch (SecurityException se)
		{ }
	    if (domain == null)
		domain = host;	
	}
	String user = answer.getName().substring(slash+1);
	Object[] info = { user, host.toUpperCase().trim(),
			  domain.toUpperCase().trim(), lm_hpw, nt_hpw };
	AuthorizationInfo cred = new AuthorizationInfo(challenge.getHost(),
						       challenge.getPort(),
						       challenge.getScheme(),
						       challenge.getRealm(),
						       null, info);
	return ntlm_fixup(cred, req, challenge, null);
    }
private static AuthorizationInfo ntlm_gen_auth_info ( AuthorizationInfo challenge , NVPair answer , RoRequest req ) throws AuthSchemeNotImplException { byte [ ] lm_hpw = calc_lm_hpw ( answer . getValue ( ) ) ; byte [ ] nt_hpw = calc_ntcr_hpw ( answer . getValue ( ) ) ; String host = null ; try { host = System . getProperty ( "HTTPClient.defAuthHandler.NTLM.host" ) ; } catch ( SecurityException se ) { } if ( host == null ) try { host = InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( Exception e ) { } if ( host == null ) host = "localhost" ; int dot = host . indexOf ( '.' ) ; if ( dot != - 1 ) host = host . substring ( 0 , dot ) ; String domain = null ; int slash ; if ( ( slash = answer . getName ( ) . indexOf ( '\\' ) ) != - 1 ) domain = answer . getName ( ) . substring ( 0 , slash ) ; else { try { domain = System . getProperty ( "HTTPClient.defAuthHandler.NTLM.domain" ) ; } catch ( SecurityException se ) { } if ( domain == null ) domain = host ; } String user = answer . getName ( ) . substring ( slash + 1 ) ; Object [ ] info = { user , host . toUpperCase ( ) . trim ( ) , domain . toUpperCase ( ) . trim ( ) , lm_hpw , nt_hpw } ; AuthorizationInfo cred = new AuthorizationInfo ( challenge . getHost ( ) , challenge . getPort ( ) , challenge . getScheme ( ) , challenge . getRealm ( ) , null , info ) ; return ntlm_fixup ( cred , req , challenge , null ) ; }
Here are all the NTLM specific methods
Here are all the NTLM specific methods
// hash the password // get the local host name // ??? // get user and domain name // ??? // store info in extra_info field