[Samba] Authentication with Samba
Xie, David-WD
David-WD.Xie at AIG.com
Fri Nov 1 19:23:28 GMT 2002
Dear Sir/Mdm,
Thank you very much for providing such a great software, it definitely helps
when we are developing our applications.
I encounter some problems when using CIFS for authentication in a Java
application. We are using WebSphere Application Server 3.5 and IHS Web
Server. I have downloaded the latest jar - jcifs-0.7.0b3.jar from
http://jcifs.samba.org/.
I have tried to detect the specific error code when logging on to a NT
server with wrong password or expired password, but no matter in which way I
tried my logon, the returned code is always 5 -- Access Denied. Please see
my coding:
try{
String auth = "smb://domain;lan_id:password@hostname/share";
SmbFile sf = new SmbFile(auth);
sf.isDirectory();
}catch(SmbException se){
switch( se.getErrorClass() ) {
case SmbAuthException.ERRDOS:
switch( se.getErrorCode() ) {
case SmbAuthException.ERRbadpw:
out.print("<br>wrong password");
break;
case SmbAuthException.ERRaccess:
out.print("<br>Access denied");
break;
case SmbAuthException.ERRaccountExpired:
out.print("<br>Account Expired");
break;
case SmbAuthException.ERRbadClient:
out.print("<br>Bad Client");
break;
case SmbAuthException.ERRbadLogonTime:
out.print("<br>Bad Logon Time");
break;
case SmbAuthException.ERRpasswordExpired:
out.print("<br>Account Expired");
break;
case SmbAuthException.ERRnoaccess:
out.print("<br>Can not Access");
break;
}
break;
case SmbAuthException.ERRSRV:
switch( se.getErrorCode() ) {
case SmbAuthException.ERRbadpw:
out.print("<br>wrong password");
break;
case SmbAuthException.ERRaccess:
out.print("<br>Access denied");
break;
case SmbAuthException.ERRaccountExpired:
out.print("<br>Account Expired");
break;
case SmbAuthException.ERRbadClient:
out.print("<br>Bad Client");
break;
case SmbAuthException.ERRbadLogonTime:
out.print("<br>Bad Logon Time");
break;
case SmbAuthException.ERRpasswordExpired:
out.print("<br>Account Expired");
break;
}
break;
}
out.print("<br>se.getErrorClass():"+se.getErrorClass());
out.print("<br>se.getErrorCode():"+se.getErrorCode ());
out.print("<br>se.ERRSRV: "+se.ERRSRV);
out.print("<br>se.ERRDOS: "+se.ERRDOS);
out.print("<br>ERRnoaccess: "+se.ERRnoaccess);
out.print("<br>ErrorCode: "+se.getErrorCode());
out.print("<br>Msg: "+se.getMessage());
}catch(Exception e){
out.print("<br>Logon Unsuccessfully");
out.print("<br>"+e);
}
Best Regards
David.X
AIA Information Technology (Guangzhou) Co. Ltd.
TEL:(86-20-87521366 Ext 1151)
FAX:(86-20-38770733)
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the samba
mailing list