LDAPConnection connection = new LDAPConnection();
try {
connection.connect(LDAPServerAddress, 389);
connection.bind(LDAPConnection.LDAP_V3, "cn=admin,dc=sei,dc=pku",
"seiseforge");
connection.modify("uid=" + user.getUserName()
+ ",ou=People,o=SEForge,dc=sei,dc=pku",
new LDAPModification(LdapContext.REPLACE_ATTRIBUTE,
new LDAPAttribute("userPassword", user
.getPassword())));
System.out.println("成功修改一条记录!");