Go to main content

Working With Oracle® Solaris 11.3 Directory and Naming Services: LDAP

Exit Print View

Updated: September 2018

Examples of Custom Maps

Examples in this section show how you might customize maps. Use your preferred text editor to modify the /var/yp/NISLDAPmapping file as needed. For more information about file attributes and syntax, see the NISLDAPmapping(4) man page. For more information about the LDAP naming service, see Introduction to the LDAP Naming Service.

Example 7  Moving Host Entries

This example shows how to move host entries from the default location to another location in the DIT by changing the nisLDAPobjectDN attribute in the NISLDAPmapping file to the new base LDAP distinguished name (DN). For this example, the internal structure of the LDAP objects is unchanged, so objectClass entries are also unchanged..


nisLDAPobjectDN hosts: \
ou=hosts,?one?, \
objectClass=device, \


nisLDAPobjectDN hosts: \
ou=newHosts,?one?, \
objectClass=device, \

This change causes entries to be mapped under dn: ou=newHosts, dom=domain1, dc=sun, dc=com, instead of dn: ou=hosts, dom=domain1, dc=sun, dc=com.

Example 8  Implementing a Custom Map

This example shows how to implement a custom map.

In this example the servdate.bynumber map contains information about the servicing dates for systems. This map is indexed by the system’s serial number, which in this example is 123. Each entry consists of the system owner’s name, a colon, and a comma-separated list of service dates, such as John Smith:1/3/2001,4/5/2003.

The old map structure is to be mapped onto LDAP entries of the following form:

dn: number=123,ou=servdates,dc=... \
number: 123 \
userName: John Smith \
date: 1/3/2001 \
date: 4/5/2003 \
objectClass: servDates

By examining the NISLDAPmapping file, you can see that the mapping closest to the required pattern is group. The custom mappings can be modeled on the group mapping. Because there is only one map, no nisLDAPdatabaseIdMapping attribute is required. The attributes to be added to NISLDAPmapping are as follows:

nisLDAPentryTtl servdate.bynumber:1800:5400:3600

nisLDAPnameFields servdate.bynumber: \
("%s:%s", uname, dates)

nisLDAPobjectDN servdate.bynumber: \
ou=servdates, ?one? \

nisLDAPattributeFromField servdate.bynumber: \
dn=("number=%s,", rf_key), \
number=rf_key, \
userName=uname, \
(date)=(dates, ",")

nisLDAPfieldFromAttribute servdate.bynumber: \
rf_key=number, \
uname=userName, \
dates=("%s,", (date), ",")