Skip to Main Content

Security Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Modifying uidnumber Attribute.

807573Mar 6 2002 — edited Apr 11 2002
With either JNDI or the LDAP SDK from Netscape, when trying to modify the uidnumber attribute I get a malformed 'uidnumber' attribute value error message.

My question is How can I do this with either SDK. Following is sample code using JNDI:

<font size=2><pre>
/*
* AddUidNumber.java
*
* Created on March 6, 2002, 9:45 AM
*/

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;

<tt>public class AddUidNumber</tt> {

/**
* @param args the command line arguments
*/
<tt>public static void main (String args[])</tt> {
if (args.length != 2) {
System.out.println("USAGE: AddUidNumber username password");
}
else {
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://128.23.9.44:389");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "uid=" +
args[0] +
", ou=Administrators, ou=TopologyManagement, o=NetscapeRoot");
env.put(Context.SECURITY_CREDENTIALS, args[1]);
//Make the connection to SiteMinder with the properties loaded above
DirContext ctx = new InitialDirContext(env);

// Specify the changes to make
ModificationItem[] mods = new ModificationItem[1];

// Replace the "mail" attribute with a new value
mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE,
new BasicAttribute("uidnumber", new Integer(123)));

// Perform the requested modifications on the named object
ctx.modifyAttributes("uid=jfraser@valspar.com, ou=People, dc=valspar, dc=com", mods);
}
catch (Exception e) {
e.printStackTrace();
}
finally {
}
}
}

}
</pre></font>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details