************************************************
import com.novell.ldap.*;
public class VerifyPassword
{
public static void main( String[] args )
{
if (args.length != 5) {
System.out.println("Usage: java
VerifyPassword <localhost>"
+ " <login dn>
<password> <object dn>\n"
+ " <test
password>");
System.out.println("Example: java
VerifyPassword Acme.com "
+ "\"cn=Admin,o=Acme\"
secret\n"
+ "
\"cn=JSmith,ou=Sales,o=Acme\" testPassword");
System.exit(0);
}
int ldapPort =
LDAPConnection.DEFAULT_PORT;
int ldapVersion =
LDAPConnection.LDAP_V3;
String ldapHost = args[0];
String loginDN = args[1];
String password = args[2];
String objectDN = args[3];
String testPassword = args[4];
LDAPConnection lc = new LDAPConnection();
try {
// connect to the server
lc.connect( ldapHost, ldapPort );
// authenticate to the server
lc.bind( ldapVersion, loginDN,
password );
LDAPAttribute attr = new LDAPAttribute
(
"userP
assword", testPassword );
boolean correct = lc.compare(
objectDN, attr );
System.out.println( correct ? "The
password is correct.":
"The
password is incorrect.\n");
// disconnect with the server
lc.disconnect();
}
catch( LDAPException e ) {
if ( e.getLDAPResultCode() ==
LDAPException.NO_SUCH_OBJECT )
System.err.println( "Error: No
such entry" );
else if ( e.getLDAPResultCode() ==
LDAPException.NO_SUCH_ATTRIBUTE )
System.err.println( "Error: No
such attribute" );
else
System.err.println( "Error: " +
e.toString() );
}
System.exit(0);
}
}
************************************************
when I used an administrator login and password
for a bind it gave me this error ...
Error: com.novell.ldap.LDAPException: Strong
Authentication Required : (8) Strong
Authentication Required
So I used a simple bind using EMPTY admin login
and password fields. This succeeds to bind but
gives me a "No such attribute Exception"... I
thought "userPassword" was the default password
attribute that stores the users password. How
come it's not found??? Is it possible that the
password attribute has a different name? And if
so how do I find it?....
Any help would be greatly appreciated.
Thanks in advance,
Jacob.
By successfully binding to the directory you have in effect verified that
the password used in your bind method call is the same as the password
associated with the user object being used. You cannot compare the
userPassword attribute to anything because you should not/cannot see the
userPassword attribute.
Your compare method call is redundant.
Andy
<jacob...@hotmail.com> wrote in message
news:r4Xy7.2399$1v1....@prv-forum2.provo.novell.com...
Jacob
Jim
--
Jim Henderson
Novell Support Connection Volunteer SysOp
http://support.novell.com/forums
(Sorry, support is not provided via e-mail)
Homepage at http://hendersj.dyndns.org (URL has changed!)