20120229 using ldapsearch to export the oid schema - plembo/onemoretech GitHub Wiki

title: Using ldapsearch to export the OID schema link: https://onemoretech.wordpress.com/2012/02/29/using-ldapsearch-to-export-the-oid-schema/ author: lembobro description: post_id: 2274 created: 2012/02/29 14:41:08 created_gmt: 2012/02/29 18:41:08 comment_status: closed post_name: using-ldapsearch-to-export-the-oid-schema status: publish post_type: post

Using ldapsearch to export the OID schema

A friend in need asked, so here it is. Example of how to use ldapsearch to export an Oracle Internet Directory (OID) schema using the standard version that comes with Red Hat Enterprise Linux (a/k/a OpenLDAP ldapsearch):

ldapsearch -x -LLL -h [servername] -p [ldapport] -b "cn=subschemasubentry" 
 -s base "(cn=*)" objectclasses attributetypes >oidschema.ldif

The search filter needs to be either for cn or objectclass, and the scope must be "base" (there is no "sub" there). If you wanted to then import any part of the schema exported into another OID you've got a number of options. Here's two: 1. You could manually edit the file produced by the above command to remove all the objectclasses and attributetypes you're not interested in (along with the objectclass lines right under the dn), and then put a "changetype: add" right under the dn line, like this:

dn: cn=subschemasubentry
changetype: add
objectclasses: ....

2. You could write a script that would iterate through the LDIF file and only named objectclasses and attributetypes you're interested in adding to the other directory, kind of an LDIF rewrite kind of thing like this.

Copyright 2004-2019 Phil Lembo