06-03-2013 09:22 PM
<?xml version="1.0" standalone="no"?>
<!– <!DOCTYPE jlanserver SYSTEM "jlanserver.dtd"> –>
<jlanserver>
<servers>
<SMB/>
<noFTP/>
<noNFS/>
</servers>
<SMB>
<host name="NUAGESERVER" domain="NUAGE">
<broadcast>255.255.255.0</broadcast>
<smbdialects>LanMan,NT</smbdialects>
<comment>Alfresco JLAN Server</comment>
<Win32NetBIOS/>
<Win32Announce interval="5"/>
<!– To run the server using a non-root account on linux, Mac OS X, Solaris –>
<netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,macosx,solaris"/>
<tcpipSMB port="1445" platforms="linux,macosx,solaris"/>
<hostAnnounce interval="5"/>
</host>
<sessionDebug flags="Negotiate,Socket,Tree"/>
<netbiosDebug/>
<announceDebug/>
<authenticator>
<class>com.ye.nuage.auth.NuageAuthenticator</class>
<Debug/>
</authenticator>
</SMB>
<FTP>
<port>21</port>
<allowAnonymous/>
<debug flags="File,Search,Error,DataPort,Directory"/>
</FTP>
<NFS>
<enablePortMapper/>
<debug flags="File,FileIO"/>
</NFS>
<debug>
<output>
<class>org.alfresco.jlan.debug.ConsoleDebug</class>
<logFile>jlansrv.log</logFile>
<append/>
</output>
</debug>
<shares>
<diskshare name="JLAN" comment="Test share">
<driver>
<class>org.alfresco.jlan.smb.server.disk.JavaFileDiskDriver</class>
<LocalPath>.</LocalPath>
</driver>
</diskshare>
</shares>
<security>
<JCEProvider>cryptix.jce.provider.CryptixCrypto</JCEProvider>
<authenticator>
<class>com.ye.nuage.auth.NuageAuthenticator</class>
<mode>USER</mode>
</authenticator>
<users>
<user name="jlansrv">
<password>jlan</password>
<comment>System administrator</comment>
<administrator/>
</user>
<user name="normal">
<password>normal</password>
</user>
</users>
</security>
</jlanserver>
public int authenticateUser(ClientInfo client, SrvSession sess, int alg) {
// Check if the user exists in the user list
UserAccount userAcc = null;
try {
userAcc = getNuageUserDetails(client.getUserName());
} catch (YeException e) {
e.printStackTrace();
}
if (userAcc != null) {
// Validate the password
boolean authSts = false;
if (client.getPassword() != null) {
// Validate using the Unicode password
authSts = validateNuagePassword(userAcc, client, sess.getAuthenticationContext(), alg);
} else if (client.hasANSIPassword()) {
// Validate using the ANSI password with the LanMan encryption
authSts = validateNuagePassword(userAcc, client, sess.getAuthenticationContext(), LANMAN);
}
// Return the authentication status
return authSts == true ? AUTH_ALLOW : AUTH_BADPASSWORD;
}
// Check if this is an SMB/CIFS null session logon.
//
// The null session will only be allowed to connect to the IPC$ named
// pipe share.
if (client.isNullSession() && sess instanceof SMBSrvSession)
return AUTH_ALLOW;
// Unknown user
return allowGuest() ? AUTH_GUEST : AUTH_DISALLOW;
}
private UserAccount getNuageUserDetails(String userName) throws YeException {
if (context == null) {
context = new ClassPathXmlApplicationContext("/applicationContext-nuage.xml");
}
userRepository = context.getBean(UserRepository.class);
User u = userRepository.findByUserLogin(userName); // Search the user into my repository
if (u != null) {
UserAccount ua = new UserAccount();
ua.setMD4Password(u.getUserMd4Password().getBytes());
ua.setUserName(userName);
ua.setRealName(u.getUserFirstName() + " " + u.getUserLastName());
return ua;
}
return null;
}
[T2] Closing session due to exception
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at com.ye.nuage.auth.NuageAuthenticator.validatePassword(NuageAuthenticator.java:123)
at com.ye.nuage.auth.NuageAuthenticator.authenticateUser(NuageAuthenticator.java:60)
at org.alfresco.jlan.server.auth.CifsAuthenticator.processSessionSetup(CifsAuthenticator.java:572)
at org.alfresco.jlan.smb.server.NTProtocolHandler.procSessionSetup(NTProtocolHandler.java:396)
at org.alfresco.jlan.smb.server.NTProtocolHandler.runProtocol(NTProtocolHandler.java:213)
at org.alfresco.jlan.smb.server.SMBSrvSession.processPacket(SMBSrvSession.java:1439)
at org.alfresco.jlan.smb.server.nio.NIOCIFSThreadRequest.runRequest(NIOCIFSThreadRequest.java:104)
at org.alfresco.jlan.server.thread.ThreadRequestPool$ThreadWorker.run(ThreadRequestPool.java:141)
at java.lang.Thread.run(Thread.java:722)
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at com.ye.nuage.auth.NuageAuthenticator.validatePassword(NuageAuthenticator.java:123)
at com.ye.nuage.auth.NuageAuthenticator.authenticateUser(NuageAuthenticator.java:60)
at org.alfresco.jlan.server.auth.CifsAuthenticator.processSessionSetup(CifsAuthenticator.java:572)
at org.alfresco.jlan.smb.server.NTProtocolHandler.procSessionSetup(NTProtocolHandler.java:396)
at org.alfresco.jlan.smb.server.NTProtocolHandler.runProtocol(NTProtocolHandler.java:213)
at org.alfresco.jlan.smb.server.SMBSrvSession.processPacket(SMBSrvSession.java:1439)
at org.alfresco.jlan.smb.server.nio.NIOCIFSThreadRequest.runRequest(NIOCIFSThreadRequest.java:104)
at org.alfresco.jlan.server.thread.ThreadRequestPool$ThreadWorker.run(ThreadRequestPool.java:141)
at java.lang.Thread.run(Thread.java:722)
if (user.hasMD4Password() && alg != LANMAN) {
try {
// Generate the encrpyted password
if (alg == NTLM1) {
// Get the MD4 hashed password
byte[] p21 = new byte[21];
System.arraycopy(user.getMD4Password(), 0, p21, 0, user.getMD4Password().length); **//THE ERROR OCCURS HERE!**
// Generate an NTLMv1 encrypted password
System.arraycopy(user.getMD4Password(), 0, p21, 0, user.getMD4Password().length);
06-04-2013 08:20 AM
06-04-2013 08:51 AM
06-04-2013 09:28 AM
06-04-2013 10:02 AM
String md4Password = md4PasswordEncoder.encodePassword("admin", null);
f9d4049dd6a4dc35d40e5265954b2a46
06-04-2013 12:23 PM
06-04-2013 12:45 PM
public UserAccount getUserAccount(String userName) {
if (userName.equals("admin")) {
cryptoutils cu = new cryptoutils();
byte[] md4 = null;
try {
md4 = cu.generateEncryptedPassword("admin", null, PasswordEncryptor.MD4, null, null);
} catch (Exception e) {
e.printStackTrace();
}
UserAccount ua = new UserAccount();
ua.setUserName("admin");
ua.setMD4Password(md4);
ua.setPassword("admin");
return ua;
}
return null;
}
smbclient -L localhost -U admin -W NUAGE
if (encPwd != null && encryptedPwd != null && encPwd.length == STANDARD_PASSWORD_LEN && encryptedPwd.length == STANDARD_PASSWORD_LEN) {
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.