Check out the new USENIX Web site. next up previous
Next: Performance Observations Up: Title Page Previous: Environments Used

Simple Perl Script To Perform LDAP Query For LAN Admin

The LDAPSEARCH tool is a line-mode access tool that sends an LDAP query to an LDAP server, and displays all of the data returned in <key> <value> pairs. The actual LDAP search is a one-line command. The Perl script enables the user to identify something about the desired LAN Administrator such as IP subdomain name, or AppleTalk network number range. The script then calls the LDAPSEARCH tool to talk to the LDAP server and get the desired data, which was limited by a set of search command, key selectors. The results are displayed as a simple line-mode table, as shown in the example in Figure 1.

While the LDAPSEARCH tool performs the actual LDAP lookup, its command format can be very long, tedious to enter, and not pleasing to the eye to behold. Also, LDAP results are usually one or more lines of <key> <value> pairs that usually have a raw appearance. The Perl script performs all of the work to make the search process simple and effective, and provides a better display.

Figure 1 is a sample result of the QLANADMIN Perl script used to provide this service, searching for the LAN Administrator of a specific IP subnet. When no parameters are given, the script will display information on how to use the script, listing the various parameters accepted. Figure 2 is a sample of the the LDAPSEARCH command used and the data returned from the LDAP server.

The LDAPSEARCH command is given several ``selection attributes'' that it passes to the LDAP server to restrict the number of attributes that will be returned by the server. In this script, the four selection attributes specified were: lanadmin postofficebox telephonenumber dnsadmin.

Figure 1: QLANADMIN
\begin{figure}
{\footnotesize\begin{verbatim}qlanadmin 216.000============...
...===================================\end{verbatim}}
\vspace{-0.20in}
\end{figure}

Figure 2: Raw LDAP search command and response
\begin{figure}
{\footnotesize\begin{verbatim}ldapsearch -h ldap.hostname -b o...
...employee,
ou=orgName,o=ournet,c=US\end{verbatim}}
\vspace{-0.20in}
\end{figure}

The distinction between IP subdomains and AppleTalk zone objects is made in the DN entry. Other attributes within each entry could have been used that are not a part of the DN. There are trade-offs to both approaches, but they won't be covered here.

As it was implemented, IP subdomains were represented by a DN which contained a Domain Component (DC) attribute for each component of the subdomain name. In the example above, the IP subdomain grdsch.ournet.edu has a DN that begins with dc=grdsch,dc=ournet,dc=edu. A representative AppleTalk zone is similarily identified, but only uses two DC attributes: one for the actual AppleTalk zone name, and one for a pseudo domain of AppleTalk.

Late note: multiple LDAPSEARCHs may, or may not, be better acccomodated with perldap[20].


Subsections
next up previous
Next: Performance Observations Up: Title Page Previous: Environments Used
Jim Dutton
2000-04-24