public class NTLM {

private static boolean var = true;

public static String auth(String ip, String login, String password, String ntlm_ip) {

String ritorno="";

jcifs.Config.setProperty("jcifs.netbios.wins","ADSERVER");

SmbFileInputStream in = null;

try {

System.out.println("smb://"+login+":"+password+"@"+ntlm_ip+"/");

//quello che stampa

//smb://ntlmuser:passera01.@ADSERVER/

in = new SmbFileInputStream("smb://"+login+":"+password+"@"+ntlm_ip+"/");

}catch(SmbException smbe) {

System.out.println(smbe.getMessage());

switch( smbe.getNtStatus() ) {

case SmbException.NT_STATUS_OK: return "";

case SmbException.NT_STATUS_ACCESS_DENIED:	return "";

case SmbException.NT_STATUS_ACCOUNT_LOCKED_OUT:	return "";

case SmbException.NT_STATUS_INSTANCE_NOT_AVAILABLE:	return "";

}

}catch(MalformedURLException e) {

if(var){

System.out.println("(classe)NTLM.java -(metodo)auth -(eccezione)MalformedURLException " +e.getMessage());

System.out.println(e.toString());

e.printStackTrace();

} return "ExcNTLM1";

}catch(UnknownHostException ue) {

if(var){

System.out.println("(classe)NTLM.java -(metodo)auth -(eccezione)UnknownHostException "+ue.getMessage());

ue.printStackTrace();

}

return "ExcNTLM2";

}

return "default";

}

}

.

2005-09-21

.