DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Set userPassword attribute in ADAM using LDAP+JNDI

    I am trying to set the attribute "userPassword" for an Organization Unit (OU). I have used SHA algorithm for encrypting the password.For example ,the encrypted password that i got is "TmmQPaHwGiohpiziJUKVGXgZX9k="

    I am storing this encrypted password to the attribute "userPassword".


    I am getting the following error :

    Problem resetting password: javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B3D, comment: Error in attribute conversion operation, data 0, va28

    Here is the functtion that i used for setting the password.
    "Encrypt" is the function that returns the encrypted value of the password string.

    Can anyone help me on this issue? or if there is any other easy way to set the UserPassword attribute?


    Code:
    public boolean setPassword(String orgUnit,String Pass) throws NamingException, NoSuchAlgorithmException
    {
    try
    {
    String newUnicodePassword=encrypt(Pass);
    ModificationItem[] mods = new ModificationItem[1];
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userPassword", newUnicodePassword));
    System.out.println(mods[0]);
    ctx.bind("ou=wipro,dc=example,dc=com",mods);
    System.out.println("Set password & updated userccountControl");
    return true;
    }
    catch (NamingException e) {
    System.out.println("Problem resetting password: " + e);
    }

    catch (UnsupportedEncodingException e) {
    System.out.println("Problem encoding password: " + e);
    }
    return false;
    }

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,652
    Instead of resetting it can you flat out delete it and create a new one?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Input string was not in a correct format
    By mdengler in forum ASP.NET
    Replies: 0
    Last Post: 11-26-2002, 02:32 PM
  2. Create Procedure
    By YC Choo in forum Database
    Replies: 5
    Last Post: 09-03-2001, 01:42 PM
  3. Creating XML document using DOM
    By Gee in forum XML
    Replies: 2
    Last Post: 06-14-2001, 12:19 PM
  4. simple XML APPENDING problem
    By scopee in forum XML
    Replies: 4
    Last Post: 04-13-2001, 03:31 AM
  5. Replies: 1
    Last Post: 12-23-2000, 08:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links