attribute to enable/disable user on openLDAP using java

My users are inetOrgPerson . What would be the attribute to enable/disable users ? I am using JNDI library and i am trying this code that is for active directory but i am getting LDAP: error code 17 - userAccountControl: attribute type undefined . If i try to put attributes.put("userAccountControl","0x0001"); while creating the user i get the same eror.

Any idea?

public void disableEnableUser(String user) throws Exception {
    ModificationItem[] mods = new ModificationItem[1];
    //To enable user
    //int UF_ACCOUNT_ENABLE = 0x0001;
    //mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userAccountControl",Integer.toString(UF_ACCOUNT_ENABLE)));

    // To disable user
    int UF_ACCOUNT_DISABLE = 0x0002;
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userAccountControl",Integer.toString(UF_ACCOUNT_DISABLE)));

    connection.modifyAttributes("path to user", mods);
}

userAccountControl is an AD attribute, so in openldap, you won't find it (the defintion of inerOrgPerson doesn't have userAccountControl). If you want to lock your users, you have to do it some other way.

One possibility is to use the Password Policy (ppolicy) overlay. The ppolicy defines a pwdAccountLockedTime attribute, which, if set to "00000101000000Z", indicates an administrative lock. For this to work, you have to include ppolicy in your LDAP tree, which basically means an ldapadd with the ppolicy.ldif file.

Another possibility is to change the user's password to something which indicates lock. For example, by changing the {SSHA} prefix of the password to {SSHA}!, you can easily indicate if the user is locked. As a bonus, you don't need any extra overlays, and it prevents the user from logging in as well.